Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
d2d25f54
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看板
提交
d2d25f54
编写于
8月 30, 2023
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: ref
上级
e7e22d72
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
51 addition
and
12 deletion
+51
-12
pages/component/general-attribute/general-attribute.test.js
pages/component/general-attribute/general-attribute.test.js
+11
-5
pages/component/general-attribute/general-attribute.uvue
pages/component/general-attribute/general-attribute.uvue
+40
-7
未找到文件。
pages/component/general-attribute/general-attribute.test.js
浏览文件 @
d2d25f54
...
@@ -7,14 +7,20 @@ describe('general attribute', () => {
...
@@ -7,14 +7,20 @@ describe('general attribute', () => {
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
page
=
await
program
.
navigateTo
(
PAGE_PATH
)
await
page
.
waitFor
(
1000
)
await
page
.
waitFor
(
1000
)
})
})
it
(
'
screenshot
'
,
async
()
=>
{
it
(
"
class & style
"
,
async
()
=>
{
const
image
=
await
program
.
screenshot
()
const
image
=
await
program
.
screenshot
()
;
expect
(
image
).
toMatchImageSnapshot
()
expect
(
image
).
toMatchImageSnapshot
()
;
})
})
;
it
(
'
validateGeneralAttributes
'
,
async
()
=>
{
it
(
'
validateGeneralAttributes
'
,
async
()
=>
{
const
button
=
await
page
.
$
(
'
.btn
'
)
const
button
=
await
page
.
$
(
"
.btn-style
"
);
await
button
.
tap
()
await
button
.
tap
()
const
btnInner
=
await
page
.
$
(
'
.btn-inner
'
)
const
btnInner
=
await
page
.
$
(
'
.btn-inner
'
)
expect
(
await
btnInner
.
text
()).
toBe
(
'
基础属性验证成功
'
)
expect
(
await
btnInner
.
text
()).
toBe
(
'
基础属性验证成功
'
)
})
})
it
(
"
ref
"
,
async
()
=>
{
const
button
=
await
page
.
$
(
"
.btn-ref
"
);
await
button
.
tap
();
const
image
=
await
program
.
screenshot
();
expect
(
image
).
toMatchImageSnapshot
();
});
})
})
pages/component/general-attribute/general-attribute.uvue
浏览文件 @
d2d25f54
...
@@ -4,16 +4,43 @@
...
@@ -4,16 +4,43 @@
<!-- #endif -->
<!-- #endif -->
<view>
<view>
<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 container">
<view :id="generalId" :class="generalClass" :name="generalName" :title="generalTitle" :data-test="generalData" style="background-color: aqua" ref="general-target"> </view>
<view
<view class="btn uni-common-mt" @click="validateGeneralAttributes">
:id="generalId"
:class="generalClass"
:name="generalName"
:title="generalTitle"
:data-test="generalData"
:style="generalStyle"
ref="general-target"
>
<text>id: {{ generalId }}</text>
<text>class: {{ generalClass }}</text>
<text>name: {{ generalName }}</text>
<text>title: {{ generalTitle }}</text>
<text>data-test: {{ generalData }}</text>
<text>style: {{ generalStyle }}</text>
</view>
<view
class="btn btn-style uni-common-mt"
@click="validateGeneralAttributes"
>
<text class="btn-inner">{{ validateGeneralAttrText }}</text>
<text class="btn-inner">{{ validateGeneralAttrText }}</text>
</view>
</view>
<view class="btn btn-ref uni-common-mt" @click="changeHeight">
<text class="btn-inner">通过 ref 修改高度</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>
</view>
</view>
<view class="view-class" :hover-class="hoverClass" :hover-start-time="1000" :hover-stay-time="1000" ref="view-target">
<view
class="view-class"
:hover-class="hoverClass"
:hover-start-time="1000"
:hover-stay-time="1000"
ref="view-target"
>
<text class="text">按下 1000 ms 后背景变红</text>
<text class="text">按下 1000 ms 后背景变红</text>
<text class="text">抬起 1000 ms 后背景恢复</text>
<text class="text">抬起 1000 ms 后背景恢复</text>
</view>
</view>
...
@@ -34,6 +61,7 @@ export default {
...
@@ -34,6 +61,7 @@ export default {
generalName: 'general-name',
generalName: 'general-name',
generalTitle: 'general-title',
generalTitle: 'general-title',
generalData: 'general-data',
generalData: 'general-data',
generalStyle: 'background-color: aqua',
validateGeneralAttrText: '验证基础属性',
validateGeneralAttrText: '验证基础属性',
hoverClass: 'hover-class',
hoverClass: 'hover-class',
validateViewAttrText: '验证 view 属性',
validateViewAttrText: '验证 view 属性',
...
@@ -69,6 +97,10 @@ export default {
...
@@ -69,6 +97,10 @@ export default {
}
}
this.validateGeneralAttrText = '基础属性验证成功'
this.validateGeneralAttrText = '基础属性验证成功'
},
},
changeHeight(){
const generalTarget = this.$refs.get('general-target') as INode
generalTarget.style.set('height', '200px')
}
},
},
}
}
</script>
</script>
...
@@ -86,9 +118,10 @@ export default {
...
@@ -86,9 +118,10 @@ export default {
color: #fff;
color: #fff;
}
}
.general-class {
.general-class {
margin: 20px 0 0 50px;
margin-left: 40px;
width: 240px;
padding: 10px;
height: 100px;
width: 260px;
height: 160px;
background-color: antiquewhite;
background-color: antiquewhite;
}
}
.view-class {
.view-class {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录