Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,26 +1,32 @@
import { CodeEditor, Language } from '../CodeEditor';
import React from 'react';
import { shallow } from 'enzyme';
import { render } from '@testing-library/react';
import { CodeEditor, Language } from '../CodeEditor';

test(`CodeEditor`, () => {
const view = shallow(<CodeEditor />);
expect(view).toMatchSnapshot();
});
describe('CodeEditor', () => {
beforeAll(() => {
window.HTMLCanvasElement.prototype.getContext = () => ({} as any);
});

test('matches snapshot without props', () => {
const view = render(<CodeEditor />);
expect(view.container).toMatchSnapshot();
});

test(`CodeEditor with all flags`, () => {
const view = shallow(
<CodeEditor
isReadOnly
isDarkTheme
isLineNumbersVisible={false}
isUploadEnabled
isLanguageLabelVisible
isDownloadEnabled
isCopyEnabled
height="400px"
code={'test'}
language={Language.javascript}
/>
);
expect(view).toMatchSnapshot();
test('matches snapshot with all props', () => {
const view = render(
<CodeEditor
isReadOnly
isDarkTheme
isLineNumbersVisible={false}
isUploadEnabled
isLanguageLabelVisible
isDownloadEnabled
isCopyEnabled
height="400px"
code={'test'}
language={Language.javascript}
/>
);
expect(view.container).toMatchSnapshot();
});
});
Loading