Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
fe2bcdb6
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看板
提交
fe2bcdb6
编写于
8月 25, 2023
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test(component): general attribute and event
上级
8a7871ec
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
25 addition
and
12 deletion
+25
-12
pages/component/view/general-attribute.test.js
pages/component/view/general-attribute.test.js
+2
-1
pages/component/view/general-attribute.uvue
pages/component/view/general-attribute.uvue
+15
-2
pages/component/view/general-event.test.js
pages/component/view/general-event.test.js
+2
-3
pages/component/view/general-event.uvue
pages/component/view/general-event.uvue
+6
-6
未找到文件。
pages/component/view/general-attribute.test.js
浏览文件 @
fe2bcdb6
...
@@ -14,6 +14,7 @@ describe('general attribute', () => {
...
@@ -14,6 +14,7 @@ describe('general attribute', () => {
it
(
'
validateGeneralAttributes
'
,
async
()
=>
{
it
(
'
validateGeneralAttributes
'
,
async
()
=>
{
const
button
=
await
page
.
$
(
'
.btn
'
)
const
button
=
await
page
.
$
(
'
.btn
'
)
await
button
.
tap
()
await
button
.
tap
()
expect
(
await
button
.
text
()).
toBe
(
'
基础属性验证成功
'
)
const
btnInner
=
await
page
.
$
(
'
.btn-inner
'
)
expect
(
await
btnInner
.
text
()).
toBe
(
'
基础属性验证成功
'
)
})
})
})
})
pages/component/view/general-attribute.uvue
浏览文件 @
fe2bcdb6
...
@@ -6,7 +6,9 @@
...
@@ -6,7 +6,9 @@
<page-head :title="title"></page-head>
<page-head :title="title"></page-head>
<view class="uni-padding-wrap uni-common-mt container">
<view class="uni-padding-wrap uni-common-mt container">
<view :id="generalId" :class="generalClass" :name="generalName" :title="generalTitle" :data-test="generalData" style="background-color: aqua" ref="general-target"> </view>
<view :id="generalId" :class="generalClass" :name="generalName" :title="generalTitle" :data-test="generalData" style="background-color: aqua" ref="general-target"> </view>
<button class="btn uni-common-mt" @click="validateGeneralAttributes">{{ validateGeneralAttrText }}</button>
<view class="btn uni-common-mt" @click="validateGeneralAttributes">
<text class="btn-inner">{{ validateGeneralAttrText }}</text>
</view>
<view class="view-class" :hover-class="hoverClass" ref="view-target">
<view class="view-class" :hover-class="hoverClass" ref="view-target">
<text class="text">按下 50 ms 后背景变红</text>
<text class="text">按下 50 ms 后背景变红</text>
<text class="text">抬起 400 ms 后背景恢复</text>
<text class="text">抬起 400 ms 后背景恢复</text>
...
@@ -72,6 +74,17 @@ export default {
...
@@ -72,6 +74,17 @@ export default {
</script>
</script>
<style>
<style>
.btn {
height: 50px;
display: flex;
align-items: center;
justify-content: center;
background-color: #409eff;
border-radius: 5px;
}
.btn-inner {
color: #fff;
}
.general-class {
.general-class {
margin: 20px 0 0 50px;
margin: 20px 0 0 50px;
width: 240px;
width: 240px;
...
@@ -86,7 +99,7 @@ export default {
...
@@ -86,7 +99,7 @@ export default {
background-color: antiquewhite;
background-color: antiquewhite;
}
}
.view-class .text {
.view-class .text {
margin-top: 5px;
margin-top: 5px;
text-align: center;
text-align: center;
}
}
.hover-class {
.hover-class {
...
...
pages/component/view/general-event.test.js
浏览文件 @
fe2bcdb6
...
@@ -60,13 +60,12 @@ describe('event trigger sequence', () => {
...
@@ -60,13 +60,12 @@ describe('event trigger sequence', () => {
it
(
'
click
'
,
async
()
=>
{
it
(
'
click
'
,
async
()
=>
{
await
el
.
tap
()
await
el
.
tap
()
const
data
=
await
page
.
data
()
const
data
=
await
page
.
data
()
expect
(
data
.
onTapTime
).
toBeLessThan
(
data
.
onClickTime
)
expect
(
data
.
onTapTime
).
toBeLessThan
OrEqual
(
data
.
onClickTime
)
})
})
it
(
'
longPress
'
,
async
()
=>
{
it
(
'
longPress
'
,
async
()
=>
{
const
now
=
Date
.
now
()
await
el
.
longpress
()
await
el
.
longpress
()
const
data
=
await
page
.
data
()
const
data
=
await
page
.
data
()
expect
(
now
).
toBeLessThan
(
data
.
onLongPressTime
)
expect
(
data
.
onLongPressTime
).
toBeGreaterThan
(
0
)
})
})
})
})
pages/component/view/general-event.uvue
浏览文件 @
fe2bcdb6
...
@@ -93,31 +93,31 @@ export default {
...
@@ -93,31 +93,31 @@ export default {
onTouchStart(e: TouchEvent){
onTouchStart(e: TouchEvent){
this.touchStartEvent = e
this.touchStartEvent = e
this.onTouchStartTime = Date.now()
this.onTouchStartTime = Date.now()
console.
warn('onTouchStart', this.onTouchStartTime
)
console.
log('onTouchStart'
)
},
},
onTouchMove(e: TouchEvent){
onTouchMove(e: TouchEvent){
this.touchMoveEvent = e
this.touchMoveEvent = e
this.onTouchMoveTime = Date.now()
this.onTouchMoveTime = Date.now()
console.
warn('onTouchMove', this.onTouchMoveTime
)
console.
log('onTouchMove'
)
},
},
onTouchEnd(e: TouchEvent){
onTouchEnd(e: TouchEvent){
this.touchEndEvent = e
this.touchEndEvent = e
this.onTouchEndTime = Date.now()
this.onTouchEndTime = Date.now()
console.
warn('onTouchEnd', this.onTouchEndTime
)
console.
log('onTouchEnd'
)
},
},
onTap(e: MouseEvent){
onTap(e: MouseEvent){
this.tapEvent = e
this.tapEvent = e
this.onTapTime = Date.now()
this.onTapTime = Date.now()
console.
warn('onTap', this.onTapTime
)
console.
log('onTap'
)
},
},
onClick(e: MouseEvent){
onClick(e: MouseEvent){
this.clickEvent = e
this.clickEvent = e
this.onClickTime = Date.now()
this.onClickTime = Date.now()
console.
warn('onClick', this.onClickTime
)
console.
log('onClick'
)
},
},
onLongPress(){
onLongPress(){
this.onLongPressTime = Date.now()
this.onLongPressTime = Date.now()
console.
warn('onLongPress', this.onLongPressTime
)
console.
log('onLongPress'
)
},
},
},
},
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录