Skip to content

Commit

Permalink
move to modern timers
Browse files Browse the repository at this point in the history
  • Loading branch information
snowystinger committed May 17, 2022
1 parent 7215206 commit d75f1ad
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions packages/@react-spectrum/actionbar/test/ActionBar.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ describe('ActionBar', () => {
beforeAll(() => {
jest.spyOn(window.HTMLElement.prototype, 'clientWidth', 'get').mockImplementation(() => 1000);
jest.spyOn(window.HTMLElement.prototype, 'clientHeight', 'get').mockImplementation(() => 500);
jest.spyOn(window, 'requestAnimationFrame').mockImplementation(cb => setTimeout(cb, 0));
jest.useFakeTimers('legacy');
jest.useFakeTimers();
});

afterEach(() => {
Expand Down
5 changes: 2 additions & 3 deletions packages/@react-stately/data/test/useAsyncList.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function getItemsEnd() {

describe('useAsyncList', () => {
beforeAll(() => {
jest.useFakeTimers('legacy');
jest.useFakeTimers();
});

it('should call load function on init', async () => {
Expand Down Expand Up @@ -195,8 +195,7 @@ describe('useAsyncList', () => {

expect(result.current.loadingState).toBe('loading');

await act(async () => {
});
await act(async () => Promise.resolve());

expect(result.current.loadingState).toBe('error');
expect(loadSpyThatThrows).toHaveBeenCalled();
Expand Down

0 comments on commit d75f1ad

Please sign in to comment.