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

add scroll-view-refresher.test.js

上级 2b203fd5
......@@ -36,6 +36,16 @@ describe('component-native-list-view', () => {
expect(scrollTop-690).toBeGreaterThanOrEqual(0)
})
//检测下拉刷新
it('check_refresher', async () => {
await page.setData({
refresher_enabled_boolean: true,
refresher_triggered_boolean: true
})
await page.waitFor(2000)
expect(await page.data('refresherrefresh')).toBe(true)
})
//检测横向可滚动区域
it('check_scroll_width', async () => {
await page.callMethod('change_scroll_y_boolean', false)
......
......@@ -17,7 +17,8 @@
refresher_background_input: "#FFF",
scrollData: [] as Array<string>,
size_enum: [{ "value": 0, "name": "item---0" }, { "value": 3, "name": "item---3" }] as ItemType[],
scrollIntoView: ""
scrollIntoView: "",
refresherrefresh: false
}
},
onLoad() {
......@@ -38,12 +39,16 @@
list_view_refresherpulling() { console.log("自定义下拉刷新控件被下拉") },
list_view_refresherrefresh() {
console.log("自定义下拉刷新被触发 ")
this.refresherrefresh = true
this.refresher_triggered_boolean = true
setTimeout(function(){
this.refresher_triggered_boolean = false
}, 1500)
},
list_view_refresherrestore() { console.log("自定义下拉刷新被复位") },
list_view_refresherrestore() {
this.refresherrefresh = false
console.log("自定义下拉刷新被复位")
},
list_view_refresherabort() { console.log("自定义下拉刷新被中止") },
list_view_scrolltoupper(e:ScrollToUpperEvent) { console.log("滚动到顶部/左边,会触发 scrolltoupper 事件 direction="+e.detail.direction) },
list_view_scrolltolower(e:ScrollToLowerEvent) { console.log("滚动到底部/右边,会触发 scrolltolower 事件 direction="+e.detail.direction) },
......
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe('test title', () => {
let page;
beforeAll(async () => {
page = await program.reLaunch('/pages/component/scroll-view/scroll-view-refresher');
await page.waitFor(300);
});
it('check_refresher', async () => {
await page.setData({
refresherTriggered: true
})
await page.waitFor(2000);
expect(await page.data('refresherrefresh')).toBe(true)
});
});
......@@ -18,7 +18,8 @@
data() {
return {
scrollData: [] as Array <string>,
refresherTriggered: false
refresherTriggered: false,
refresherrefresh: false
};
},
onLoad() {
......@@ -30,7 +31,8 @@
},
methods: {
onRefresherrefresh(_: RefresherEvent) {
onRefresherrefresh(_: RefresherEvent) {
this.refresherrefresh = true
console.log("onRefresherrefresh--------------下拉刷新触发")
this.refresherTriggered = true
setTimeout(function(){
......@@ -41,7 +43,8 @@
onRefresherabort(_: RefresherEvent) {
console.log("onRefresherabort------下拉刷新被中止")
},
onRefresherrestore(_: RefresherEvent) {
onRefresherrestore(_: RefresherEvent) {
this.refresherrefresh = false
console.log("onRefresherrestore------下拉刷新被复位")
},
onRefresherpulling(e: RefresherEvent) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册