test(TransitionGroup): test for TransitionGroup (#1269)

This commit is contained in:
underfin
2020-06-26 04:38:22 +08:00
committed by GitHub
parent 7ae70ea44c
commit 299fda46a1
4 changed files with 555 additions and 28 deletions

View File

@@ -5,12 +5,21 @@ import { h, createApp, Transition } from 'vue'
describe('e2e: Transition', () => {
mockWarn()
const { page, html, classList, isVisible } = setupPuppeteer()
const {
page,
html,
classList,
isVisible,
timeout,
nextFrame
} = setupPuppeteer()
const baseUrl = `file://${path.resolve(__dirname, './transition.html')}`
const duration = 50
const buffer = 5
const transitionFinish = (time = duration) => timeout(time + buffer)
const classWhenTransitionStart = () =>
page().evaluate(() => {
(document.querySelector('#toggleBtn') as any)!.click()
@@ -19,21 +28,6 @@ describe('e2e: Transition', () => {
})
})
const transitionFinish = (time = duration) =>
new Promise(r => {
setTimeout(r, time + buffer)
})
const nextFrame = () => {
return page().evaluate(() => {
return new Promise(resolve => {
requestAnimationFrame(() => {
requestAnimationFrame(resolve)
})
})
})
}
beforeEach(async () => {
await page().goto(baseUrl)
await page().waitFor('#app')