Skip to content

Commit

Permalink
test: fix test case error.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jan 12, 2022
1 parent cfbdadd commit 867067b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions src/app/App.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { render, fireEvent } from '@testing-library/react';
import { render, fireEvent, screen } from '@testing-library/react';
import App from './App';

it('renders without crashing', () => {
Expand All @@ -10,11 +10,12 @@ it('renders without crashing', () => {
});

it('App Click!`', async () => {
const { getByTitle } = render(<App />);
render(<App />);
fireEvent.keyDown(document, { key: 'J', code: 'KeyJ', ctrlKey: true, shiftKey: true });
const input = getByTitle('event.keyCode');
const input = screen.getByTitle<HTMLElement>('event.keyCode');
expect(input.className).toEqual('deprecated');
fireEvent.click(input);
fireEvent.click(input);
expect(input.parentElement!.className).toEqual('w-copy-to-clipboard copied');
// eslint-disable-next-line testing-library/no-node-access
expect(input.parentElement?.className).toEqual('w-copy-to-clipboard copied');
});
2 changes: 1 addition & 1 deletion src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const App = () => {
'metaKey',
'repeat',
'shiftKey',
'char',
// 'char',
'charCode',
'keyCode',
// 'keyIdentifier',
Expand Down

0 comments on commit 867067b

Please sign in to comment.