element-plus/packages/test-utils/tick.ts

20 lines
380 B
TypeScript
Raw Normal View History

2020-09-10 19:07:24 +08:00
import { nextTick } from 'vue'
const tick = async (times: number) => {
while (times--) {
await nextTick()
}
}
export default tick
// in order to test transitions, we need to use
// await rAF() after firing transition events.
export const rAF = async () => {
return new Promise(res => {
requestAnimationFrame(() => {
requestAnimationFrame(res)
})
})
}