Skip to content

Commit 0366403

Browse files
committed
test: Add placeholder/editable test case.
1 parent e395fa3 commit 0366403

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/index.test.tsx

+14
Original file line numberDiff line numberDiff line change
@@ -69,3 +69,17 @@ it('CodeMirror className', async () => {
6969
expect(tree.props.className).toEqual('cm-theme-light test');
7070
}
7171
});
72+
73+
it('CodeMirror placeholder', async () => {
74+
const { findByText } = render(<CodeMirror placeholder="Hello World" className="test" />);
75+
const text = await findByText('Hello World');
76+
expect(text.className).toEqual('cm-placeholder');
77+
expect(text.contentEditable).toEqual('false');
78+
});
79+
80+
it('CodeMirror editable', async () => {
81+
const { getByRole } = render(<CodeMirror editable={false} className="test" />);
82+
const text = getByRole('textbox');
83+
expect(text.className).toEqual('cm-content');
84+
expect(text.tagName).toEqual('DIV');
85+
});

0 commit comments

Comments
 (0)