ant-design/tests/utils.ts
偏右 c979850a5b
test: Motion for Collpase and Menu (#26828)
* test:  test menu and collapse motion

* chore: move openAnimation into collapse

* add test case

* rm extra openAnimation.tsx

* remove unused code
2020-09-20 21:13:43 +08:00

19 lines
426 B
TypeScript

import MockDate from 'mockdate';
import { act } from 'react-dom/test-utils';
export function setMockDate(dateString = '2017-09-18T03:30:07.795') {
MockDate.set(dateString);
}
export function resetMockDate() {
MockDate.reset();
}
const globalTimeout = global.setTimeout;
export const sleep = async (timeout = 0) => {
await act(async () => {
await new Promise(resolve => globalTimeout(resolve, timeout));
});
};