提交 1a8ee3b2 编写于 作者: shutao-dc's avatar shutao-dc

update sticky-section.test.js 修改waitFor条件 增加截图准确性

上级 f40c5207
......@@ -17,8 +17,14 @@ describe('component-native-sticky-section', () => {
//滚动回顶部
await page.callMethod('toTop')
page.waitFor(100)
await page.setData({
scrolling: 'true'
})
//跳转到id为C的StickyHeader位置
await page.callMethod('gotoStickyHeader', 'C')
await page.waitFor(async () => {
return await page.data('scrolling') === false;
});
const image = await program.screenshot();
expect(image).toMatchImageSnapshot();
})
......
<template>
<list-view id="list-view" ref="list-view" show-scrollbar=false class="page" :scroll-into-view="scrollIntoView"
@scroll="onScroll" rebound="false">
@scroll="onScroll" @scrollend="onScrollEnd" rebound="false">
<list-item style="padding: 10px; margin: 5px 0;align-items: center;" type = 20>
<button @click="gotoStickyHeader('C')" size="mini">跳转到id为C的sticky-header位置上</button>
</list-item>
......@@ -25,7 +25,8 @@
return {
data: ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N'],
sectionPadding: [0, 10, 0, 10] as Array<number>,
scrollIntoView: ""
scrollIntoView: "",
scrolling: false
}
},
methods: {
......@@ -42,6 +43,10 @@
this.scrollIntoView = id
},
onScroll() {
this.scrolling = true
},
onScrollEnd() {
this.scrolling = false
//滚动后重置scrollIntoView = ""
if(this.scrollIntoView != "") {
this.scrollIntoView = ""
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册