Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
c8da4d63
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5992
Star
90
Fork
162
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
c8da4d63
编写于
4月 30, 2024
作者:
雪洛
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: web端放开下拉刷新测试例
上级
2a608aed
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
41 addition
and
28 deletion
+41
-28
pages/component/scroll-view/scroll-view-refresher.test.js
pages/component/scroll-view/scroll-view-refresher.test.js
+35
-26
pages/component/scroll-view/scroll-view-refresher.uvue
pages/component/scroll-view/scroll-view-refresher.uvue
+6
-0
pages/component/scroll-view/scroll-view.uvue
pages/component/scroll-view/scroll-view.uvue
+0
-2
未找到文件。
pages/component/scroll-view/scroll-view-refresher.test.js
浏览文件 @
c8da4d63
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe
(
'
component-native-scroll-view-refresher
'
,
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)
&&
!
process
.
env
.
UNI_AUTOMATOR_APP_WEBVIEW
)
{
let
page
;
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/component/scroll-view/scroll-view-refresher
'
);
await
page
.
waitFor
(
300
);
});
describe
(
'
component-native-scroll-view-refresher
'
,
()
=>
{
if
(
!
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
)
&&
!
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
)
||
process
.
env
.
UNI_AUTOMATOR_APP_WEBVIEW
)
{
it
(
'
other platform
'
,
()
=>
{
expect
(
1
).
toBe
(
1
)
})
return
}
let
page
;
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/component/scroll-view/scroll-view-refresher
'
);
await
page
.
waitFor
(
300
);
});
it
(
'
scroll-view-refresher-screenshot
'
,
async
()
=>
{
//禁止滚动条
await
page
.
setData
({
showScrollbar
:
false
})
await
page
.
waitFor
(
300
);
const
image
=
await
program
.
screenshot
({
fullPage
:
true
});
expect
(
image
).
toSaveImageSnapshot
();
it
(
'
scroll-view-refresher-screenshot
'
,
async
()
=>
{
//禁止滚动条
await
page
.
setData
({
showScrollbar
:
false
})
await
page
.
waitFor
(
300
);
const
image
=
await
program
.
screenshot
({
fullPage
:
true
});
expect
(
image
).
toSaveImageSnapshot
();
})
it
(
'
check_refresher
'
,
async
()
=>
{
await
page
.
setData
({
refresherTriggered
:
true
})
await
page
.
waitFor
(
2000
);
expect
(
await
page
.
data
(
'
refresherrefresh
'
)).
toBe
(
true
)
});
}
else
{
it
(
'
other platform
'
,
()
=>
{
expect
(
1
).
toBe
(
1
)
it
(
'
check_refresher
'
,
async
()
=>
{
await
page
.
setData
({
refresherTriggered
:
true
})
}
await
page
.
waitFor
(
1000
);
expect
(
await
page
.
data
(
'
refresherrefreshTimes
'
)).
toBe
(
1
)
});
it
(
'
check_refresher_snapshot
'
,
async
()
=>
{
await
page
.
setData
({
refresherTriggered
:
true
})
await
page
.
waitFor
(
300
);
const
image
=
await
program
.
screenshot
({
fullPage
:
true
});
expect
(
image
).
toSaveImageSnapshot
();
});
});
pages/component/scroll-view/scroll-view-refresher.uvue
浏览文件 @
c8da4d63
<template>
<view class="container">
<button @click="test">test</button>
<page-head title="scroll-view 下拉刷新"></page-head>
<scroll-view class="scroll" refresher-enabled=true :refresher-triggered="refresherTriggered"
@refresherrefresh="onRefresherrefresh" @refresherabort="onRefresherabort" @refresherrestore="onRefresherrestore"
...
...
@@ -19,6 +20,7 @@
scrollData: [] as Array<string>,
refresherTriggered: false,
refresherrefresh: false,
refresherrefreshTimes: 0,
showScrollbar: false
};
},
...
...
@@ -31,10 +33,14 @@
},
methods: {
test() {
this.refresherTriggered = true
},
onRefresherrefresh(_ : RefresherEvent) {
this.refresherrefresh = true
console.log("onRefresherrefresh--------------下拉刷新触发")
this.refresherTriggered = true
this.refresherrefreshTimes++
setTimeout(() => {
this.refresherTriggered = false
}, 1500)
...
...
pages/component/scroll-view/scroll-view.uvue
浏览文件 @
c8da4d63
...
...
@@ -40,7 +40,6 @@
</navigator>
<view class="uni-common-pb"></view>
<!-- #ifdef APP -->
<navigator url="/pages/component/scroll-view/scroll-view-refresher-props" hover-class="none">
<button type="primary" class="button">
下拉刷新的属性示例
...
...
@@ -57,7 +56,6 @@
</button>
</navigator>
<view class="uni-common-pb"></view>
<!-- #endif -->
</view>
</view>
<!-- #ifdef APP -->
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录