Skip to content

test: Run with React 18 #2526

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,7 @@
"@storybook/react": "^6.1.10",
"@testing-library/dom": "^8.0.0",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.0.0",
"@testing-library/react-hooks": "^3.4.1",
"@testing-library/react": "https://pkg.csb.dev/testing-library/react-testing-library/commit/0f93c987/@testing-library/react",
"@testing-library/user-event": "^12.1.3",
"@types/react": "^16.9.23",
"@types/storybook__react": "^5.2.1",
Expand Down Expand Up @@ -151,9 +150,9 @@
"postcss-svg": "^3.0.0",
"prop-types": "^15.6.0",
"raf": "^3.4.0",
"react": "^16.8.0 || ^17.0.0-rc.1",
"react": "18.0.0-alpha-ee069065d-20211105",
"react-axe": "^3.0.2",
"react-dom": "^16.8.0 || ^17.0.0-rc.1",
"react-dom": "18.0.0-alpha-ee069065d-20211105",
"react-overlays": "0.8.3",
"react-test-renderer": "^16.9.0",
"recursive-readdir": "^2.2.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

import React from 'react';
import {renderHook} from '@testing-library/react-hooks';
import {renderHook} from '@testing-library/react';
import {useActionGroup} from '../';
import {useListState} from '@react-stately/list';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import {Item} from '@react-stately/collections';
import {ListLayout} from '@react-stately/layout';
import React from 'react';
import {renderHook} from '@testing-library/react-hooks';
import {renderHook} from '@testing-library/react';
import {useComboBoxState} from '@react-stately/combobox';
import {useSearchAutocomplete} from '../';
import {useSingleSelectListState} from '@react-stately/list';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

import React from 'react';
import {renderHook} from '@testing-library/react-hooks';
import {renderHook} from '@testing-library/react';
import {useBreadcrumbItem} from '../';

describe('useBreadcrumbItem', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

import React from 'react';
import {renderHook} from '@testing-library/react-hooks';
import {renderHook} from '@testing-library/react';
import {useBreadcrumbs} from '../';

describe('useBreadcrumbs', function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/button/test/useButton.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

import React from 'react';
import {renderHook} from '@testing-library/react-hooks';
import {renderHook} from '@testing-library/react';
import {useButton} from '../';

describe('useButton tests', function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/color/test/useColorField.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import {parseColor} from '@react-stately/color';
import React from 'react';
import {renderHook} from '@testing-library/react-hooks';
import {renderHook} from '@testing-library/react';
import {useColorField} from '../';

describe('useColorField', function () {
Expand Down
7 changes: 2 additions & 5 deletions packages/@react-aria/combobox/test/useComboBox.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* governing permissions and limitations under the License.
*/

import {act, renderHook} from '@testing-library/react-hooks';
import {act, renderHook} from '@testing-library/react';
import {Item} from '@react-stately/collections';
import {ListLayout} from '@react-stately/layout';
import React from 'react';
Expand Down Expand Up @@ -77,10 +77,7 @@ describe('useComboBox', function () {
popoverRef: React.createRef(),
buttonRef: React.createRef(),
inputRef: {
current: {
contains: jest.fn(),
focus: jest.fn()
}
current: document.createElement('input')
},
listBoxRef: React.createRef(),
layout: mockLayout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
import {act, fireEvent, render, screen} from '@testing-library/react';
import React from 'react';
import {renderHook} from '@testing-library/react-hooks';
import {renderHook} from '@testing-library/react';
import {useFocusVisible, useFocusVisibleListener} from '../';

function Example(props) {
Expand Down
4 changes: 2 additions & 2 deletions packages/@react-aria/interactions/test/useHover.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -548,9 +548,9 @@ describe('useHover', function () {
// Ensure we close any dialogs before unmounting to avoid warning.
let dialog = document.querySelector('[role="dialog"]');
if (dialog) {
fireEvent.keyDown(dialog, {key: 'Escape'});
fireEvent.keyUp(dialog, {key: 'Escape'});
act(() => {
fireEvent.keyDown(dialog, {key: 'Escape'});
fireEvent.keyUp(dialog, {key: 'Escape'});
jest.runAllTimers();
});
}
Expand Down
4 changes: 2 additions & 2 deletions packages/@react-aria/interactions/test/usePress.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2367,9 +2367,9 @@ describe('usePress', function () {
// Ensure we close any dialogs before unmounting to avoid warning.
let dialog = document.querySelector('[role="dialog"]');
if (dialog) {
fireEvent.keyDown(dialog, {key: 'Escape'});
fireEvent.keyUp(dialog, {key: 'Escape'});
act(() => {
fireEvent.keyDown(dialog, {key: 'Escape'});
fireEvent.keyUp(dialog, {key: 'Escape'});
jest.runAllTimers();
});
}
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/label/test/useField.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import React from 'react';
import {render} from '@testing-library/react';
import {renderHook} from '@testing-library/react-hooks';
import {renderHook} from '@testing-library/react';
import {useField} from '../';
import {WithError} from '../stories/useField.stories';

Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/label/test/useLabel.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

import React from 'react';
import {renderHook} from '@testing-library/react-hooks';
import {renderHook} from '@testing-library/react';
import {useLabel} from '../';

describe('useLabel hook', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/link/test/useLink.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

import React from 'react';
import {renderHook} from '@testing-library/react-hooks';
import {renderHook} from '@testing-library/react';
import {useLink} from '../';

describe('useLink', function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/menu/test/useMenuTrigger.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

import React from 'react';
import {renderHook} from '@testing-library/react-hooks';
import {renderHook} from '@testing-library/react';
import {useMenuTrigger} from '../';

describe('useMenuTrigger', function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/pagination/test/usePagination.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

import React from 'react';
import {renderHook} from '@testing-library/react-hooks';
import {renderHook} from '@testing-library/react';
import {usePagination} from '../';

describe('usePagination tests', function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/progress/test/useProgressBar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

import React from 'react';
import {renderHook} from '@testing-library/react-hooks';
import {renderHook} from '@testing-library/react';
import {useProgressBar} from '../';

describe('useProgressBar', function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import intlMessages from '../intl/*.json';
import {Provider} from '@react-spectrum/provider';
import React from 'react';
import {renderHook} from '@testing-library/react-hooks';
import {renderHook} from '@testing-library/react';
import {theme} from '@react-spectrum/theme-default';
import {useSearchField} from '../';

Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/sidenav/test/useSideNav.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import {ListLayout} from '@react-stately/layout';
import React from 'react';
import {renderHook} from '@testing-library/react-hooks';
import {renderHook} from '@testing-library/react';
import {useSideNav} from '../';

describe('useSideNav', function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/sidenav/test/useSideNavItem.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

import React from 'react';
import {renderHook} from '@testing-library/react-hooks';
import {renderHook} from '@testing-library/react';
import {useSideNavItem} from '../';

describe('useSideNavItem', function () {
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/slider/test/useSlider.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {fireEvent, render, screen} from '@testing-library/react';
import {installMouseEvent, installPointerEvent} from '@react-spectrum/test-utils';
import * as React from 'react';
import {renderHook} from '@testing-library/react-hooks';
import {renderHook} from '@testing-library/react';
import {useRef} from 'react';
import {useSlider, useSliderThumb} from '../src';
import {useSliderState} from '@react-stately/slider';
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/slider/test/useSliderThumb.test.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {fireEvent, render, screen} from '@testing-library/react';
import {installMouseEvent, installPointerEvent} from '@react-spectrum/test-utils';
import * as React from 'react';
import {renderHook} from '@testing-library/react-hooks';
import {renderHook} from '@testing-library/react';
import {useRef} from 'react';
import {useSlider, useSliderThumb} from '../src';
import {useSliderState} from '@react-stately/slider';
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/tag/test/useTag.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* governing permissions and limitations under the License.
*/

import {renderHook} from '@testing-library/react-hooks';
import {renderHook} from '@testing-library/react';
import {useTag} from '../';

describe('useTag tests', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/textfield/test/useTextField.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

import React from 'react';
import {renderHook} from '@testing-library/react-hooks';
import {renderHook} from '@testing-library/react';
import {useTextField} from '../';

describe('useTextField hook', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/toast/test/useToast.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import intlMessages from '../intl/*.json';
import {Provider} from '@react-spectrum/provider';
import React from 'react';
import {renderHook} from '@testing-library/react-hooks';
import {renderHook} from '@testing-library/react';
import {theme} from '@react-spectrum/theme-default';
import {useToast} from '../';

Expand Down
2 changes: 1 addition & 1 deletion packages/@react-aria/utils/test/useObjectRef.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import React, {useEffect, useLayoutEffect} from 'react';
import {render, screen} from '@testing-library/react';
import {renderHook} from '@testing-library/react-hooks';
import {renderHook} from '@testing-library/react';
import {useObjectRef} from '../';

describe('useObjectRef', () => {
Expand Down
Loading