Skip to content
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

Decrease timeouts in test utils #7102

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
19 changes: 5 additions & 14 deletions packages/@react-aria/test-utils/src/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,6 @@ export class TableTester {
await pressElement(this.user, cell, interactionType);
}
}

// Handle cases where the table may transition in response to the row selection/deselection
await act(async () => {
if (this._advanceTimer == null) {
throw new Error('No advanceTimers provided for table transition.');
}

await this._advanceTimer(200);
});
};

toggleSort = async (opts: {index?: number, text?: string, interactionType?: UserOpts['interactionType']} = {}) => {
Expand Down Expand Up @@ -145,12 +136,12 @@ export class TableTester {
}

// Handle cases where the table may transition in response to the row selection/deselection
await act(async () => {
if (this._advanceTimer == null) {
throw new Error('No advanceTimers provided for table transition.');
}
if (!this._advanceTimer) {
throw new Error('No advanceTimers provided for table transition.');
}

await this._advanceTimer(200);
await act(async () => {
await this._advanceTimer?.(200);
});

await waitFor(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/@react-spectrum/table/test/TestTableUtils.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {theme} from '@react-spectrum/theme-default';
import {User} from '@react-aria/test-utils';

let manyItems = [];
for (let i = 1; i <= 100; i++) {
for (let i = 1; i <= 10; i++) {
manyItems.push({id: i, foo: 'Foo ' + i, bar: 'Bar ' + i, baz: 'Baz ' + i});
}

Expand Down