Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
0c8e97ba
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看板
提交
0c8e97ba
编写于
6月 27, 2024
作者:
雪洛
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
revert: test: overflow-visible-event 增加拖拽测试例
上级
72813bba
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
70 addition
and
166 deletion
+70
-166
pages/CSS/overflow/overflow-visible-event.test.js
pages/CSS/overflow/overflow-visible-event.test.js
+2
-32
pages/CSS/overflow/overflow-visible-event.uvue
pages/CSS/overflow/overflow-visible-event.uvue
+68
-134
未找到文件。
pages/CSS/overflow/overflow-visible-event.test.js
浏览文件 @
0c8e97ba
...
...
@@ -32,34 +32,4 @@ describe('/pages/CSS/overflow/overflow-visible-event.uvue', () => {
res
=
await
page
.
data
(
'
jest_result
'
);
expect
(
res
).
toBe
(
true
)
});
// 此测试针对开发者使用 translate 移动view
it
(
'
Check Overflow Visible Part Use translate Drag
'
,
async
()
=>
{
await
page
.
callMethod
(
'
jest_getRect
'
)
const
point_x
=
await
page
.
data
(
'
jest_click_x
'
);
const
point_y
=
await
page
.
data
(
'
jest_click_y
'
);
const
distance
=
100
;
const
destY
=
point_y
+
100
const
duration
=
1000
await
program
.
adbCommand
(
"
input swipe
"
+
"
"
+
point_x
+
"
"
+
point_y
+
"
"
+
point_x
+
"
"
+
destY
+
"
"
+
duration
)
await
page
.
waitFor
(
1500
);
await
page
.
callMethod
(
'
jest_getParentRect
'
)
const
currentParentTop
=
await
page
.
data
(
'
jest_parent_top
'
);
const
offset
=
2
const
diff
=
Math
.
abs
(
currentParentTop
-
distance
)
<
offset
console
.
log
(
"
current
"
,
currentParentTop
);
console
.
log
(
"
diff
"
,
diff
);
expect
(
diff
).
toBe
(
true
)
})
it
(
'
Check Overflow Visible Block View Click
'
,
async
()
=>
{
await
page
.
callMethod
(
'
jest_getAbsoluteViewRect
'
)
const
point_x
=
await
page
.
data
(
'
jest_click_x
'
);
const
point_y
=
await
page
.
data
(
'
jest_click_y
'
);
console
.
log
(
"
input tap
"
+
"
"
+
point_x
+
"
"
+
point_y
);
await
program
.
adbCommand
(
"
input tap
"
+
"
"
+
point_x
+
"
"
+
point_y
)
await
page
.
waitFor
(
500
);
res
=
await
page
.
data
(
'
jest_result
'
);
expect
(
res
).
toBe
(
true
)
})
});
pages/CSS/overflow/overflow-visible-event.uvue
浏览文件 @
0c8e97ba
<template>
<scroll-view style="flex: 1;">
<view>
<text style="font-size: 15px;">overflow=visible 父view(绿色),子view(红色),点击超出父view区域的部分也可触发事件。</text>
<view class="backgroundview">
<view id="parent" class="box-visible-border-radius">
<view id="child" style="width: 50px; height: 150px; background-color: red;" @click="handleClickOverflowPart"
@touchmove="handleTouchMoveOverflowPart" @touchstart="handleTouchStartOverflowPart"
@touchend="handleTouchEndOverflowPart">
</view>
</view>
</view>
<text style="font-size: 15px;">overflow=visible组件的子view (绿色)被position:
absolute的view(红色)遮挡时,点击事件测试。</text>
<view style="width: 300px;height: 300px;background-color: white;">
<view style="overflow:visible;height: 100px;width: 100%;">
<view style="background-color: green;height: 100px;width: 100%;" @click="handleClick('green')">
</view>
</view>
<view id="absolute-view" style="position: absolute;background-color: red;width: 100px;height: 200px;right: 0px;"
@click="handleClick('red')">
</view>
</view>
<text style="font-size: 15px;">overflow=visible组件设置hover-class的测试</text>
<view class="backgroundview">
<view class="box-visible-border-radius" hover-class="hover-class">
<view style="background-color: red;height: 100px;width: 100px;margin-left: 20px;margin-top: 20px;">
</view>
<view class="box-visible-border-radius">
<view id="child" style="width: 50px; height: 150px; background-color: red;"
@click="handleClickOverflowPart" @touchmove="handleTouchMoveOverflowPart">
</view>
</view>
</view>
...
...
@@ -38,43 +17,17 @@
return {
jest_result: false,
jest_click_x: -1,
jest_click_y: -1,
jest_parent_top: -1.0,
startX: 0,
startY: 0,
moveX: 0,
moveY: 0,
oldX: 0,
oldY: 0,
moveEl: null as UniElement | null
jest_click_y: -1
}
},
onReady() {
this.moveEl = uni.getElementById('parent')
},
methods: {
handleClickOverflowPart() {
console.log("click");
this.jest_result = true;
uni.showToast({
"title": "点击红色区域" })
uni.showToast({
"title":"点击红色区域"})
},
handleTouchStartOverflowPart(e : UniTouchEvent) {
this.startX = e.changedTouches[0].clientX
this.startY = e.changedTouches[0].clientY
},
handleTouchMoveOverflowPart(e : UniTouchEvent) {
handleTouchMoveOverflowPart(e:UniTouchEvent) {
console.log("touchmove:" + e.touches[0].clientX + "," + e.touches[0].clientY);
e.preventDefault()
e.stopPropagation()
const difX = e.changedTouches[0].clientX
const difY = e.changedTouches[0].clientY
this.moveX = difX - this.startX + this.oldX
this.moveY = difY - this.startY + this.oldY
this.moveEl?.style?.setProperty('transform', `translate(${this.moveX}px,${this.moveY}px)`)
},
handleTouchEndOverflowPart(_ : UniTouchEvent) {
this.oldX = this.moveX
this.oldY = this.moveY
},
handleClick(str : string) {
console.log(`点击了 ${str} view`);
...
...
@@ -89,25 +42,6 @@
this.jest_click_x = rect.x * ratio + 10
this.jest_click_y = rect.bottom * ratio - 10
}
},
jest_getParentRect() {
const transform = uni.getElementById('parent')?.style.getPropertyValue("transform")
if (transform != null) {
let value = transform as string
value = value.split(",")[1].slice(0, -3)
const ratio = uni.getSystemInfoSync().devicePixelRatio
this.jest_parent_top = Math.round((parseFloat(value) * ratio))
}
},
jest_getAbsoluteViewRect() {
const rect = uni.getElementById('absolute-view')?.getBoundingClientRect()
if (rect != null) {
const systemInfo = uni.getSystemInfoSync()
const titleBarHeight = systemInfo.screenHeight - systemInfo.windowHeight
const ratio = systemInfo.devicePixelRatio
this.jest_click_x = rect.x * ratio + 10
this.jest_click_y = (rect.top + titleBarHeight + 10) * ratio
}
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录