Skip to content

Commit 853be7e

Browse files
committed
feat!: support React19 & drop React 16,17 support
1 parent 2989b5b commit 853be7e

File tree

7 files changed

+59
-100
lines changed

7 files changed

+59
-100
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
# Otherwise how would we know if a specific React version caused the failure?
1515
fail-fast: false
1616
matrix:
17-
REACT_DIST: [16, 17, 18]
17+
REACT_DIST: [18, 19]
1818
steps:
1919
- uses: actions/checkout@v2
2020
- name: Use Node.js 14
@@ -24,8 +24,6 @@ jobs:
2424
cache: 'npm'
2525
- run: yarn
2626
- run: yarn add react@${{ matrix.REACT_DIST }} react-dom@${{ matrix.REACT_DIST }}
27-
- run: yarn add @testing-library/react@12
28-
if: matrix.REACT_DIST == '17' || matrix.REACT_DIST == '16'
2927
- run: yarn --cwd www
3028
# Test whether the web page can be built successfully or not
3129
- run: yarn --cwd www build

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@
8080
"@semantic-release/npm": "^7.0.5",
8181
"@storybook/addon-actions": "^6.3.4",
8282
"@storybook/react": "^6.3.4",
83-
"@testing-library/react": "alpha",
83+
"@testing-library/dom": "^10.4.0",
84+
"@testing-library/react": "^16.1.0",
8485
"@typescript-eslint/eslint-plugin": "^4.26.1",
8586
"astroturf": "^0.10.4",
8687
"babel-eslint": "^10.1.0",
@@ -99,8 +100,8 @@
99100
"jest": "^25.3.0",
100101
"npm-run-all": "^4.1.5",
101102
"prettier": "^2.3.1",
102-
"react": "^18.0.0",
103-
"react-dom": "^18.0.0",
103+
"react": "^19.0.0",
104+
"react-dom": "^19.0.0",
104105
"release-script": "^1.0.2",
105106
"rimraf": "^3.0.2",
106107
"rollup": "^2.6.1",

test/CSSTransitionGroup-test.js

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import hasClass from 'dom-helpers/hasClass';
22
import CSSTransition from '../src/CSSTransition';
33

44
let React;
5-
let ReactDOM;
65
let TransitionGroup;
76
let act;
87
let render;
@@ -25,9 +24,7 @@ describe('CSSTransitionGroup', () => {
2524
beforeEach(() => {
2625
jest.resetModuleRegistry();
2726
jest.useFakeTimers();
28-
2927
React = require('react');
30-
ReactDOM = require('react-dom');
3128
const testUtils = require('./utils');
3229
act = testUtils.act;
3330
const baseRender = testUtils.render;
@@ -147,13 +144,14 @@ describe('CSSTransitionGroup', () => {
147144
});
148145

149146
it('should work with a child which renders as null', () => {
147+
const nodeRef = React.createRef();
150148
const NullComponent = () => null;
151149
// Testing the whole lifecycle of entering and exiting,
152150
// because those lifecycle methods used to fail when the DOM node was null.
153151
render(<TransitionGroup />, container);
154152
render(
155153
<TransitionGroup>
156-
<CSSTransition classNames="yolo" timeout={0}>
154+
<CSSTransition classNames="yolo" timeout={0} nodeRef={nodeRef}>
157155
<NullComponent />
158156
</CSSTransition>
159157
</TransitionGroup>,
@@ -208,14 +206,13 @@ describe('CSSTransitionGroup', () => {
208206
}
209207

210208
render(<Component />, container);
211-
render(
209+
const { unmount } = render(
212210
<Component>
213211
<YoloTransition key="yolo" id="yolo" />
214212
</Component>,
215213
container
216214
);
217-
218-
ReactDOM.unmountComponentAtNode(container);
215+
unmount();
219216

220217
// Testing that no exception is thrown here, as the timeout has been cleared.
221218
act(() => {

test/Transition-test.js

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React from 'react';
2-
import ReactDOM from 'react-dom';
32

43
import { render, waitFor } from './utils';
54

@@ -197,35 +196,6 @@ describe('Transition', () => {
197196
});
198197
});
199198

200-
it('should use `React.findDOMNode` when `nodeRef` is not provided', () => {
201-
const consoleSpy = jest.spyOn(console, 'error').mockImplementation();
202-
const findDOMNodeSpy = jest.spyOn(ReactDOM, 'findDOMNode');
203-
204-
render(
205-
<Transition in appear timeout={0}>
206-
<div />
207-
</Transition>
208-
);
209-
210-
expect(findDOMNodeSpy).toHaveBeenCalled();
211-
findDOMNodeSpy.mockRestore();
212-
consoleSpy.mockRestore();
213-
});
214-
215-
it('should not use `React.findDOMNode` when `nodeRef` is provided', () => {
216-
const findDOMNodeSpy = jest.spyOn(ReactDOM, 'findDOMNode');
217-
218-
const nodeRef = React.createRef();
219-
render(
220-
<Transition nodeRef={nodeRef} in appear timeout={0}>
221-
<div ref={nodeRef} />
222-
</Transition>
223-
);
224-
225-
expect(findDOMNodeSpy).not.toHaveBeenCalled();
226-
findDOMNodeSpy.mockRestore();
227-
});
228-
229199
describe('appearing timeout', () => {
230200
it('should use enter timeout if appear not set', async () => {
231201
let calledBeforeEntered = false;

test/setupAfterEnv.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { cleanup } from '@testing-library/react/pure';
1+
import { cleanup } from '@testing-library/react';
22

33
afterEach(() => {
44
cleanup();

test/utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { render as baseRender } from '@testing-library/react/pure';
1+
import { render as baseRender } from '@testing-library/react';
22
import React from 'react';
33

44
export * from '@testing-library/react';

yarn.lock

Lines changed: 48 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -3492,28 +3492,26 @@
34923492
resolve-from "^5.0.0"
34933493
store2 "^2.12.0"
34943494

3495-
"@testing-library/dom@^8.5.0":
3496-
version "8.12.0"
3497-
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-8.12.0.tgz#fef5e545533fb084175dda6509ee71d7d2f72e23"
3498-
integrity sha512-rBrJk5WjI02X1edtiUcZhgyhgBhiut96r5Jp8J5qktKdcvLcZpKDW8i2hkGMMItxrghjXuQ5AM6aE0imnFawaw==
3495+
"@testing-library/dom@^10.4.0":
3496+
version "10.4.0"
3497+
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-10.4.0.tgz#82a9d9462f11d240ecadbf406607c6ceeeff43a8"
3498+
integrity sha512-pemlzrSESWbdAloYml3bAJMEfNh1Z7EduzqPKprCH5S341frlpYnUEW0H72dLxa6IsYr+mPno20GiSm+h9dEdQ==
34993499
dependencies:
35003500
"@babel/code-frame" "^7.10.4"
35013501
"@babel/runtime" "^7.12.5"
3502-
"@types/aria-query" "^4.2.0"
3503-
aria-query "^5.0.0"
3502+
"@types/aria-query" "^5.0.1"
3503+
aria-query "5.3.0"
35043504
chalk "^4.1.0"
35053505
dom-accessibility-api "^0.5.9"
3506-
lz-string "^1.4.4"
3506+
lz-string "^1.5.0"
35073507
pretty-format "^27.0.2"
35083508

3509-
"@testing-library/react@alpha":
3510-
version "13.0.0-alpha.7"
3511-
resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-13.0.0-alpha.7.tgz#0537af3a8d45edd925fd0275aee7d409285ef1fe"
3512-
integrity sha512-8Y1PvFczthSeow1WZ0Cq6WbOzpVGLGyEQTr+lL6BwXqAf2IykVY8ZN8V21Ch1cTlbZuZJI5UV3gOyrOHrw9YZQ==
3509+
"@testing-library/react@^16.1.0":
3510+
version "16.1.0"
3511+
resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-16.1.0.tgz#aa0c61398bac82eaf89776967e97de41ac742d71"
3512+
integrity sha512-Q2ToPvg0KsVL0ohND9A3zLJWcOXXcO8IDu3fj11KhNt0UlCWyFyvnCIBkd12tidB2lkiVRG8VFqdhcqhqnAQtg==
35133513
dependencies:
35143514
"@babel/runtime" "^7.12.5"
3515-
"@testing-library/dom" "^8.5.0"
3516-
"@types/react-dom" "*"
35173515

35183516
"@tootallnate/once@1":
35193517
version "1.0.0"
@@ -3525,10 +3523,10 @@
35253523
resolved "https://registry.yarnpkg.com/@types/anymatch/-/anymatch-1.3.1.tgz#336badc1beecb9dacc38bea2cf32adf627a8421a"
35263524
integrity sha512-/+CRPXpBDpo2RK9C68N3b2cOvO0Cf5B9aPijHsoDQTHivnGSObdOF2BRQOYjojWTDy6nQvMjmqRXIxH55VjxxA==
35273525

3528-
"@types/aria-query@^4.2.0":
3529-
version "4.2.2"
3530-
resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-4.2.2.tgz#ed4e0ad92306a704f9fb132a0cfcf77486dbe2bc"
3531-
integrity sha512-HnYpAE1Y6kRyKM/XkEuiRQhTHvkzMBurTHnpFLYLBGPIylZNPs9jJcuOOYWxPLJCSEtmZT0Y8rHDokKN7rRTig==
3526+
"@types/aria-query@^5.0.1":
3527+
version "5.0.4"
3528+
resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-5.0.4.tgz#1a31c3d378850d2778dabb6374d036dcba4ba708"
3529+
integrity sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==
35323530

35333531
"@types/babel__core@^7.1.7":
35343532
version "7.1.7"
@@ -3767,13 +3765,6 @@
37673765
dependencies:
37683766
"@types/react" "*"
37693767

3770-
"@types/react-dom@*":
3771-
version "17.0.14"
3772-
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.14.tgz#c8f917156b652ddf807711f5becbd2ab018dea9f"
3773-
integrity sha512-H03xwEP1oXmSfl3iobtmQ/2dHF5aBHr8aUMwyGZya6OW45G+xtdzmq6HkncefiBt5JU8DVyaWl/nWZbjZCnzAQ==
3774-
dependencies:
3775-
"@types/react" "*"
3776-
37773768
37783769
version "11.0.5"
37793770
resolved "https://registry.yarnpkg.com/@types/react-syntax-highlighter/-/react-syntax-highlighter-11.0.5.tgz#0d546261b4021e1f9d85b50401c0a42acb106087"
@@ -4453,6 +4444,13 @@ argv-formatter@~1.0.0:
44534444
resolved "https://registry.yarnpkg.com/argv-formatter/-/argv-formatter-1.0.0.tgz#a0ca0cbc29a5b73e836eebe1cbf6c5e0e4eb82f9"
44544445
integrity sha1-oMoMvCmltz6Dbuvhy/bF4OTrgvk=
44554446

4447+
4448+
version "5.3.0"
4449+
resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-5.3.0.tgz#650c569e41ad90b51b3d7df5e5eed1c7549c103e"
4450+
integrity sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==
4451+
dependencies:
4452+
dequal "^2.0.3"
4453+
44564454
aria-query@^4.2.2:
44574455
version "4.2.2"
44584456
resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-4.2.2.tgz#0d2ca6c9aceb56b8977e9fed6aed7e15bbd2f83b"
@@ -4461,11 +4459,6 @@ aria-query@^4.2.2:
44614459
"@babel/runtime" "^7.10.2"
44624460
"@babel/runtime-corejs3" "^7.10.2"
44634461

4464-
aria-query@^5.0.0:
4465-
version "5.0.0"
4466-
resolved "https://registry.yarnpkg.com/aria-query/-/aria-query-5.0.0.tgz#210c21aaf469613ee8c9a62c7f86525e058db52c"
4467-
integrity sha512-V+SM7AbUwJ+EBnB8+DXs0hPZHO0W6pqBcc0dW90OwtVG02PswOu/teuARoLQjdDOH+t9pJgGnW5/Qmouf3gPJg==
4468-
44694462
arr-diff@^4.0.0:
44704463
version "4.0.0"
44714464
resolved "https://registry.yarnpkg.com/arr-diff/-/arr-diff-4.0.0.tgz#d6461074febfec71e7e15235761a329a5dc7c520"
@@ -6967,6 +6960,11 @@ deprecation@^2.0.0, deprecation@^2.3.1:
69676960
resolved "https://registry.yarnpkg.com/deprecation/-/deprecation-2.3.1.tgz#6368cbdb40abf3373b525ac87e4a260c3a700919"
69686961
integrity sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==
69696962

6963+
dequal@^2.0.3:
6964+
version "2.0.3"
6965+
resolved "https://registry.yarnpkg.com/dequal/-/dequal-2.0.3.tgz#2644214f1997d39ed0ee0ece72335490a7ac67be"
6966+
integrity sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==
6967+
69706968
des.js@^1.0.0:
69716969
version "1.0.1"
69726970
resolved "https://registry.yarnpkg.com/des.js/-/des.js-1.0.1.tgz#5382142e1bdc53f85d86d53e5f4aa7deb91e0843"
@@ -7074,9 +7072,9 @@ doctrine@^3.0.0:
70747072
esutils "^2.0.2"
70757073

70767074
dom-accessibility-api@^0.5.9:
7077-
version "0.5.13"
7078-
resolved "https://registry.yarnpkg.com/dom-accessibility-api/-/dom-accessibility-api-0.5.13.tgz#102ee5f25eacce09bdf1cfa5a298f86da473be4b"
7079-
integrity sha512-R305kwb5CcMDIpSHUnLyIAp7SrSPBx6F0VfQFB3M75xVMHhXJJIdePYgbPPh1o57vCHNu5QztokWUPsLjWzFqw==
7075+
version "0.5.16"
7076+
resolved "https://registry.yarnpkg.com/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz#5a7429e6066eb3664d911e33fb0e45de8eb08453"
7077+
integrity sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==
70807078

70817079
dom-converter@^0.2:
70827080
version "0.2.0"
@@ -11449,7 +11447,7 @@ lolex@^5.0.0:
1144911447
dependencies:
1145011448
"@sinonjs/commons" "^1.7.0"
1145111449

11452-
loose-envify@^1.0.0, loose-envify@^1.1.0, loose-envify@^1.4.0:
11450+
loose-envify@^1.0.0, loose-envify@^1.4.0:
1145311451
version "1.4.0"
1145411452
resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz#71ee51fa7be4caec1a63839f7e682d8132d30caf"
1145511453
integrity sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==
@@ -11506,10 +11504,10 @@ lru-cache@^6.0.0:
1150611504
dependencies:
1150711505
yallist "^4.0.0"
1150811506

11509-
lz-string@^1.4.4:
11510-
version "1.4.4"
11511-
resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.4.4.tgz#c0d8eaf36059f705796e1e344811cf4c498d3a26"
11512-
integrity sha1-wNjq82BZ9wV5bh40SBHPTEmNOiY=
11507+
lz-string@^1.5.0:
11508+
version "1.5.0"
11509+
resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.5.0.tgz#c1ab50f77887b712621201ba9fd4e3a6ed099941"
11510+
integrity sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==
1151311511

1151411512
macos-release@^2.2.0:
1151511513
version "2.3.0"
@@ -14354,13 +14352,12 @@ react-docgen@^5.0.0:
1435414352
node-dir "^0.1.10"
1435514353
strip-indent "^3.0.0"
1435614354

14357-
react-dom@^18.0.0:
14358-
version "18.0.0"
14359-
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-18.0.0.tgz#26b88534f8f1dbb80853e1eabe752f24100d8023"
14360-
integrity sha512-XqX7uzmFo0pUceWFCt7Gff6IyIMzFUn7QMZrbrQfGxtaxXZIcGQzoNpRLE3fQLnS4XzLLPMZX2T9TRcSrasicw==
14355+
react-dom@^19.0.0:
14356+
version "19.0.0"
14357+
resolved "https://registry.yarnpkg.com/react-dom/-/react-dom-19.0.0.tgz#43446f1f01c65a4cd7f7588083e686a6726cfb57"
14358+
integrity sha512-4GV5sHFG0e/0AD4X+ySy6UJd3jVl1iNsNHdpad0qhABJ11twS3TTBnseqsKurKcsNqCEFeGL3uLpVChpIO3QfQ==
1436114359
dependencies:
14362-
loose-envify "^1.1.0"
14363-
scheduler "^0.21.0"
14360+
scheduler "^0.25.0"
1436414361

1436514362
react-draggable@^4.4.3:
1436614363
version "4.4.3"
@@ -14472,12 +14469,10 @@ react-textarea-autosize@^8.3.0:
1447214469
use-composed-ref "^1.0.0"
1447314470
use-latest "^1.0.0"
1447414471

14475-
react@^18.0.0:
14476-
version "18.0.0"
14477-
resolved "https://registry.yarnpkg.com/react/-/react-18.0.0.tgz#b468736d1f4a5891f38585ba8e8fb29f91c3cb96"
14478-
integrity sha512-x+VL6wbT4JRVPm7EGxXhZ8w8LTROaxPXOqhlGyVSrv0sB1jkyFGgXxJ8LVoPRLvPR6/CIZGFmfzqUa2NYeMr2A==
14479-
dependencies:
14480-
loose-envify "^1.1.0"
14472+
react@^19.0.0:
14473+
version "19.0.0"
14474+
resolved "https://registry.yarnpkg.com/react/-/react-19.0.0.tgz#6e1969251b9f108870aa4bff37a0ce9ddfaaabdd"
14475+
integrity sha512-V8AVnmPIICiWpGfm6GLzCR/W5FXLchHop40W4nXBmdlEceh16rCN8O8LNWm5bh5XUX91fh7KpA+W0TgMKmgTpQ==
1448114476

1448214477
read-chunk@^1.0.1:
1448314478
version "1.0.1"
@@ -15250,12 +15245,10 @@ saxes@^3.1.9:
1525015245
dependencies:
1525115246
xmlchars "^2.1.1"
1525215247

15253-
scheduler@^0.21.0:
15254-
version "0.21.0"
15255-
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.21.0.tgz#6fd2532ff5a6d877b6edb12f00d8ab7e8f308820"
15256-
integrity sha512-1r87x5fz9MXqswA2ERLo0EbOAU74DpIUO090gIasYTqlVoJeMcl+Z1Rg7WHz+qtPujhS/hGIt9kxZOYBV3faRQ==
15257-
dependencies:
15258-
loose-envify "^1.1.0"
15248+
scheduler@^0.25.0:
15249+
version "0.25.0"
15250+
resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.25.0.tgz#336cd9768e8cceebf52d3c80e3dcf5de23e7e015"
15251+
integrity sha512-xFVuu11jh+xcO7JOAGJNOXld8/TcEHK/4CituBUeUb5hqxJLj9YuemAEuvm9gQ/+pgXYfbQuqAkiYu+u7YEsNA==
1525915252

1526015253
1526115254
version "2.7.0"

0 commit comments

Comments
 (0)