Skip to content
Merged
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
1 change: 1 addition & 0 deletions packages/@react-aria/test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
"@swc/helpers": "^0.5.0"
},
"peerDependencies": {
"@testing-library/dom": "^10.1.0",
"@testing-library/react": "^16.0.0",
"@testing-library/user-event": "^14.0.0",
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
Expand Down
23 changes: 23 additions & 0 deletions packages/@react-aria/test-utils/src/act.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2025 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/

import * as React from 'react';
import * as ReactDOMTestUtils from 'react-dom/test-utils';

let actImpl: typeof ReactDOMTestUtils.act;
if (typeof React.act === 'function') {
actImpl = React.act;
} else {
actImpl = ReactDOMTestUtils.act;
}

export const act = actImpl;
3 changes: 2 additions & 1 deletion packages/@react-aria/test-utils/src/checkboxgroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
* governing permissions and limitations under the License.
*/

import {act, within} from '@testing-library/react';
import {act} from './act';
import {CheckboxGroupTesterOpts, UserOpts} from './types';
import {pressElement} from './events';
import {within} from '@testing-library/dom';

interface TriggerCheckboxOptions {
/**
Expand Down
3 changes: 2 additions & 1 deletion packages/@react-aria/test-utils/src/combobox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
* governing permissions and limitations under the License.
*/

import {act, waitFor, within} from '@testing-library/react';
import {act} from './act';
import {ComboBoxTesterOpts, UserOpts} from './types';
import {waitFor, within} from '@testing-library/dom';

interface ComboBoxOpenOpts {
/**
Expand Down
3 changes: 2 additions & 1 deletion packages/@react-aria/test-utils/src/dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
* governing permissions and limitations under the License.
*/

import {act, waitFor, within} from '@testing-library/react';
import {act} from './act';
import {DialogTesterOpts, UserOpts} from './types';
import {waitFor, within} from '@testing-library/dom';

interface DialogOpenOpts {
/**
Expand Down
3 changes: 2 additions & 1 deletion packages/@react-aria/test-utils/src/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
* governing permissions and limitations under the License.
*/

import {act, fireEvent} from '@testing-library/react';
import {act} from './act';
import {fireEvent} from '@testing-library/dom';
import {UserOpts} from './types';

export const DEFAULT_LONG_PRESS_TIME = 500;
Expand Down
3 changes: 2 additions & 1 deletion packages/@react-aria/test-utils/src/gridlist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
* governing permissions and limitations under the License.
*/

import {act, within} from '@testing-library/react';
import {act} from './act';
import {getAltKey, getMetaKey, pressElement, triggerLongPress} from './events';
import {GridListTesterOpts, GridRowActionOpts, ToggleGridRowOpts, UserOpts} from './types';
import {within} from '@testing-library/dom';

interface GridListToggleRowOpts extends ToggleGridRowOpts {}
interface GridListRowActionOpts extends GridRowActionOpts {}
Expand Down
3 changes: 2 additions & 1 deletion packages/@react-aria/test-utils/src/listbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
* governing permissions and limitations under the License.
*/

import {act, within} from '@testing-library/react';
import {act} from './act';
import {getAltKey, getMetaKey, pressElement, triggerLongPress} from './events';
import {ListBoxTesterOpts, UserOpts} from './types';
import {within} from '@testing-library/dom';

interface ListBoxToggleOptionOpts {
/**
Expand Down
3 changes: 2 additions & 1 deletion packages/@react-aria/test-utils/src/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
* governing permissions and limitations under the License.
*/

import {act, waitFor, within} from '@testing-library/react';
import {act} from './act';
import {MenuTesterOpts, UserOpts} from './types';
import {triggerLongPress} from './events';
import {waitFor, within} from '@testing-library/dom';

interface MenuOpenOpts {
/**
Expand Down
3 changes: 2 additions & 1 deletion packages/@react-aria/test-utils/src/radiogroup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
* governing permissions and limitations under the License.
*/

import {act, within} from '@testing-library/react';
import {act} from './act';
import {Direction, Orientation, RadioGroupTesterOpts, UserOpts} from './types';
import {pressElement} from './events';
import {within} from '@testing-library/dom';

interface TriggerRadioOptions {
/**
Expand Down
3 changes: 2 additions & 1 deletion packages/@react-aria/test-utils/src/select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
* governing permissions and limitations under the License.
*/

import {act, waitFor, within} from '@testing-library/react';
import {act} from './act';
import {SelectTesterOpts, UserOpts} from './types';
import {waitFor, within} from '@testing-library/dom';

interface SelectOpenOpts {
/**
Expand Down
3 changes: 2 additions & 1 deletion packages/@react-aria/test-utils/src/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
* governing permissions and limitations under the License.
*/

import {act, waitFor, within} from '@testing-library/react';
import {act} from './act';
import {BaseGridRowInteractionOpts, GridRowActionOpts, TableTesterOpts, ToggleGridRowOpts, UserOpts} from './types';
import {getAltKey, getMetaKey, pressElement, triggerLongPress} from './events';
import {waitFor, within} from '@testing-library/dom';

interface TableToggleRowOpts extends ToggleGridRowOpts {}
interface TableToggleExpansionOpts extends BaseGridRowInteractionOpts {}
Expand Down
3 changes: 2 additions & 1 deletion packages/@react-aria/test-utils/src/tabs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
* governing permissions and limitations under the License.
*/

import {act, within} from '@testing-library/react';
import {act} from './act';
import {Direction, Orientation, TabsTesterOpts, UserOpts} from './types';
import {pressElement} from './events';
import {within} from '@testing-library/dom';

interface TriggerTabOptions {
/**
Expand Down
3 changes: 2 additions & 1 deletion packages/@react-aria/test-utils/src/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
* governing permissions and limitations under the License.
*/

import {act, within} from '@testing-library/react';
import {act} from './act';
import {BaseGridRowInteractionOpts, GridRowActionOpts, ToggleGridRowOpts, TreeTesterOpts, UserOpts} from './types';
import {getAltKey, getMetaKey, pressElement, triggerLongPress} from './events';
import {within} from '@testing-library/dom';

interface TreeToggleExpansionOpts extends BaseGridRowInteractionOpts {}
interface TreeToggleRowOpts extends ToggleGridRowOpts {}
Expand Down
1 change: 1 addition & 0 deletions packages/@react-spectrum/test-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"@swc/helpers": "^0.5.0"
},
"peerDependencies": {
"@testing-library/dom": "^10.1.0",
"@testing-library/react": "^16.0.0",
"@testing-library/user-event": "^14.0.0",
"jest": "^29.5.0",
Expand Down
2 changes: 2 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6190,6 +6190,7 @@ __metadata:
dependencies:
"@swc/helpers": "npm:^0.5.0"
peerDependencies:
"@testing-library/dom": ^10.1.0
"@testing-library/react": ^16.0.0
"@testing-library/user-event": ^14.0.0
react: ^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1
Expand Down Expand Up @@ -7809,6 +7810,7 @@ __metadata:
"@react-aria/test-utils": "npm:1.0.0-beta.2"
"@swc/helpers": "npm:^0.5.0"
peerDependencies:
"@testing-library/dom": ^10.1.0
"@testing-library/react": ^16.0.0
"@testing-library/user-event": ^14.0.0
jest: ^29.5.0
Expand Down
Loading