Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
2a6760be
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看板
提交
2a6760be
编写于
8月 20, 2024
作者:
Anne_LXM
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test(scroll-view.test.js/list-view.test.js): issues2420修复更新测试例
上级
190dae61
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
32 addition
and
54 deletion
+32
-54
pages/component/list-view/list-view.test.js
pages/component/list-view/list-view.test.js
+10
-13
pages/component/list-view/list-view.uvue
pages/component/list-view/list-view.uvue
+0
-7
pages/component/scroll-view/scroll-view.test.js
pages/component/scroll-view/scroll-view.test.js
+22
-27
pages/component/scroll-view/scroll-view.uvue
pages/component/scroll-view/scroll-view.uvue
+0
-7
未找到文件。
pages/component/list-view/list-view.test.js
浏览文件 @
2a6760be
...
...
@@ -38,18 +38,15 @@ describe('component-native-list-view', () => {
await
page
.
waitFor
(
600
)
await
page
.
callMethod
(
'
confirm_scroll_top_input
'
,
300
)
await
page
.
waitFor
(
600
)
// 在web端scroll事件event参数中detail类型报错,先忽略测试
if
(
!
process
.
env
.
UNI_UTS_PLATFORM
.
startsWith
(
'
web
'
)){
const
scrollDetail
=
await
page
.
data
(
'
scrollDetailTest
'
)
console
.
log
(
'
scrollDetailTest:
'
,
scrollDetail
)
expect
(
scrollDetail
.
scrollLeft
).
toBe
(
0
)
// scrollTop和deltaY 在安卓端差异 299.8095
expect
([
300
,
299.8095
]).
toContain
(
scrollDetail
.
scrollTop
);
expect
(
scrollDetail
.
scrollHeight
).
toBeGreaterThan
(
0
)
expect
(
scrollDetail
.
scrollWidth
).
toBeGreaterThan
(
0
)
expect
(
scrollDetail
.
deltaX
).
toBe
(
0
)
expect
([
300
,
299.8095
]).
toContain
(
scrollDetail
.
deltaY
);
}
const
scrollDetail
=
await
page
.
data
(
'
scrollDetailTest
'
)
// console.log('scrollDetailTest:', scrollDetail)
expect
(
scrollDetail
.
scrollLeft
).
toBe
(
0
)
// scrollTop和deltaY 在安卓端差异 299.8095
expect
([
300
,
299.8095
]).
toContain
(
scrollDetail
.
scrollTop
);
expect
(
scrollDetail
.
scrollHeight
).
toBeGreaterThan
(
0
)
expect
(
scrollDetail
.
scrollWidth
).
toBeGreaterThan
(
0
)
expect
(
scrollDetail
.
deltaX
).
toBe
(
0
)
expect
([
300
,
299.8095
]).
toContain
(
scrollDetail
.
deltaY
);
expect
(
await
page
.
data
(
'
isScrollTest
'
)).
toBe
(
'
scroll:Success
'
)
})
...
...
@@ -84,7 +81,7 @@ describe('component-native-list-view', () => {
})
await
page
.
waitFor
(
600
)
const
endDetail
=
await
page
.
data
(
'
scrollEndDetailTest
'
)
console
.
log
(
'
scrollEndDetailTest:
'
,
endDetail
)
//
console.log('scrollEndDetailTest:', endDetail)
expect
(
endDetail
.
deltaY
).
toBe
(
0
)
expect
(
endDetail
.
deltaX
).
toBe
(
0
)
expect
(
endDetail
.
scrollLeft
).
toBe
(
0
)
...
...
pages/component/list-view/list-view.uvue
浏览文件 @
2a6760be
...
...
@@ -34,11 +34,8 @@
isScrollTest:'',
isScrolltolowerTest:'',
isScrolltoupperTest:'',
// 在web端scroll事件event参数中detail类型报错,先条件编译处理
// #ifndef WEB
scrollDetailTest:null as UniScrollEventDetail|null,
scrollEndDetailTest:null as UniScrollEventDetail|null,
// #endif
}
},
onLoad() {
...
...
@@ -103,9 +100,7 @@
},
list_view_scroll(e:UniScrollEvent) {
console.log("滚动时触发,event.detail = {scrollLeft, scrollTop, scrollHeight, scrollWidth, deltaX, deltaY}")
// #ifndef WEB
this.scrollDetailTest = e.detail
// #endif
this.checkEventTest({
type:e.type,
target:e.target,
...
...
@@ -114,9 +109,7 @@
},
list_view_scrollend(e:UniScrollEvent){
console.log("滚动结束时触发",e.detail)
// #ifndef WEB
this.scrollEndDetailTest = e.detail
// #endif
this.checkEventTest({
type:e.type,
target:e.target,
...
...
pages/component/scroll-view/scroll-view.test.js
浏览文件 @
2a6760be
...
...
@@ -20,19 +20,16 @@ describe('component-native-scroll-view', () => {
// 纵向滚动
await
page
.
setData
({
scrollTop
:
100
})
await
page
.
waitFor
(
1000
)
// bug:在web端scroll事件event参数中detail类型报错
if
(
!
process
.
env
.
UNI_UTS_PLATFORM
.
startsWith
(
'
web
'
)){
// 设置top 是否触发scroll 事件
const
topScrollDetail
=
await
page
.
data
(
'
scrollDetailTest
'
)
console
.
log
(
'
topScrollDetail:
'
,
topScrollDetail
)
expect
(
topScrollDetail
.
scrollLeft
).
toBe
(
0
)
// Android 差异scrollTop:99.809525
expect
([
100
,
99.809525
]).
toContain
(
topScrollDetail
.
scrollTop
);
expect
(
topScrollDetail
.
scrollHeight
).
toBeGreaterThan
(
0
)
expect
(
topScrollDetail
.
scrollWidth
).
toBeGreaterThan
(
0
)
expect
(
topScrollDetail
.
deltaX
).
toBe
(
0
)
expect
(
topScrollDetail
.
deltaY
).
not
.
toBe
(
0
)
}
// 设置top 是否触发scroll 事件
const
topScrollDetail
=
await
page
.
data
(
'
scrollDetailTest
'
)
// console.log('topScrollDetail:', topScrollDetail)
expect
(
topScrollDetail
.
scrollLeft
).
toBe
(
0
)
// Android 差异scrollTop:99.809525
expect
([
100
,
99.809525
]).
toContain
(
topScrollDetail
.
scrollTop
);
expect
(
topScrollDetail
.
scrollHeight
).
toBeGreaterThan
(
0
)
expect
(
topScrollDetail
.
scrollWidth
).
toBeGreaterThan
(
0
)
expect
(
topScrollDetail
.
deltaX
).
toBe
(
0
)
expect
(
topScrollDetail
.
deltaY
).
not
.
toBe
(
0
)
expect
(
await
page
.
data
(
'
isScrollTest
'
)).
toBe
(
'
scroll:Success
'
)
})
...
...
@@ -40,19 +37,17 @@ describe('component-native-scroll-view', () => {
// 横向滚动
await
page
.
setData
({
scrollLeft
:
220
})
await
page
.
waitFor
(
600
)
if
(
!
process
.
env
.
UNI_UTS_PLATFORM
.
startsWith
(
'
web
'
)){
//设置left 是否触发scroll 事件
const
leftScrollDetail
=
await
page
.
data
(
'
scrollDetailTest
'
)
console
.
log
(
'
leftScrollDetail:
'
,
leftScrollDetail
)
// Android 差异scrollLeft:219.80952
expect
([
220
,
219.80952
]).
toContain
(
leftScrollDetail
.
scrollLeft
);
expect
(
leftScrollDetail
.
scrollTop
).
toBe
(
0
)
expect
(
leftScrollDetail
.
scrollHeight
).
toBeGreaterThan
(
0
)
expect
(
leftScrollDetail
.
scrollWidth
).
toBeGreaterThan
(
0
)
// 在安卓差异 -99.809525
expect
([
-
100
,
-
99.809525
]).
toContain
(
leftScrollDetail
.
deltaX
);
expect
(
leftScrollDetail
.
deltaY
).
toBe
(
0
)
}
//设置left 是否触发scroll 事件
const
leftScrollDetail
=
await
page
.
data
(
'
scrollDetailTest
'
)
// console.log('leftScrollDetail:', leftScrollDetail)
// Android 差异scrollLeft:219.80952
expect
([
220
,
219.80952
]).
toContain
(
leftScrollDetail
.
scrollLeft
);
expect
(
leftScrollDetail
.
scrollTop
).
toBe
(
0
)
expect
(
leftScrollDetail
.
scrollHeight
).
toBeGreaterThan
(
0
)
expect
(
leftScrollDetail
.
scrollWidth
).
toBeGreaterThan
(
0
)
// 在安卓差异 -99.809525
expect
([
-
100
,
-
99.809525
]).
toContain
(
leftScrollDetail
.
deltaX
);
expect
(
leftScrollDetail
.
deltaY
).
toBe
(
0
)
expect
(
await
page
.
data
(
'
isScrollTest
'
)).
toBe
(
'
scroll:Success
'
)
})
...
...
@@ -74,7 +69,7 @@ describe('component-native-scroll-view', () => {
if
(
!
process
.
env
.
UNI_UTS_PLATFORM
.
startsWith
(
'
web
'
)){
it
(
'
Event scrollend-滚动结束时触发仅App端支持
'
,
async
()
=>
{
const
endDetail
=
await
page
.
data
(
'
scrollEndDetailTest
'
)
console
.
log
(
'
scrollEndDetailTest:
'
,
endDetail
)
//
console.log('scrollEndDetailTest:', endDetail)
expect
(
endDetail
.
scrollLeft
).
toBe
(
0
)
expect
(
endDetail
.
scrollTop
).
toBe
(
0
)
expect
(
endDetail
.
deltaY
).
toBe
(
0
)
...
...
pages/component/scroll-view/scroll-view.uvue
浏览文件 @
2a6760be
...
...
@@ -80,11 +80,8 @@
isScrollTest:'',
isScrolltolowerTest:'',
isScrolltoupperTest:'',
// 在web端scroll事件event参数中detail类型报错,先条件编译处理
// #ifndef WEB
scrollDetailTest:null as UniScrollEventDetail|null,
scrollEndDetailTest:null as UniScrollEventDetail|null,
// #endif
}
},
methods: {
...
...
@@ -107,9 +104,7 @@
} as ScrollEventTest,'scrolltolower')
},
scroll: function (e : UniScrollEvent) {
// #ifndef WEB
this.scrollDetailTest = e.detail
// #endif
this.checkEventTest({
type:e.type,
target:e.target,
...
...
@@ -119,9 +114,7 @@
},
end: function (e : UniScrollEvent){
console.log('滚动结束时触发',e)
// #ifndef WEB
this.scrollEndDetailTest = e.detail
// #endif
this.checkEventTest({
type:e.type,
target:e.target,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录