You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
756 B
30 lines
756 B
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(runAllTimers: boolean = true) {
|
|
await awaitPromise();
|
|
|
|
if (runAllTimers) {
|
|
// Flush css motion state update
|
|
for (let i = 0; i < 5; i += 1) {
|
|
act(() => {
|
|
jest.runAllTimers();
|
|
});
|
|
}
|
|
}
|
|
|
|
// document.querySelectorAll('.ant-notification-fade-leave').forEach(ele => {
|
|
// fireEvent.animationEnd(ele);
|
|
// });
|
|
document.querySelectorAll('[role="alert"]').forEach((ele) => {
|
|
fireEvent.animationEnd(ele.parentNode?.parentNode!);
|
|
});
|
|
|
|
await awaitPromise();
|
|
}
|
|
|