Skip to content

Commit

Permalink
test: Add placeholder/editable test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Oct 7, 2021
1 parent e395fa3 commit 0366403
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/index.test.tsx
Expand Up @@ -69,3 +69,17 @@ it('CodeMirror className', async () => {
expect(tree.props.className).toEqual('cm-theme-light test');
}
});

it('CodeMirror placeholder', async () => {
const { findByText } = render(<CodeMirror placeholder="Hello World" className="test" />);
const text = await findByText('Hello World');
expect(text.className).toEqual('cm-placeholder');
expect(text.contentEditable).toEqual('false');
});

it('CodeMirror editable', async () => {
const { getByRole } = render(<CodeMirror editable={false} className="test" />);
const text = getByRole('textbox');
expect(text.className).toEqual('cm-content');
expect(text.tagName).toEqual('DIV');
});

0 comments on commit 0366403

Please sign in to comment.