Skip to content

Commit 360131e

Browse files
committed
chore: use testing-library dom events
1 parent 8c21ffc commit 360131e

3 files changed

Lines changed: 20 additions & 15 deletions

File tree

package.json

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -47,20 +47,32 @@
4747
"clsx": "^2.1.1"
4848
},
4949
"devDependencies": {
50+
"@babel/eslint-parser": "^7.29.7",
51+
"@babel/eslint-plugin": "^7.29.7",
52+
"@eslint/eslintrc": "^3.3.5",
53+
"@eslint/js": "^9.39.4",
5054
"@rc-component/father-plugin": "^2.2.0",
5155
"@rc-component/menu": "^1.0.0",
5256
"@rc-component/np": "^1.0.4",
5357
"@rc-component/resize-observer": "^1.0.0",
58+
"@testing-library/dom": "^10.4.1",
5459
"@testing-library/jest-dom": "^6.9.1",
5560
"@testing-library/react": "^16.3.2",
5661
"@types/jest": "^30.0.0",
5762
"@types/node": "^26.0.1",
5863
"@types/react": "^19.2.17",
5964
"@types/react-dom": "^19.2.3",
6065
"@types/warning": "^3.0.4",
66+
"@typescript-eslint/eslint-plugin": "^8.62.0",
67+
"@typescript-eslint/parser": "^8.62.0",
6168
"@umijs/fabric": "^4.0.1",
6269
"dumi": "^2.4.35",
6370
"eslint": "^9.39.4",
71+
"eslint-config-prettier": "^10.1.8",
72+
"eslint-plugin-jest": "^29.15.3",
73+
"eslint-plugin-react": "^7.37.5",
74+
"eslint-plugin-react-hooks": "^7.1.1",
75+
"eslint-plugin-unicorn": "^65.0.1",
6476
"father": "^4.6.23",
6577
"glob": "^13.0.6",
6678
"husky": "^9.1.7",
@@ -71,18 +83,7 @@
7183
"rc-test": "^7.1.3",
7284
"react": "^19.2.7",
7385
"react-dom": "^19.2.7",
74-
"typescript": "^6.0.3",
75-
"@eslint/eslintrc": "^3.3.5",
76-
"@eslint/js": "^9.39.4",
77-
"eslint-plugin-react": "^7.37.5",
78-
"eslint-plugin-react-hooks": "^7.1.1",
79-
"eslint-config-prettier": "^10.1.8",
80-
"@babel/eslint-parser": "^7.29.7",
81-
"@babel/eslint-plugin": "^7.29.7",
82-
"@typescript-eslint/eslint-plugin": "^8.62.0",
83-
"@typescript-eslint/parser": "^8.62.0",
84-
"eslint-plugin-jest": "^29.15.3",
85-
"eslint-plugin-unicorn": "^65.0.1"
86+
"typescript": "^6.0.3"
8687
},
8788
"peerDependencies": {
8889
"react": ">=16.11.0",

tests/basic.test.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
import { fireEvent } from '@testing-library/dom';
12
/* eslint-disable react/button-has-type,react/no-find-dom-node,react/no-render-return-value,object-shorthand,func-names,max-len */
23
import type { MenuRef } from '@rc-component/menu';
34
import Menu, { Divider, Item as MenuItem } from '@rc-component/menu';
45
import { _rs } from '@rc-component/resize-observer';
56
import { spyElementPrototypes } from '@rc-component/util';
6-
import { act, fireEvent } from '@testing-library/react';
7+
import { act } from '@testing-library/react';
78
import type { HTMLAttributes } from 'react';
89
import * as React from 'react';
910
import { createRef, forwardRef, useImperativeHandle } from 'react';
@@ -296,7 +297,9 @@ describe('dropdown', () => {
296297
</Dropdown>,
297298
);
298299

299-
expect(container.querySelector('.my-button')).toHaveClass('rc-dropdown-open');
300+
expect(container.querySelector('.my-button')).toHaveClass(
301+
'rc-dropdown-open',
302+
);
300303
});
301304

302305
it('overlay callback', async () => {

tests/point.test.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
import { fireEvent } from '@testing-library/dom';
12
/* eslint-disable react/button-has-type,react/no-render-return-value */
2-
import { act, fireEvent } from '@testing-library/react';
3+
import { act } from '@testing-library/react';
34
import * as React from 'react';
45
import Dropdown from '../src';
56
import { render } from './utils';

0 commit comments

Comments
 (0)