2020-09-29 19:33:37 +08:00
|
|
|
import CSSMotion from 'rc-motion';
|
|
|
|
import { genCSSMotion } from 'rc-motion/lib/CSSMotion';
|
2022-07-23 16:04:23 +08:00
|
|
|
import KeyCode from 'rc-util/lib/KeyCode';
|
2022-06-22 14:57:09 +08:00
|
|
|
import React from 'react';
|
2022-12-26 15:48:50 +08:00
|
|
|
import { act } from 'react-dom/test-utils';
|
2023-06-07 21:59:21 +08:00
|
|
|
|
2020-02-03 13:00:35 +08:00
|
|
|
import Modal from '..';
|
2023-07-26 18:56:27 +08:00
|
|
|
import zhCN from '../../locale/zh_CN';
|
2022-10-31 10:15:52 +08:00
|
|
|
import { fireEvent, render, waitFakeTimer } from '../../../tests/utils';
|
2020-02-03 13:00:35 +08:00
|
|
|
import Button from '../../button';
|
2021-08-23 19:59:04 +08:00
|
|
|
import ConfigProvider from '../../config-provider';
|
2022-06-22 14:57:09 +08:00
|
|
|
import Input from '../../input';
|
2022-05-31 10:29:13 +08:00
|
|
|
import type { ModalFunc } from '../confirm';
|
2020-02-03 13:00:35 +08:00
|
|
|
|
2023-06-07 21:59:21 +08:00
|
|
|
jest.mock('rc-util/lib/Portal');
|
|
|
|
jest.mock('rc-motion');
|
2020-02-03 13:00:35 +08:00
|
|
|
|
|
|
|
describe('Modal.hook', () => {
|
2020-09-29 19:33:37 +08:00
|
|
|
// Inject CSSMotion to replace with No transition support
|
|
|
|
const MockCSSMotion = genCSSMotion(false);
|
2022-11-19 13:47:33 +08:00
|
|
|
Object.keys(MockCSSMotion).forEach((key) => {
|
2022-05-31 10:29:13 +08:00
|
|
|
// @ts-ignore
|
2020-09-29 19:33:37 +08:00
|
|
|
CSSMotion[key] = MockCSSMotion[key];
|
|
|
|
});
|
|
|
|
|
2020-02-03 13:00:35 +08:00
|
|
|
it('hooks support context', () => {
|
2023-06-07 21:59:21 +08:00
|
|
|
jest.useFakeTimers();
|
2020-02-03 13:00:35 +08:00
|
|
|
const Context = React.createContext('light');
|
2022-05-31 10:29:13 +08:00
|
|
|
let instance: ReturnType<ModalFunc>;
|
2020-02-03 13:00:35 +08:00
|
|
|
|
|
|
|
const Demo = () => {
|
|
|
|
const [modal, contextHolder] = Modal.useModal();
|
|
|
|
return (
|
|
|
|
<Context.Provider value="bamboo">
|
|
|
|
<Button
|
|
|
|
onClick={() => {
|
|
|
|
instance = modal.confirm({
|
|
|
|
content: (
|
|
|
|
<Context.Consumer>
|
2022-11-19 13:47:33 +08:00
|
|
|
{(name) => <div className="test-hook">{name}</div>}
|
2020-02-03 13:00:35 +08:00
|
|
|
</Context.Consumer>
|
|
|
|
),
|
|
|
|
});
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
{contextHolder}
|
|
|
|
</Context.Provider>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2022-05-31 10:29:13 +08:00
|
|
|
const { container } = render(<Demo />);
|
|
|
|
fireEvent.click(container.querySelectorAll('button')[0]);
|
2020-02-03 13:00:35 +08:00
|
|
|
|
2022-05-31 10:29:13 +08:00
|
|
|
expect(document.body.querySelectorAll('.test-hook')[0].textContent).toBe('bamboo');
|
|
|
|
expect(document.body.querySelectorAll('.ant-btn').length).toBeTruthy();
|
|
|
|
expect(document.body.querySelectorAll('.ant-modal-body').length).toBeTruthy();
|
2020-02-03 13:00:35 +08:00
|
|
|
|
|
|
|
// Update instance
|
2021-03-02 18:52:47 +08:00
|
|
|
act(() => {
|
|
|
|
instance.update({
|
|
|
|
content: <div className="updated-content" />,
|
|
|
|
});
|
2020-02-03 13:00:35 +08:00
|
|
|
});
|
2022-05-31 10:29:13 +08:00
|
|
|
expect(document.body.querySelectorAll('.updated-content')).toHaveLength(1);
|
2020-02-03 13:00:35 +08:00
|
|
|
|
|
|
|
// Destroy
|
2021-03-02 18:52:47 +08:00
|
|
|
act(() => {
|
|
|
|
instance.destroy();
|
2023-06-07 21:59:21 +08:00
|
|
|
jest.runAllTimers();
|
2021-03-02 18:52:47 +08:00
|
|
|
});
|
2022-05-31 10:29:13 +08:00
|
|
|
expect(document.body.querySelectorAll('Modal')).toHaveLength(0);
|
2020-02-03 13:00:35 +08:00
|
|
|
|
2023-06-07 21:59:21 +08:00
|
|
|
jest.useRealTimers();
|
2020-02-03 13:00:35 +08:00
|
|
|
});
|
2020-11-30 15:25:36 +08:00
|
|
|
|
2023-01-17 14:54:34 +08:00
|
|
|
it('destroyAll works with contextHolder', () => {
|
|
|
|
const modalTypes = ['info', 'success', 'warning', 'error'] as const;
|
|
|
|
|
|
|
|
const Demo = () => {
|
|
|
|
const [modal, contextHolder] = Modal.useModal();
|
|
|
|
|
|
|
|
function showConfirm() {
|
|
|
|
modalTypes.forEach((type) => {
|
|
|
|
modal[type]({
|
|
|
|
title: 'title',
|
|
|
|
content: 'content',
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="App">
|
|
|
|
{contextHolder}
|
|
|
|
<div className="open-hook-modal-btn" onClick={showConfirm}>
|
|
|
|
confirm
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
const { container } = render(<Demo />);
|
|
|
|
fireEvent.click(container.querySelectorAll('.open-hook-modal-btn')[0]);
|
|
|
|
|
|
|
|
expect(document.body.querySelectorAll('.ant-modal')).toHaveLength(modalTypes.length);
|
|
|
|
|
|
|
|
// Update instance
|
|
|
|
act(() => {
|
|
|
|
Modal.destroyAll();
|
|
|
|
});
|
|
|
|
expect(document.body.querySelectorAll('.ant-modal')).toHaveLength(0);
|
|
|
|
});
|
|
|
|
|
2021-08-23 19:59:04 +08:00
|
|
|
it('context support config direction', () => {
|
2023-06-07 21:59:21 +08:00
|
|
|
jest.useFakeTimers();
|
2021-08-23 19:59:04 +08:00
|
|
|
const Demo = () => {
|
|
|
|
const [modal, contextHolder] = Modal.useModal();
|
|
|
|
return (
|
|
|
|
<>
|
|
|
|
<Button
|
|
|
|
onClick={() => {
|
|
|
|
modal.confirm({
|
|
|
|
content: <Input />,
|
|
|
|
});
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
{contextHolder}
|
|
|
|
</>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2022-05-31 10:29:13 +08:00
|
|
|
const { container } = render(
|
2021-08-23 19:59:04 +08:00
|
|
|
<ConfigProvider direction="rtl">
|
|
|
|
<Demo />
|
|
|
|
</ConfigProvider>,
|
|
|
|
);
|
|
|
|
|
2022-05-31 10:29:13 +08:00
|
|
|
fireEvent.click(container.querySelectorAll('button')[0]);
|
|
|
|
expect(document.body.querySelectorAll('.ant-input-rtl').length).toBeTruthy();
|
2021-08-23 19:59:04 +08:00
|
|
|
});
|
|
|
|
|
2020-11-30 15:25:36 +08:00
|
|
|
it('hooks modal should trigger onCancel', () => {
|
|
|
|
let cancelCount = 0;
|
|
|
|
const Demo = () => {
|
|
|
|
const [modal, contextHolder] = Modal.useModal();
|
|
|
|
|
|
|
|
const openBrokenModal = React.useCallback(() => {
|
|
|
|
modal.info({
|
|
|
|
okType: 'default',
|
|
|
|
maskClosable: true,
|
|
|
|
okCancel: true,
|
|
|
|
onCancel: () => {
|
|
|
|
cancelCount += 1;
|
|
|
|
},
|
|
|
|
content: 'Hello!',
|
|
|
|
});
|
|
|
|
}, [modal]);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="App">
|
|
|
|
{contextHolder}
|
|
|
|
<div className="open-hook-modal-btn" onClick={openBrokenModal}>
|
|
|
|
Test hook modal
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2022-05-31 10:29:13 +08:00
|
|
|
const { container } = render(<Demo />);
|
2020-11-30 15:25:36 +08:00
|
|
|
|
2022-05-31 10:29:13 +08:00
|
|
|
fireEvent.click(container.querySelectorAll('.open-hook-modal-btn')[0]);
|
|
|
|
fireEvent.click(document.body.querySelectorAll('.ant-modal-confirm-btns .ant-btn')[0]);
|
2020-11-30 15:25:36 +08:00
|
|
|
expect(cancelCount).toEqual(1); // click cancel btn, trigger onCancel
|
|
|
|
|
2022-05-31 10:29:13 +08:00
|
|
|
fireEvent.click(container.querySelectorAll('.open-hook-modal-btn')[0]);
|
|
|
|
fireEvent.click(document.body.querySelectorAll('.ant-modal-wrap')[0]);
|
2020-11-30 15:25:36 +08:00
|
|
|
expect(cancelCount).toEqual(2); // click modal wrapper, trigger onCancel
|
|
|
|
});
|
2021-03-02 18:52:47 +08:00
|
|
|
|
|
|
|
it('update before render', () => {
|
|
|
|
const Demo = () => {
|
|
|
|
const [modal, contextHolder] = Modal.useModal();
|
|
|
|
|
|
|
|
const openBrokenModal = React.useCallback(() => {
|
|
|
|
const instance = modal.info({
|
|
|
|
title: 'Light',
|
|
|
|
});
|
|
|
|
|
|
|
|
instance.update({
|
|
|
|
title: 'Bamboo',
|
|
|
|
});
|
|
|
|
}, [modal]);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="App">
|
|
|
|
{contextHolder}
|
|
|
|
<div className="open-hook-modal-btn" onClick={openBrokenModal}>
|
|
|
|
Test hook modal
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2022-05-31 10:29:13 +08:00
|
|
|
const { container } = render(<Demo />);
|
|
|
|
fireEvent.click(container.querySelectorAll('.open-hook-modal-btn')[0]);
|
|
|
|
expect(document.body.querySelectorAll('.ant-modal-confirm-title')[0].textContent).toEqual(
|
|
|
|
'Bamboo',
|
|
|
|
);
|
2021-03-02 18:52:47 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
it('destroy before render', () => {
|
|
|
|
const Demo = () => {
|
|
|
|
const [modal, contextHolder] = Modal.useModal();
|
|
|
|
|
|
|
|
const openBrokenModal = React.useCallback(() => {
|
|
|
|
const instance = modal.info({
|
|
|
|
title: 'Light',
|
|
|
|
});
|
|
|
|
|
|
|
|
instance.destroy();
|
|
|
|
}, [modal]);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="App">
|
|
|
|
{contextHolder}
|
|
|
|
<div className="open-hook-modal-btn" onClick={openBrokenModal}>
|
|
|
|
Test hook modal
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2022-05-31 10:29:13 +08:00
|
|
|
const { container } = render(<Demo />);
|
|
|
|
fireEvent.click(container.querySelectorAll('.open-hook-modal-btn')[0]);
|
|
|
|
expect(document.body.classList.contains('ant-modal-confirm-title')).toBeFalsy();
|
2021-03-02 18:52:47 +08:00
|
|
|
});
|
2022-07-23 16:04:23 +08:00
|
|
|
|
|
|
|
it('the callback close should be a method when onCancel has a close parameter', async () => {
|
2023-06-07 21:59:21 +08:00
|
|
|
jest.useFakeTimers();
|
2022-07-23 16:04:23 +08:00
|
|
|
|
2023-06-07 21:59:21 +08:00
|
|
|
const mockFn = jest.fn();
|
2022-10-31 10:15:52 +08:00
|
|
|
|
2022-07-23 16:04:23 +08:00
|
|
|
const Demo = () => {
|
|
|
|
const [modal, contextHolder] = Modal.useModal();
|
|
|
|
|
|
|
|
const openBrokenModal = React.useCallback(() => {
|
|
|
|
modal.confirm({
|
|
|
|
closable: true,
|
|
|
|
keyboard: true,
|
|
|
|
maskClosable: true,
|
2022-11-19 13:47:33 +08:00
|
|
|
onCancel: (close) => mockFn(close),
|
2022-07-23 16:04:23 +08:00
|
|
|
});
|
|
|
|
}, [modal]);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="App">
|
|
|
|
{contextHolder}
|
|
|
|
<div className="open-hook-modal-btn" onClick={openBrokenModal}>
|
|
|
|
Test hook modal
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
const { container } = render(<Demo />);
|
|
|
|
|
2022-12-26 15:48:50 +08:00
|
|
|
await waitFakeTimer();
|
2022-07-23 16:04:23 +08:00
|
|
|
|
|
|
|
expect(document.body.querySelectorAll('.ant-modal-confirm-confirm')).toHaveLength(0);
|
|
|
|
// First open
|
|
|
|
fireEvent.click(container.querySelectorAll('.open-hook-modal-btn')[0]);
|
2022-12-26 15:48:50 +08:00
|
|
|
await waitFakeTimer();
|
2022-07-23 16:04:23 +08:00
|
|
|
|
|
|
|
expect(document.body.querySelectorAll('.ant-modal-confirm-confirm')).toHaveLength(1);
|
|
|
|
// Click mask to close
|
|
|
|
fireEvent.click(document.body.querySelectorAll('.ant-modal-wrap')[0]);
|
|
|
|
|
2022-12-26 15:48:50 +08:00
|
|
|
await waitFakeTimer();
|
2022-07-23 16:04:23 +08:00
|
|
|
|
|
|
|
expect(document.body.querySelectorAll('.ant-modal-confirm-confirm')).toHaveLength(0);
|
|
|
|
// Second open
|
|
|
|
fireEvent.click(container.querySelectorAll('.open-hook-modal-btn')[0]);
|
|
|
|
|
2022-12-26 15:48:50 +08:00
|
|
|
await waitFakeTimer();
|
2022-07-23 16:04:23 +08:00
|
|
|
|
|
|
|
expect(document.body.querySelectorAll('.ant-modal-confirm-confirm')).toHaveLength(1);
|
|
|
|
// Press ESC to turn off
|
2022-12-26 15:48:50 +08:00
|
|
|
fireEvent.keyDown(document.body.querySelectorAll('.ant-modal')[0], {
|
2022-07-23 16:04:23 +08:00
|
|
|
keyCode: KeyCode.ESC,
|
|
|
|
});
|
|
|
|
|
2022-12-26 15:48:50 +08:00
|
|
|
await waitFakeTimer();
|
2022-07-23 16:04:23 +08:00
|
|
|
|
|
|
|
expect(document.body.querySelectorAll('.ant-modal-confirm-confirm')).toHaveLength(0);
|
|
|
|
// Third open
|
|
|
|
fireEvent.click(container.querySelectorAll('.open-hook-modal-btn')[0]);
|
|
|
|
|
2022-12-26 15:48:50 +08:00
|
|
|
await waitFakeTimer();
|
2022-07-23 16:04:23 +08:00
|
|
|
|
|
|
|
expect(document.body.querySelectorAll('.ant-modal-confirm-confirm')).toHaveLength(1);
|
|
|
|
// Click the close icon to close
|
|
|
|
fireEvent.click(document.body.querySelectorAll('.ant-modal-close')[0]);
|
|
|
|
|
2022-12-26 15:48:50 +08:00
|
|
|
await waitFakeTimer();
|
2022-07-23 16:04:23 +08:00
|
|
|
|
|
|
|
expect(document.body.querySelectorAll('.ant-modal-confirm-confirm')).toHaveLength(0);
|
|
|
|
// Last open
|
|
|
|
fireEvent.click(container.querySelectorAll('.open-hook-modal-btn')[0]);
|
|
|
|
|
2022-12-26 15:48:50 +08:00
|
|
|
await waitFakeTimer();
|
2022-07-23 16:04:23 +08:00
|
|
|
|
|
|
|
expect(document.body.querySelectorAll('.ant-modal-confirm-confirm')).toHaveLength(1);
|
|
|
|
|
|
|
|
// Click the Cancel button to close (invalid)
|
|
|
|
fireEvent.click(document.body.querySelectorAll('.ant-modal-confirm-btns > .ant-btn')[0]);
|
|
|
|
|
2022-12-26 15:48:50 +08:00
|
|
|
await waitFakeTimer();
|
2022-07-23 16:04:23 +08:00
|
|
|
|
|
|
|
expect(document.body.querySelectorAll('.ant-modal-confirm-confirm')).toHaveLength(1);
|
|
|
|
|
2022-11-19 13:47:33 +08:00
|
|
|
mockFn.mockImplementation((close) => close());
|
2022-07-23 16:04:23 +08:00
|
|
|
|
|
|
|
// Click the Cancel button to close (valid)
|
|
|
|
fireEvent.click(document.body.querySelectorAll('.ant-modal-confirm-btns > .ant-btn')[0]);
|
|
|
|
|
2022-12-26 15:48:50 +08:00
|
|
|
await waitFakeTimer();
|
2022-07-23 16:04:23 +08:00
|
|
|
|
|
|
|
expect(document.body.querySelectorAll('.ant-modal-confirm-confirm')).toHaveLength(0);
|
|
|
|
|
|
|
|
// Close called 5 times
|
|
|
|
expect(mockFn).toHaveBeenCalledTimes(5);
|
|
|
|
|
|
|
|
expect(mockFn.mock.calls).toEqual(Array.from({ length: 5 }, () => [expect.any(Function)]));
|
|
|
|
|
2023-06-07 21:59:21 +08:00
|
|
|
jest.useRealTimers();
|
2022-07-23 16:04:23 +08:00
|
|
|
});
|
2022-12-13 13:57:17 +08:00
|
|
|
|
|
|
|
it('not block origin ConfigProvider config', () => {
|
|
|
|
const Demo = () => {
|
|
|
|
const [modal, contextHolder] = Modal.useModal();
|
|
|
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
modal.confirm({
|
|
|
|
content: <Button className="bamboo">好的</Button>,
|
|
|
|
});
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
return <ConfigProvider autoInsertSpaceInButton={false}>{contextHolder}</ConfigProvider>;
|
|
|
|
};
|
|
|
|
|
|
|
|
render(<Demo />);
|
|
|
|
|
|
|
|
expect(document.body.querySelector('.bamboo')?.textContent).toEqual('好的');
|
|
|
|
});
|
2023-03-24 17:23:39 +08:00
|
|
|
|
2023-06-07 21:59:21 +08:00
|
|
|
it('it should call forwarded afterClose', () => {
|
|
|
|
const afterClose = jest.fn();
|
2023-03-24 17:23:39 +08:00
|
|
|
const Demo = () => {
|
|
|
|
const [modal, contextHolder] = Modal.useModal();
|
|
|
|
React.useEffect(() => {
|
|
|
|
modal.confirm({ title: 'Confirm', afterClose });
|
|
|
|
}, []);
|
|
|
|
return contextHolder;
|
|
|
|
};
|
|
|
|
|
|
|
|
render(<Demo />);
|
|
|
|
const btns = document.body.querySelectorAll('.ant-btn');
|
|
|
|
fireEvent.click(btns[btns.length - 1]);
|
|
|
|
|
|
|
|
expect(afterClose).toHaveBeenCalledTimes(1);
|
|
|
|
});
|
2023-07-26 18:56:27 +08:00
|
|
|
|
|
|
|
it('should be applied correctly locale', async () => {
|
|
|
|
jest.useFakeTimers();
|
|
|
|
|
2023-07-29 16:16:14 +08:00
|
|
|
const Demo: React.FC<{ count: number }> = ({ count }) => {
|
2023-07-26 18:56:27 +08:00
|
|
|
React.useEffect(() => {
|
|
|
|
const instance = Modal.confirm({});
|
|
|
|
return () => {
|
|
|
|
instance.destroy();
|
|
|
|
};
|
|
|
|
}, [count]);
|
|
|
|
|
|
|
|
let node = null;
|
|
|
|
|
|
|
|
for (let i = 0; i < count; i += 1) {
|
|
|
|
node = <ConfigProvider locale={zhCN}>{node}</ConfigProvider>;
|
|
|
|
}
|
|
|
|
|
|
|
|
return node;
|
|
|
|
};
|
|
|
|
|
|
|
|
const { rerender } = render(<div />);
|
|
|
|
|
|
|
|
for (let i = 10; i > 0; i -= 1) {
|
|
|
|
rerender(<Demo count={i} />);
|
|
|
|
// eslint-disable-next-line no-await-in-loop
|
|
|
|
await waitFakeTimer();
|
|
|
|
|
|
|
|
expect(document.body.querySelector('.ant-btn-primary')!.textContent).toEqual('确 定');
|
|
|
|
fireEvent.click(document.body.querySelector('.ant-btn-primary')!);
|
|
|
|
|
|
|
|
// eslint-disable-next-line no-await-in-loop
|
|
|
|
await waitFakeTimer();
|
|
|
|
}
|
|
|
|
|
|
|
|
rerender(<Demo count={0} />);
|
|
|
|
await waitFakeTimer();
|
|
|
|
expect(document.body.querySelector('.ant-btn-primary')!.textContent).toEqual('OK');
|
|
|
|
|
|
|
|
jest.useRealTimers();
|
|
|
|
});
|
2023-07-29 16:16:14 +08:00
|
|
|
|
|
|
|
it('support await', async () => {
|
|
|
|
jest.useFakeTimers();
|
|
|
|
|
|
|
|
let notReady = true;
|
|
|
|
let lastResult: boolean | null = null;
|
|
|
|
|
|
|
|
const Demo: React.FC = () => {
|
|
|
|
const [modal, contextHolder] = Modal.useModal();
|
|
|
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
(async () => {
|
|
|
|
lastResult = await modal.confirm({
|
|
|
|
content: <Input />,
|
|
|
|
onOk: async () => {
|
|
|
|
if (notReady) {
|
|
|
|
notReady = false;
|
|
|
|
return Promise.reject();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
});
|
|
|
|
})();
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
return contextHolder;
|
|
|
|
};
|
|
|
|
|
|
|
|
render(<Demo />); // Wait for modal show
|
|
|
|
|
|
|
|
await waitFakeTimer(); // First time click should not close
|
|
|
|
|
|
|
|
fireEvent.click(document.querySelector('.ant-btn-primary')!);
|
|
|
|
await waitFakeTimer();
|
|
|
|
expect(lastResult).toBeFalsy(); // Second time click to close
|
|
|
|
|
|
|
|
fireEvent.click(document.querySelector('.ant-btn-primary')!);
|
|
|
|
await waitFakeTimer();
|
|
|
|
expect(lastResult).toBeTruthy();
|
|
|
|
|
|
|
|
jest.useRealTimers();
|
|
|
|
});
|
2020-02-03 13:00:35 +08:00
|
|
|
});
|