mirror of
https://github.com/ant-design/ant-design.git
synced 2025-07-31 12:18:42 +08:00
test: Update local-provider test case (#38287)
This commit is contained in:
parent
aeb266d5da
commit
e939b43af4
@ -1,7 +1,6 @@
|
|||||||
import React, { useEffect } from 'react';
|
import React, { useEffect } from 'react';
|
||||||
import { act } from 'react-dom/test-utils';
|
|
||||||
import { Modal } from '../..';
|
import { Modal } from '../..';
|
||||||
import { sleep, render, fireEvent } from '../../../tests/utils';
|
import { waitFakeTimer, render, fireEvent } from '../../../tests/utils';
|
||||||
import ConfigProvider from '../../config-provider';
|
import ConfigProvider from '../../config-provider';
|
||||||
import zhCN from '../zh_CN';
|
import zhCN from '../zh_CN';
|
||||||
|
|
||||||
@ -46,16 +45,10 @@ describe('Locale Provider demo', () => {
|
|||||||
const { container } = render(<BasicExample />);
|
const { container } = render(<BasicExample />);
|
||||||
|
|
||||||
fireEvent.click(container.querySelector('.about')!);
|
fireEvent.click(container.querySelector('.about')!);
|
||||||
await act(async () => {
|
await waitFakeTimer();
|
||||||
jest.runAllTimers();
|
|
||||||
await sleep();
|
|
||||||
});
|
|
||||||
|
|
||||||
fireEvent.click(container.querySelector('.dashboard')!);
|
fireEvent.click(container.querySelector('.dashboard')!);
|
||||||
await act(async () => {
|
await waitFakeTimer();
|
||||||
jest.runAllTimers();
|
|
||||||
await sleep();
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(document.body.querySelectorAll('.ant-btn-primary span')[0]?.textContent).toBe('确 定');
|
expect(document.body.querySelectorAll('.ant-btn-primary span')[0]?.textContent).toBe('确 定');
|
||||||
Modal.destroyAll();
|
Modal.destroyAll();
|
||||||
|
Loading…
Reference in New Issue
Block a user