mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-05 17:59:57 +08:00
2341a25d91
* more refactor * chore: motion support * chore: tmp test * test: Hooks * chore: static function * tmp of it * all of it * mv prefix * chore: clean up * chore: clean up * more test case * test: all base test * test: all test case * init * refactor: rm notification.open instance related code * follow up * refactor: singlton * test: notification test case * refactor to destroy * refactor: message base * test: part test case * test: more * test: more * test: all test * chore: clean up * docs: reorder * chore: fix lint * test: fix test case * chore: add act * chore: back * chore: fix style * test: notification test * test: more and more * test: fix more test * test: index * test: more & more * test: fix placement * test: fix coverage * chore: clean up * chore: bundle size * fix: 17 * chore: more * test: message * test: more test * fix: lint * test: rm class in static * chore: clean up * test: coverage * chore: fix lint
26 lines
578 B
TypeScript
26 lines
578 B
TypeScript
import { act, fireEvent } from '../../../tests/utils';
|
|
|
|
export async function awaitPromise() {
|
|
for (let i = 0; i < 10; i += 1) {
|
|
// eslint-disable-next-line no-await-in-loop
|
|
await Promise.resolve();
|
|
}
|
|
}
|
|
|
|
export async function triggerMotionEnd(selector: string = '.ant-message-move-up-leave') {
|
|
await awaitPromise();
|
|
|
|
// Flush css motion state update
|
|
for (let i = 0; i < 5; i += 1) {
|
|
act(() => {
|
|
jest.runAllTimers();
|
|
});
|
|
}
|
|
|
|
document.querySelectorAll(selector).forEach(ele => {
|
|
fireEvent.animationEnd(ele);
|
|
});
|
|
|
|
await awaitPromise();
|
|
}
|