mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-12 23:35:38 +08:00
c5bed69883
* feat: notification stack * feat: notification support stack * docs: add demo * fix: message animation * chore: better imports * test: fix pure panel * feat: code optimize * chore: update snapshot * chore: update test case * test: update test * chore: update deps * chore: bump rc-notification * feat: add backdrop filter * chore * feat: add token colorBgBlur * chore: bump * feat: update colorBgBlur in dark mode * fix: compatible with safari --------- Signed-off-by: MadCcc <1075746765@qq.com>
32 lines
807 B
TypeScript
32 lines
807 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(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) => {
|
|
// close > notice > notice-wrapper
|
|
fireEvent.animationEnd(ele.parentNode?.parentNode?.parentNode!);
|
|
});
|
|
|
|
await awaitPromise();
|
|
}
|