Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
c7636102
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6067
Star
93
Fork
166
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
19
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
19
Issue
19
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
c7636102
编写于
12月 19, 2024
作者:
DCloud_iOS_XHY
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
增加 touch preventDefault、stopPropagation 测试例
上级
6e3ae8b1
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
127 addition
and
0 deletion
+127
-0
pages.json
pages.json
+6
-0
pages/component/global-events/touch-events-case.test.js
pages/component/global-events/touch-events-case.test.js
+57
-0
pages/component/global-events/touch-events-case.uvue
pages/component/global-events/touch-events-case.uvue
+63
-0
testSequencer.js
testSequencer.js
+1
-0
未找到文件。
pages.json
浏览文件 @
c7636102
...
...
@@ -499,6 +499,12 @@
"navigationBarTitleText"
:
"Touch Events bubbles"
}
},
{
"path"
:
"pages/component/global-events/touch-events-case"
,
"style"
:
{
"navigationBarTitleText"
:
"Touch Events case"
}
},
//
#ifdef
APP-ANDROID
||
APP-IOS
{
"path"
:
"pages/component/nested-scroll-header/nested-scroll-header"
,
...
...
pages/component/global-events/touch-events-case.test.js
0 → 100644
浏览文件 @
c7636102
const
PAGE_PATH
=
'
/pages/component/global-events/touch-events-case
'
describe
(
'
touch-events-test
'
,
()
=>
{
const
platformInfo
=
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
()
const
isAndroid
=
platformInfo
.
startsWith
(
'
android
'
)
const
isIOS
=
platformInfo
.
startsWith
(
'
ios
'
)
const
isMP
=
platformInfo
.
startsWith
(
'
mp
'
)
const
isWeb
=
platformInfo
.
startsWith
(
'
web
'
)
if
(
isWeb
||
isMP
)
{
it
(
'
other platform
'
,
()
=>
{
expect
(
1
).
toBe
(
1
)
})
return
}
if
(
process
.
env
.
UNI_TEST_DEVICES_DIRECTION
==
'
landscape
'
)
{
it
(
'
跳过横屏模式
'
,
()
=>
{
expect
(
1
).
toBe
(
1
)
})
return
}
let
page
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
await
page
.
waitFor
(
500
);
})
it
(
'
touch-event-preventDefault
'
,
async
()
=>
{
let
x
=
25
let
y
=
150
// 滑动事件
await
program
.
swipe
({
startPoint
:
{
x
:
x
,
y
:
y
},
endPoint
:
{
x
:
x
+
200
,
y
:
y
},
duration
:
300
})
await
page
.
waitFor
(
1500
);
const
ret
=
await
page
.
callMethod
(
'
isPassTest1
'
)
expect
(
ret
).
toBe
(
true
)
})
it
(
'
touch-event-stopPropagation
'
,
async
()
=>
{
const
ret
=
await
page
.
callMethod
(
'
isPassTest2
'
)
expect
(
ret
).
toBe
(
true
)
})
})
pages/component/global-events/touch-events-case.uvue
0 → 100644
浏览文件 @
c7636102
<template>
<view>
<swiper ref="header" indicator-dots="true" circular="true" @change="swiperChange" @touchstart="swiperTouchStart">
<swiper-item v-for="i in 3" :item-id="i" @touchstart="swiperItemTouchStart">
<view class="header-tiem" @touchstart="viewTouchStart">
<text @touchstart="textTouchStart">{{ i }}</text>
</view>
</swiper-item>
</swiper>
</view>
</template>
<script>
export default {
data() {
return {
swiperChangeEvent: false,
viewTouchEvent: false,
swiperItemTouchEvent: false,
swiperTouchEvent: false
}
},
methods: {
swiperChange(e: UniSwiperChangeEvent) {
console.log("swiperChange", e.detail.current)
this.swiperChangeEvent = true
},
viewTouchStart(e: UniTouchEvent) {
console.log("viewTouchStart")
this.viewTouchEvent = true
e.preventDefault()
},
swiperItemTouchStart(e: UniTouchEvent) {
console.log("swiperItemTouchStart")
this.swiperItemTouchEvent = true
e.stopPropagation()
},
swiperTouchStart(e: UniTouchEvent) {
console.log("swiperTouchStart")
this.swiperTouchEvent = true
},
isPassTest1() {
console.log("swiperChangeEvent:", this.swiperChangeEvent)
return this.swiperChangeEvent == false
},
isPassTest2() {
console.log("viewTouchEvent:", this.viewTouchEvent)
console.log("swiperItemTouchEvent:", this.swiperItemTouchEvent)
console.log("swiperTouchEvent:", this.swiperTouchEvent)
return this.viewTouchEvent == true && this.swiperItemTouchEvent == true && this.swiperTouchEvent == false
}
}
}
</script>
<style>
.header-tiem {
height: 300px;
background-color: #89ff8d;
align-items: center;
justify-content: center;
}
</style>
testSequencer.js
浏览文件 @
c7636102
...
...
@@ -7,6 +7,7 @@ const sortTestFilePaths = [
"
pages/component/scroll-view/scroll-view-refresher.test.js
"
,
"
pages/component/global-events/touch-events.test.js
"
,
"
pages/component/global-events/touch-events-bubbles.test.js
"
,
"
pages/component/global-events/touch-events-case.test.js
"
,
"
pages/component/swiper/swiper2.test.js
"
,
"
pages/component/slider/slider-maxValue.test.js
"
,
"
pages/CSS/overflow/overflow-visible-event.test.js
"
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录