Skip to content

Commit

Permalink
test: Add test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jul 15, 2021
1 parent cb159be commit 4e49c3f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
9 changes: 6 additions & 3 deletions src/app/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@ it('renders without crashing', () => {
ReactDOM.unmountComponentAtNode(div);
});

it('MDEditor commands code `ctrlcmd+j`', async () => {
it('App Click!`', async () => {
const { getByTitle } = render(<App />);
// const input = getByTitle('test');
fireEvent.keyDown(document, { key: 'J', code: 'KeyJ', ctrlKey: true, shiftKey: true });
// expect(handleChange).toHaveReturnedWith('```\nHello\n```');
const input = getByTitle('event.keyCode');
expect(input.className).toEqual('deprecated');
fireEvent.click(input);
fireEvent.click(input);
expect(input.parentElement!.className).toEqual('w-copy-to-clipboard copied');
});
1 change: 0 additions & 1 deletion src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ const App = () => {
event.preventDefault();
const target = event.target as HTMLSpanElement;
target.parentElement!.classList.add('copied');
console.log(event)
if (timer) clearTimeout(timer);
setCopied(true);
timer = setTimeout(() => {
Expand Down

0 comments on commit 4e49c3f

Please sign in to comment.