Skip to content

Commit eb6a208

Browse files
committed
upgrade tests to react 18
1 parent 8d2ead3 commit eb6a208

3 files changed

Lines changed: 15 additions & 12 deletions

File tree

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@
3737
"now-build": "npm run build"
3838
},
3939
"peerDependencies": {
40-
"react": ">=16.9.0",
41-
"react-dom": ">=16.9.0"
40+
"react": ">=18.0.0",
41+
"react-dom": ">=18.0.0"
4242
},
4343
"devDependencies": {
4444
"@rc-component/father-plugin": "^2.1.3",
4545
"@rc-component/np": "^1.0.4",
4646
"@testing-library/jest-dom": "^5.17.0",
47-
"@testing-library/react": "^12.1.5",
47+
"@testing-library/react": "^13.4.0",
4848
"@types/enzyme": "^3.10.5",
4949
"@types/jest": "^30.0.0",
5050
"@types/node": "^24.10.1",
@@ -53,16 +53,16 @@
5353
"@types/warning": "^3.0.0",
5454
"cheerio": "1.0.0-rc.12",
5555
"dumi": "^2.2.17",
56-
"enzyme": "^3.1.0",
57-
"enzyme-adapter-react-16": "^1.15.6",
56+
"enzyme": "^3.11.0",
57+
"enzyme-adapter-react-16": "npm:@mnajdova/enzyme-adapter-react-18@^0.2.0",
5858
"eslint": "^8.56.0",
5959
"eslint-plugin-unicorn": "^55.0.0",
6060
"father": "^4.4.0",
6161
"glob": "^7.1.6",
6262
"rc-animate": "^2.9.1",
63-
"rc-test": "^7.0.15",
64-
"react": "16.14.0",
65-
"react-dom": "16.14.0",
63+
"rc-test": "^7.1.3",
64+
"react": "^18.3.1",
65+
"react-dom": "^18.3.1",
6666
"typescript": "^5.0.0"
6767
},
6868
"dependencies": {

tests/scroll.test.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,8 @@ describe('List.Scroll', () => {
149149
...result,
150150
ref,
151151
scrollTo: (...args) => {
152-
ref.current.scrollTo(...args);
153-
154152
act(() => {
153+
ref.current.scrollTo(...args);
155154
jest.runAllTimers();
156155
});
157156
},

tests/scrollWidth.test.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,14 @@ describe('List.scrollWidth', () => {
230230
ref: listRef,
231231
});
232232

233-
listRef.current.scrollTo({ left: 135 });
233+
act(() => {
234+
listRef.current.scrollTo({ left: 135 });
235+
});
234236
expect(listRef.current.getScrollInfo()).toEqual({ x: 135, y: 0 });
235237

236-
listRef.current.scrollTo({ left: -99 });
238+
act(() => {
239+
listRef.current.scrollTo({ left: -99 });
240+
});
237241
expect(listRef.current.getScrollInfo()).toEqual({ x: 0, y: 0 });
238242
});
239243

0 commit comments

Comments
 (0)