Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
f12b08cd
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6013
Star
91
Fork
164
代码
文件
提交
分支
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看板
提交
f12b08cd
编写于
11月 28, 2023
作者:
Y
yurj26
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: 测试例兼容web
上级
f192cfb1
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
80 addition
and
75 deletion
+80
-75
pages/component/picker-view/picker-view.test.js
pages/component/picker-view/picker-view.test.js
+8
-4
pages/component/picker-view/picker-view.uvue
pages/component/picker-view/picker-view.uvue
+2
-5
pages/component/progress/progress.test.js
pages/component/progress/progress.test.js
+70
-66
未找到文件。
pages/component/picker-view/picker-view.test.js
浏览文件 @
f12b08cd
...
@@ -14,15 +14,19 @@ beforeAll(async () => {
...
@@ -14,15 +14,19 @@ beforeAll(async () => {
describe
(
'
PickerView.uvue
'
,
()
=>
{
describe
(
'
PickerView.uvue
'
,
()
=>
{
it
(
'
value
'
,
async
()
=>
{
it
(
'
value
'
,
async
()
=>
{
const
el
=
await
page
.
$
(
'
.picker-view
'
)
const
el
=
await
page
.
$
(
'
.picker-view
'
)
await
page
.
callMethod
(
'
setValue
'
)
await
page
.
callMethod
(
'
setValue
'
)
await
page
.
waitFor
(
1000
)
await
page
.
waitFor
(
1000
)
expect
(
await
el
.
property
(
'
value
'
)).
toEqual
([
0
,
0
,
0
])
expect
(
await
el
.
property
(
'
value
'
)).
toEqual
([
0
,
0
,
0
])
expect
(
await
getData
(
'
result
'
)).
toEqual
([
0
,
0
,
0
])
if
(
process
.
env
.
UNI_PLATFORM
===
'
app-android
'
)
{
expect
(
await
getData
(
'
result
'
)).
toEqual
([
0
,
0
,
0
])
}
await
page
.
callMethod
(
'
setValue1
'
)
await
page
.
callMethod
(
'
setValue1
'
)
await
page
.
waitFor
(
1000
)
await
page
.
waitFor
(
1000
)
expect
(
await
el
.
property
(
'
value
'
)).
toEqual
([
10
,
10
,
10
])
expect
(
await
el
.
property
(
'
value
'
)).
toEqual
([
10
,
10
,
10
])
expect
(
await
getData
(
'
result
'
)).
toEqual
([
10
,
10
,
10
])
if
(
process
.
env
.
UNI_PLATFORM
===
'
app-android
'
)
{
expect
(
await
getData
(
'
result
'
)).
toEqual
([
10
,
10
,
10
])
}
})
})
it
(
'
length
'
,
async
()
=>
{
it
(
'
length
'
,
async
()
=>
{
...
...
pages/component/picker-view/picker-view.uvue
浏览文件 @
f12b08cd
...
@@ -57,10 +57,7 @@
...
@@ -57,10 +57,7 @@
}
}
},
},
methods: {
methods: {
clickView() {
bindChange(e : PickerViewChangeEvent) {
},
bindChange(e : PickerViewChangeEvent) {
const val = e.detail.value
const val = e.detail.value
this.result = val
this.result = val
this.year = this.years[val[0]]
this.year = this.years[val[0]]
...
@@ -92,4 +89,4 @@
...
@@ -92,4 +89,4 @@
line-height: 50px;
line-height: 50px;
text-align: center;
text-align: center;
}
}
</style>
</style>
\ No newline at end of file
pages/component/progress/progress.test.js
浏览文件 @
f12b08cd
function
getData
(
key
=
''
)
{
function
getData
(
key
=
''
)
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
const
data
=
await
page
.
data
()
const
data
=
await
page
.
data
()
resolve
(
key
?
data
[
key
]
:
data
)
resolve
(
key
?
data
[
key
]
:
data
)
})
})
}
}
let
page
let
page
beforeAll
(
async
()
=>
{
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/component/progress/progress
'
)
page
=
await
program
.
reLaunch
(
'
/pages/component/progress/progress
'
)
await
page
.
waitFor
(
2000
);
await
page
.
waitFor
(
2000
);
})
})
describe
(
'
Progress.uvue
'
,
()
=>
{
describe
(
'
Progress.uvue
'
,
()
=>
{
it
(
'
percent
'
,
async
()
=>
{
it
(
'
percent
'
,
async
()
=>
{
await
page
.
callMethod
(
'
setProgress
'
)
await
page
.
callMethod
(
'
setProgress
'
)
await
page
.
waitFor
(
1000
);
await
page
.
waitFor
(
1000
);
const
p
=
await
page
.
$
(
'
.p
'
)
const
p
=
await
page
.
$
(
'
.p
'
)
expect
(
await
p
.
property
(
'
percent
'
)).
toEqual
(
20
)
expect
(
await
p
.
property
(
'
percent
'
)).
toEqual
(
20
)
const
p1
=
await
page
.
$
(
'
.p1
'
)
const
p1
=
await
page
.
$
(
'
.p1
'
)
expect
(
await
p1
.
property
(
'
percent
'
)).
toEqual
(
40
)
expect
(
await
p1
.
property
(
'
percent
'
)).
toEqual
(
40
)
const
p2
=
await
page
.
$
(
'
.p2
'
)
const
p2
=
await
page
.
$
(
'
.p2
'
)
expect
(
await
p2
.
property
(
'
percent
'
)).
toEqual
(
60
)
expect
(
await
p2
.
property
(
'
percent
'
)).
toEqual
(
60
)
const
p3
=
await
page
.
$
(
'
.p3
'
)
const
p3
=
await
page
.
$
(
'
.p3
'
)
expect
(
await
p3
.
property
(
'
percent
'
)).
toEqual
(
80
)
expect
(
await
p3
.
property
(
'
percent
'
)).
toEqual
(
80
)
expect
(
await
getData
(
'
curPercent
'
)).
toEqual
(
20
)
if
(
process
.
env
.
UNI_PLATFORM
===
'
app-android
'
)
{
await
page
.
callMethod
(
'
clearProgress
'
)
expect
(
await
getData
(
'
curPercent
'
)).
toEqual
(
20
)
await
page
.
waitFor
(
1000
)
}
expect
(
await
p
.
property
(
'
percent
'
)).
toEqual
(
0
)
await
page
.
callMethod
(
'
clearProgress
'
)
expect
(
await
p1
.
property
(
'
percent
'
)).
toEqual
(
0
)
await
page
.
waitFor
(
1000
)
expect
(
await
p2
.
property
(
'
percent
'
)).
toEqual
(
0
)
expect
(
await
p
.
property
(
'
percent
'
)).
toEqual
(
0
)
expect
(
await
p3
.
property
(
'
percent
'
)).
toEqual
(
0
)
expect
(
await
p1
.
property
(
'
percent
'
)).
toEqual
(
0
)
expect
(
await
getData
(
'
curPercent
'
)).
toEqual
(
0
)
expect
(
await
p2
.
property
(
'
percent
'
)).
toEqual
(
0
)
})
expect
(
await
p3
.
property
(
'
percent
'
)).
toEqual
(
0
)
it
(
'
length
'
,
async
()
=>
{
if
(
process
.
env
.
UNI_PLATFORM
===
'
app-android
'
)
{
const
elements
=
await
page
.
$$
(
'
.progress
'
)
expect
(
await
getData
(
'
curPercent
'
)).
toEqual
(
0
)
expect
(
elements
.
length
).
toBe
(
4
)
}
})
it
(
'
length
'
,
async
()
=>
{
const
elements
=
await
page
.
$$
(
'
.progress
'
)
expect
(
elements
.
length
).
toBe
(
4
)
})
it
(
'
show-info
'
,
async
()
=>
{
const
el
=
await
page
.
$
(
'
.p
'
)
expect
(
await
el
.
property
(
'
show-info
'
)).
toEqual
(
true
)
await
page
.
setData
({
showInfo
:
false
})
})
it
(
'
show-info
'
,
async
()
=>
{
expect
(
await
el
.
property
(
'
show-info
'
)).
toEqual
(
false
)
const
el
=
await
page
.
$
(
'
.p
'
)
}
)
expect
(
await
el
.
property
(
'
show-info
'
)).
toEqual
(
true
)
it
(
'
border-radius
'
,
async
()
=>
{
await
page
.
setData
({
const
el
=
await
page
.
$
(
'
.p
'
)
showInfo
:
false
expect
(
await
el
.
property
(
'
border-radius
'
)).
toEqual
(
0
)
})
await
page
.
setData
({
expect
(
await
el
.
property
(
'
show-info
'
)).
toEqual
(
false
)
borderRadius
:
5
})
})
it
(
'
border-radius
'
,
async
()
=>
{
expect
(
await
el
.
property
(
'
border-radius
'
)).
toEqual
(
5
)
const
el
=
await
page
.
$
(
'
.p
'
)
}
)
expect
(
await
el
.
property
(
'
border-radius
'
)).
toEqual
(
0
)
it
(
'
font-size
'
,
async
()
=>
{
await
page
.
setData
({
const
el
=
await
page
.
$
(
'
.p
'
)
borderRadius
:
5
expect
(
await
el
.
property
(
'
font-size
'
)).
toEqual
(
16
)
})
await
page
.
setData
({
expect
(
await
el
.
property
(
'
border-radius
'
)).
toEqual
(
5
)
fontSize
:
18
})
})
it
(
'
font-size
'
,
async
()
=>
{
expect
(
await
el
.
property
(
'
font-size
'
)).
toEqual
(
18
)
const
el
=
await
page
.
$
(
'
.p
'
)
}
)
expect
(
await
el
.
property
(
'
font-size
'
)).
toEqual
(
16
)
it
(
'
stroke-width
'
,
async
()
=>
{
await
page
.
setData
({
const
el
=
await
page
.
$
(
'
.p
'
)
fontSize
:
18
expect
(
await
el
.
property
(
'
stroke-width
'
)).
toEqual
(
3
)
})
await
page
.
setData
({
expect
(
await
el
.
property
(
'
font-size
'
)).
toEqual
(
18
)
strokeWidth
:
6
})
})
it
(
'
stroke-width
'
,
async
()
=>
{
expect
(
await
el
.
property
(
'
stroke-width
'
)).
toEqual
(
6
)
const
el
=
await
page
.
$
(
'
.p
'
)
}
)
expect
(
await
el
.
property
(
'
stroke-width
'
)).
toEqual
(
3
)
it
(
'
backgroundColor
'
,
async
()
=>
{
await
page
.
setData
({
const
el
=
await
page
.
$
(
'
.p
'
)
strokeWidth
:
6
expect
(
await
el
.
property
(
'
background-color
'
)).
toEqual
(
'
#EBEBEB
'
)
})
await
page
.
setData
({
expect
(
await
el
.
property
(
'
stroke-width
'
)).
toEqual
(
6
)
backgroundColor
:
"
#007aff
"
})
})
it
(
'
backgroundColor
'
,
async
()
=>
{
expect
(
await
el
.
property
(
'
background-color
'
)).
toEqual
(
'
#007aff
'
)
const
el
=
await
page
.
$
(
'
.p
'
)
})
expect
(
await
el
.
property
(
'
background-color
'
)).
toEqual
(
'
#EBEBEB
'
)
})
await
page
.
setData
({
\ No newline at end of file
backgroundColor
:
"
#007aff
"
})
expect
(
await
el
.
property
(
'
background-color
'
)).
toEqual
(
'
#007aff
'
)
})
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录