提交 94d7ba9b 编写于 作者: H hdx

v-show: add screenshot test

上级 479473ee
......@@ -7,28 +7,30 @@ describe('v-show', () => {
await page.waitFor(500)
})
it('style::display', async () => {
const element = await page.$('.hello')
const element = await page.$('.v-show-content')
expect(await element.style('display')).toBe('flex')
const toggle = await page.$('.toggle')
const toggle = await page.$('.btn-toggle')
await toggle.tap()
expect(await element.style('display')).toBe('none')
await toggle.tap()
expect(await element.style('display')).toBe('flex')
})
it('screenshot', async () => {
const toggle = await page.$('.toggle')
const toggle = await page.$('.btn-toggle')
const element = await page.$('.hello')
await program.screenshot({
path: "static/v-show/screenshot-show1.png"
})
const image1 = await program.screenshot()
expect(image1).toMatchSnapshot()
await toggle.tap()
await page.waitFor(20)
const image2 = await program.screenshot()
expect(image2).toMatchSnapshot()
await toggle.tap()
await program.screenshot({
path: "static/v-show/screenshot-show2.png"
})
await page.waitFor(20)
const image3 = await program.screenshot()
expect(image3).toMatchSnapshot()
})
})
\ No newline at end of file
<template>
<view class="page">
<view class="split-title">button:click</view>
<button class="toggle" @click="onShowOrHide">show/hide</button>
<view class="hello" v-show="show">hello</view>
<button class="btn-show" @click="onClickShow">show</button>
<button class="btn-hide" @click="onClickHide">hide</button>
<button class="btn-toggle" @click="onClickShowOrHide">show/hide</button>
<view class="v-show-content" v-show="show">hello-v-show</view>
</view>
</template>
......@@ -14,7 +16,13 @@
}
},
methods: {
onShowOrHide() {
onClickShow() {
this.show = true
},
onClickHide() {
this.show = false
},
onClickShowOrHide() {
this.show = !this.show
}
}
......@@ -22,4 +30,4 @@
</script>
<style>
</style>
</style>
\ No newline at end of file
<template>
<view>
<slot :loading="loading" :error="errorMessage" />
<slot :loading="loading" :error="message" />
</view>
</template>
......@@ -15,8 +15,7 @@
data() {
return {
loading: false,
hasMore: false,
errorMessage: ''
message: ''
}
},
created() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册