test: Update Dropdown test case (#38144)

This commit is contained in:
hms181231 2022-10-21 15:07:44 +08:00 committed by GitHub
parent be1a51e5fc
commit 30d2a24898
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,7 @@ import Dropdown from '..';
import type { DropDownProps } from '..';
import mountTest from '../../../tests/shared/mountTest';
import rtlTest from '../../../tests/shared/rtlTest';
import { act, fireEvent, render, sleep } from '../../../tests/utils';
import { act, fireEvent, render, waitFakeTimer } from '../../../tests/utils';
import Menu from '../../menu';
let triggerProps: TriggerProps;
@ -55,6 +55,7 @@ describe('Dropdown', () => {
});
it('support Menu expandIcon', async () => {
jest.useFakeTimers();
const props: DropDownProps = {
overlay: (
<Menu expandIcon={<span id="customExpandIcon" />}>
@ -73,8 +74,9 @@ describe('Dropdown', () => {
<button type="button">button</button>
</Dropdown>,
);
await sleep(500);
await waitFakeTimer();
expect(container.querySelectorAll('#customExpandIcon').length).toBe(1);
jest.useRealTimers();
});
it('should warn if use topCenter or bottomCenter', () => {