mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 21:19:37 +08:00
test: Update page-header test case (#38286)
This commit is contained in:
parent
e939b43af4
commit
37fb68ab68
@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { act, fireEvent, render, sleep, triggerResize } from '../../../tests/utils';
|
import { fireEvent, render, waitFakeTimer, triggerResize } from '../../../tests/utils';
|
||||||
import PageHeader from '..';
|
import PageHeader from '..';
|
||||||
import mountTest from '../../../tests/shared/mountTest';
|
import mountTest from '../../../tests/shared/mountTest';
|
||||||
import rtlTest from '../../../tests/shared/rtlTest';
|
import rtlTest from '../../../tests/shared/rtlTest';
|
||||||
@ -121,10 +121,7 @@ describe('PageHeader', () => {
|
|||||||
jest.useFakeTimers();
|
jest.useFakeTimers();
|
||||||
const { container } = render(<PageHeader title="Page Title" extra="extra" />);
|
const { container } = render(<PageHeader title="Page Title" extra="extra" />);
|
||||||
triggerResize(container.firstChild as HTMLDivElement);
|
triggerResize(container.firstChild as HTMLDivElement);
|
||||||
await act(async () => {
|
await waitFakeTimer();
|
||||||
await jest.runAllTimers();
|
|
||||||
await sleep();
|
|
||||||
});
|
|
||||||
expect(container.querySelector('div.ant-page-header')).toHaveClass('ant-page-header-compact');
|
expect(container.querySelector('div.ant-page-header')).toHaveClass('ant-page-header-compact');
|
||||||
jest.useRealTimers();
|
jest.useRealTimers();
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user