提交 9394e36f 编写于 作者: shutao-dc's avatar shutao-dc

补充动态修改list-item子元素内容测试例

上级 41b24e75
...@@ -28,5 +28,16 @@ describe('component-native-list-view', () => { ...@@ -28,5 +28,16 @@ describe('component-native-list-view', () => {
await page.waitFor(200) await page.waitFor(200)
const image = await program.screenshot(); const image = await program.screenshot();
expect(image).toMatchImageSnapshot(); expect(image).toMatchImageSnapshot();
})
//检测修改item子元素后,item是否正常调整高度
it('check_switch_item_content', async () => {
await page.callMethod('switchItemContent')
await page.waitFor(async () => {
return await page.data('displayArrow') === true;
});
await page.waitFor(600)
const image = await program.screenshot();
expect(image).toMatchImageSnapshot();
}) })
}) })
<template> <template>
<scroll-view direction="horizontal" style="flex-direction: row;"> <scroll-view direction="horizontal" style="flex-direction: row;">
<button class="button_item" @click="delayShow">测试延时显示</button> <button class="button_item" @click="delayShow">测试延时显示</button>
<button class="button_item" @click="switchItemContent">修改item子元素</button>
</scroll-view> </scroll-view>
<list-view v-show="list_show" id="listview" style="flex: 1;" show-scrollbar=false @scrolltolower="onScrollTolower"> <list-view v-show="list_show" id="listview" style="flex: 1;" show-scrollbar=false @scrolltolower="onScrollTolower">
<list-item v-for="index in item_count" class="item" @click="itemClick(index)"> <list-item v-for="index in item_count" class="item" @click="itemClick(index)">
<text >item-------<text>{{index}}</text></text> <text >item-------<text>{{index}}</text></text>
<text v-if="displayArrow" >item-------<text>{{index}}</text></text>
</list-item> </list-item>
</list-view> </list-view>
</template> </template>
...@@ -15,7 +17,8 @@ ...@@ -15,7 +17,8 @@
return { return {
item_count: 20, item_count: 20,
list_show: true, list_show: true,
listViewElement: null as UniListViewElement|null listViewElement: null as UniListViewElement|null,
displayArrow: false
} }
}, },
onReady() { onReady() {
...@@ -41,6 +44,9 @@ ...@@ -41,6 +44,9 @@
setTimeout(()=>{ setTimeout(()=>{
this.list_show = !this.list_show this.list_show = !this.list_show
}, 400) }, 400)
},
switchItemContent() {
this.displayArrow = !this.displayArrow
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册