Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
187392f4
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5995
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看板
提交
187392f4
编写于
9月 20, 2023
作者:
shutao-dc
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
补充list-view测试例
上级
4fe80a96
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
89 addition
and
2 deletion
+89
-2
pages/component/list-view/list-view.test.js
pages/component/list-view/list-view.test.js
+69
-0
pages/component/list-view/list-view.uvue
pages/component/list-view/list-view.uvue
+20
-2
未找到文件。
pages/component/list-view/list-view.test.js
0 → 100644
浏览文件 @
187392f4
describe
(
'
component-native-list-view
'
,
()
=>
{
let
page
beforeAll
(
async
()
=>
{
//打开list-view测试页
page
=
await
program
.
reLaunch
(
'
/pages/component/list-view/list-view
'
)
await
page
.
waitFor
(
600
)
})
//检测竖向可滚动区域
it
(
'
check_scroll_height
'
,
async
()
=>
{
await
page
.
callMethod
(
'
change_scroll_y_boolean
'
,
true
)
await
page
.
callMethod
(
'
change_scroll_x_boolean
'
,
false
)
await
page
.
waitFor
(
600
)
const
value
=
await
page
.
callMethod
(
'
check_scroll_height
'
)
expect
(
value
).
toBe
(
true
)
})
//检测竖向scrolltop属性赋值
it
(
'
check_scroll_top
'
,
async
()
=>
{
await
page
.
callMethod
(
'
confirm_scroll_top_input
'
,
600
)
await
page
.
waitFor
(
600
)
const
listElement
=
await
page
.
$
(
'
#listview
'
)
const
scrollTop
=
await
listElement
.
attribute
(
"
scrollTop
"
)
console
.
log
(
"
check_scroll_top---
"
+
scrollTop
)
expect
(
scrollTop
-
600
).
toBeGreaterThanOrEqual
(
0
)
})
//检测竖向scroll_into_view属性赋值
it
(
'
check_scroll_into_view_top
'
,
async
()
=>
{
await
page
.
callMethod
(
'
item_change_size_enum
'
,
3
)
await
page
.
waitFor
(
600
)
const
listElement
=
await
page
.
$
(
'
#listview
'
)
const
scrollTop
=
await
listElement
.
attribute
(
"
scrollTop
"
)
console
.
log
(
"
check_scroll_into_view_top--
"
+
scrollTop
)
await
page
.
callMethod
(
'
item_change_size_enum
'
,
0
)
expect
(
scrollTop
-
690
).
toBeGreaterThanOrEqual
(
0
)
})
//检测横向可滚动区域
it
(
'
check_scroll_width
'
,
async
()
=>
{
await
page
.
callMethod
(
'
change_scroll_y_boolean
'
,
false
)
await
page
.
callMethod
(
'
change_scroll_x_boolean
'
,
true
)
await
page
.
waitFor
(
600
)
const
value
=
await
page
.
callMethod
(
'
check_scroll_width
'
)
expect
(
value
).
toBe
(
true
)
})
//检测横向scrollLeft属性赋值
it
(
'
check_scroll_left
'
,
async
()
=>
{
await
page
.
callMethod
(
'
confirm_scroll_left_input
'
,
600
)
await
page
.
waitFor
(
600
)
const
listElement
=
await
page
.
$
(
'
#listview
'
)
const
scrollLeft
=
await
listElement
.
attribute
(
"
scrollLeft
"
)
console
.
log
(
"
check_scroll_left---
"
+
scrollLeft
)
expect
(
scrollLeft
-
600
).
toBeGreaterThanOrEqual
(
0
)
})
//检测横向scroll_into_view属性赋值
it
(
'
check_scroll_into_view_left
'
,
async
()
=>
{
await
page
.
callMethod
(
'
item_change_size_enum
'
,
3
)
await
page
.
waitFor
(
600
)
const
listElement
=
await
page
.
$
(
'
#listview
'
)
const
scrollLeft
=
await
listElement
.
attribute
(
"
scrollLeft
"
)
console
.
log
(
"
check_scroll_into_view_left--
"
+
scrollLeft
)
await
page
.
callMethod
(
'
item_change_size_enum
'
,
0
)
expect
(
scrollLeft
-
1080
).
toBeGreaterThanOrEqual
(
0
)
})
})
pages/component/list-view/list-view.uvue
浏览文件 @
187392f4
...
@@ -67,7 +67,25 @@
...
@@ -67,7 +67,25 @@
confirm_scroll_top_input(value : number) { this.scroll_top_input = value },
confirm_scroll_top_input(value : number) { this.scroll_top_input = value },
confirm_scroll_left_input(value : number) { this.scroll_left_input = value },
confirm_scroll_left_input(value : number) { this.scroll_left_input = value },
confirm_refresher_background_input(value : string) { this.refresher_background_input = value },
confirm_refresher_background_input(value : string) { this.refresher_background_input = value },
item_change_size_enum(index : number) { this.scrollIntoView = "item---"+index }
item_change_size_enum(index : number) { this.scrollIntoView = "item---"+index },
//自动化测试例专用
check_scroll_height(): Boolean {
var listElement = this.$refs["listview"] as Element
console.log("check_scroll_height--"+listElement.scrollHeight)
if(listElement.scrollHeight > 2000) {
return true
}
return false
},
//自动化测试例专用
check_scroll_width(): Boolean {
var listElement = this.$refs["listview"] as Element
console.log("check_scroll_width"+listElement.scrollWidth)
if(listElement.scrollWidth > 2000) {
return true
}
return false
}
}
}
}
}
</script>
</script>
...
@@ -83,7 +101,7 @@
...
@@ -83,7 +101,7 @@
@touchcancel="list_view_touchcancel" @touchend="list_view_touchend" @tap="list_view_tap"
@touchcancel="list_view_touchcancel" @touchend="list_view_touchend" @tap="list_view_tap"
@longpress="list_view_longpress" @refresherpulling="list_view_refresherpulling"
@longpress="list_view_longpress" @refresherpulling="list_view_refresherpulling"
@refresherrefresh="list_view_refresherrefresh" @refresherrestore="list_view_refresherrestore"
@refresherrefresh="list_view_refresherrefresh" @refresherrestore="list_view_refresherrestore"
@refresherabort="list_view_refresherabort" @scrolltoupper="list_view_scrolltoupper"
@refresherabort="list_view_refresherabort" @scrolltoupper="list_view_scrolltoupper"
ref="listview" id="listview"
@scrolltolower="list_view_scrolltolower" @scroll="list_view_scroll" style="width:100%;">
@scrolltolower="list_view_scrolltolower" @scroll="list_view_scroll" style="width:100%;">
<list-item
<list-item
v-for="key in scrollData" :key="key" :id="key" @click="list_item_click" @touchstart="list_item_touchstart"
v-for="key in scrollData" :key="key" :id="key" @click="list_item_click" @touchstart="list_item_touchstart"
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录