Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
23f469e5
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看板
提交
23f469e5
编写于
6月 30, 2023
作者:
Y
yurj26
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat(progress): add test
上级
476743b3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
102 addition
and
5 deletion
+102
-5
pages/component/progress/progress.test.js
pages/component/progress/progress.test.js
+84
-0
pages/component/progress/progress.uvue
pages/component/progress/progress.uvue
+18
-5
未找到文件。
pages/component/progress/progress.test.js
0 → 100644
浏览文件 @
23f469e5
function
getData
(
key
=
''
)
{
return
new
Promise
(
async
(
resolve
,
reject
)
=>
{
const
data
=
await
page
.
data
()
resolve
(
key
?
data
[
key
]
:
data
)
})
}
let
page
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/component/progress/progress
'
)
await
page
.
waitFor
(
1000
)
})
describe
(
'
Progress.uvue
'
,
()
=>
{
it
(
'
percent
'
,
async
()
=>
{
const
p
=
await
page
.
$
(
'
.p
'
)
const
p1
=
await
page
.
$
(
'
.p1
'
)
const
p2
=
await
page
.
$
(
'
.p2
'
)
const
p3
=
await
page
.
$
(
'
.p3
'
)
page
.
callMethod
(
'
setProgress
'
)
await
page
.
waitFor
(
1000
)
expect
(
await
p
.
property
(
'
percent
'
)).
toEqual
(
20
)
expect
(
await
p1
.
property
(
'
percent
'
)).
toEqual
(
40
)
expect
(
await
p2
.
property
(
'
percent
'
)).
toEqual
(
60
)
expect
(
await
p3
.
property
(
'
percent
'
)).
toEqual
(
80
)
expect
(
await
getData
(
'
curPercent
'
)).
toEqual
(
20
)
page
.
callMethod
(
'
clearProgress
'
)
await
page
.
waitFor
(
1000
)
expect
(
await
p
.
property
(
'
percent
'
)).
toEqual
(
0
)
expect
(
await
p1
.
property
(
'
percent
'
)).
toEqual
(
0
)
expect
(
await
p2
.
property
(
'
percent
'
)).
toEqual
(
0
)
expect
(
await
p3
.
property
(
'
percent
'
)).
toEqual
(
0
)
expect
(
await
getData
(
'
curPercent
'
)).
toEqual
(
0
)
})
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
})
await
page
.
waitFor
(
500
)
expect
(
await
el
.
property
(
'
show-info
'
)).
toEqual
(
false
)
})
it
(
'
border-radius
'
,
async
()
=>
{
const
el
=
await
page
.
$
(
'
.p
'
)
expect
(
await
el
.
property
(
'
border-radius
'
)).
toEqual
(
0
)
await
page
.
setData
({
borderRadius
:
5
})
await
page
.
waitFor
(
500
)
expect
(
await
el
.
property
(
'
border-radius
'
)).
toEqual
(
5
)
})
it
(
'
font-size
'
,
async
()
=>
{
const
el
=
await
page
.
$
(
'
.p
'
)
expect
(
await
el
.
property
(
'
font-size
'
)).
toEqual
(
16
)
await
page
.
setData
({
fontSize
:
18
})
await
page
.
waitFor
(
500
)
expect
(
await
el
.
property
(
'
font-size
'
)).
toEqual
(
18
)
})
it
(
'
stroke-width
'
,
async
()
=>
{
const
el
=
await
page
.
$
(
'
.p
'
)
expect
(
await
el
.
property
(
'
stroke-width
'
)).
toEqual
(
3
)
await
page
.
setData
({
strokeWidth
:
6
})
await
page
.
waitFor
(
500
)
expect
(
await
el
.
property
(
'
stroke-width
'
)).
toEqual
(
6
)
})
it
(
'
backgroundColor
'
,
async
()
=>
{
const
el
=
await
page
.
$
(
'
.p
'
)
expect
(
await
el
.
property
(
'
background-color
'
)).
toEqual
(
'
#EBEBEB
'
)
await
page
.
setData
({
backgroundColor
:
"
#007aff
"
})
await
page
.
waitFor
(
500
)
expect
(
await
el
.
property
(
'
background-color
'
)).
toEqual
(
'
#007aff
'
)
})
})
\ No newline at end of file
pages/component/progress/progress.uvue
浏览文件 @
23f469e5
...
...
@@ -3,16 +3,18 @@
<page-head :title="title"></page-head>
<view class="uni-padding-wrap uni-common-mt">
<view class="progress-box">
<progress :percent="pgList[0]" :show-info="true" :stroke-width="3" />
<progress :percent="pgList[0]" :active="true" :border-radius="borderRadius" :show-info="showInfo"
:font-size="fontSize" :stroke-width="strokeWidth" :background-color="backgroundColor"
class="progress p" @activeend="activeend" />
</view>
<view class="progress-box">
<progress :percent="pgList[1]" :stroke-width="3" />
<progress :percent="pgList[1]" :stroke-width="3"
class="progress p1"
/>
</view>
<view class="progress-box">
<progress :percent="pgList[2]" :stroke-width="3" />
<progress :percent="pgList[2]" :stroke-width="3"
class="progress p2"
/>
</view>
<view class="progress-box">
<progress :percent="pgList[3]" activeColor="#10AEFF" :stroke-width="3" />
<progress :percent="pgList[3]" activeColor="#10AEFF" :stroke-width="3"
class="progress p3"
/>
</view>
<view class="progress-control">
<button type="primary" @click="setProgress" class="button">设置进度</button>
...
...
@@ -26,7 +28,14 @@
data() {
return {
title: 'progress',
pgList: [0, 0, 0, 0] as number[]
pgList: [0, 0, 0, 0] as number[],
curPercent: 0,
showInfo: true,
borderRadius: 0,
fontSize: 16,
strokeWidth: 3,
backgroundColor: '#EBEBEB'
}
},
methods: {
...
...
@@ -35,6 +44,10 @@
},
clearProgress() {
this.pgList = [0, 0, 0, 0] as number[]
},
activeend(e : ProgressActiveendEvent) {
// TODO e.detail.curPercent
this.curPercent = e.curPercent
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录