提交 0aded7cd 编写于 作者: shutao-dc's avatar shutao-dc

update scroll-view.test.js 新增scrollevent测试例例

上级 c2f2e1b1
......@@ -78,4 +78,12 @@ describe('component-native-scroll-view', () => {
expect(endDetail.scrollWidth).toBeGreaterThan(0)
})
}
it('通过UniElement.scrollBy检测scroll事件是否触发',async()=>{
await page.callMethod('setVerticalScrollBy', 120)
// await page.waitFor(600)
const scrollDetail = await page.data('scrollDetailTest')
console.log('setVerticalScrollBy scrollDetail:', scrollDetail)
expect(scrollDetail.scrollTop).toBe(120)
})
});
......@@ -11,7 +11,7 @@
</view>
<view>
<scroll-view :scroll-top="scrollTop" direction="vertical" class="scroll-Y" scroll-with-animation="true"
@scrolltoupper="upper" @scrolltolower="lower" @scroll="scroll" @scrollend="end" :show-scrollbar="showScrollbar">
@scrolltoupper="upper" @scrolltolower="lower" @scroll="scroll" @scrollend="end" :show-scrollbar="showScrollbar" id="verticalScrollView">
<view class="scroll-view-item uni-bg-red"><text class="text">A</text></view>
<view class="scroll-view-item uni-bg-green"><text class="text">B</text></view>
<view class="scroll-view-item uni-bg-blue"><text class="text">C</text></view>
......@@ -150,6 +150,13 @@
break;
}
},
// 自动化测试专用
setVerticalScrollBy(y: number) {
const element = uni.getElementById("verticalScrollView")
if(element != null) {
element.scrollBy(0, y)
}
}
},
}
</script>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册