Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
343b6fd2
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6006
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看板
提交
343b6fd2
编写于
7月 31, 2023
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: recovery component test
上级
6a2f77d5
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
230 addition
and
231 deletion
+230
-231
pages/component/button/button.test.js
pages/component/button/button.test.js
+63
-64
pages/component/checkbox/checkbox.test.js
pages/component/checkbox/checkbox.test.js
+61
-61
pages/component/picker-view/picker-view.test.js
pages/component/picker-view/picker-view.test.js
+47
-47
pages/component/radio/radio.test.js
pages/component/radio/radio.test.js
+59
-59
未找到文件。
pages/component/button/button.test.js
浏览文件 @
343b6fd2
...
...
@@ -25,25 +25,24 @@ describe('Button.uvue', () => {
const
elements
=
await
page
.
$$
(
'
.button
'
)
expect
(
elements
.
length
).
toBe
(
13
)
})
// it('text', async () => {
// const textBtn = await page.$('.text-button')
// expect(await textBtn.text()).toEqual('按钮')
// await page.setData({
// text: 'button'
// })
// // TODO 待修复
// expect(await textBtn.text()).toEqual('button')
// })
it
(
'
text
'
,
async
()
=>
{
const
textBtn
=
await
page
.
$
(
'
.text-button
'
)
expect
(
await
textBtn
.
text
()).
toEqual
(
'
按钮
'
)
await
page
.
setData
({
text
:
'
button
'
,
})
expect
(
await
textBtn
.
text
()).
toEqual
(
'
button
'
)
})
it
(
'
type
'
,
async
()
=>
{
const
btn
=
await
page
.
$
(
'
.test-button
'
)
expect
(
await
btn
.
property
(
'
type
'
)).
toBe
(
'
primary
'
)
await
page
.
setData
({
type
:
'
default
'
type
:
'
default
'
,
})
await
page
.
waitFor
(
500
)
expect
(
await
btn
.
property
(
'
type
'
)).
toBe
(
'
default
'
)
await
page
.
setData
({
type
:
'
warn
'
type
:
'
warn
'
,
})
await
page
.
waitFor
(
500
)
expect
(
await
btn
.
property
(
'
type
'
)).
toBe
(
'
warn
'
)
...
...
@@ -52,7 +51,7 @@ describe('Button.uvue', () => {
const
btn
=
await
page
.
$
(
'
.test-button
'
)
expect
(
await
btn
.
property
(
'
size
'
)).
toBe
(
'
default
'
)
await
page
.
setData
({
size
:
'
mini
'
size
:
'
mini
'
,
})
await
page
.
waitFor
(
500
)
expect
(
await
btn
.
property
(
'
size
'
)).
toBe
(
'
mini
'
)
...
...
@@ -61,7 +60,7 @@ describe('Button.uvue', () => {
const
btn
=
await
page
.
$
(
'
.test-button
'
)
expect
(
await
btn
.
property
(
'
plain
'
)).
toBe
(
false
)
await
page
.
setData
({
plain
:
true
plain
:
true
,
})
await
page
.
waitFor
(
500
)
expect
(
await
btn
.
property
(
'
plain
'
)).
toBe
(
true
)
...
...
@@ -70,7 +69,7 @@ describe('Button.uvue', () => {
const
btn
=
await
page
.
$
(
'
.test-button
'
)
expect
(
await
btn
.
property
(
'
disabled
'
)).
toBe
(
false
)
await
page
.
setData
({
disabled
:
true
disabled
:
true
,
})
await
page
.
waitFor
(
500
)
expect
(
await
btn
.
property
(
'
disabled
'
)).
toBe
(
true
)
...
...
pages/component/checkbox/checkbox.test.js
浏览文件 @
343b6fd2
...
...
@@ -12,59 +12,59 @@ beforeAll(async () => {
})
describe
(
'
Checkbox.uvue
'
,
()
=>
{
//
it('change', async () => {
//
const cb = await page.$('.cb')
//
const cb1 = await page.$('.cb1')
//
const cb2 = await page.$('.cb2')
//
expect(await getData('value')).toEqual([])
//
await cb1.tap()
// expect(await getData('value')).toEqual(["cb", "cb1"
])
//
await cb.tap()
// expect(await getData('value')).toEqual(["cb1"
])
//
await cb2.tap()
// expect(await getData('value')).toEqual(["cb1"])
// await cb1.tap()
//
expect(await getData('value')).toEqual([])
//
})
it
(
'
change
'
,
async
()
=>
{
const
cb
=
await
page
.
$
(
'
.cb
'
)
const
cb1
=
await
page
.
$
(
'
.cb1
'
)
const
cb2
=
await
page
.
$
(
'
.cb2
'
)
expect
(
await
getData
(
'
value
'
)).
toEqual
([])
await
cb1
.
tap
()
expect
(
await
getData
(
'
value
'
)).
toEqual
([
'
cb
'
,
'
cb1
'
])
await
cb
.
tap
()
expect
(
await
getData
(
'
value
'
)).
toEqual
([
'
cb1
'
])
await
cb2
.
tap
()
expect
(
await
getData
(
'
value
'
)).
toEqual
([
'
cb1
'
])
await
cb1
.
tap
()
expect
(
await
getData
(
'
value
'
)).
toEqual
([])
})
it
(
'
length
'
,
async
()
=>
{
const
checkboxGroupElements
=
await
page
.
$$
(
'
.checkbox-group
'
)
expect
(
checkboxGroupElements
.
length
).
toBe
(
3
)
const
checkboxElements
=
await
page
.
$$
(
'
.checkbox
'
)
expect
(
checkboxElements
.
length
).
toBe
(
11
)
})
//
it('text', async () => {
//
const cb = await page.$('.cb1')
//
expect(await cb.text()).toEqual('未选中')
//
await page.setData({
// text: 'not selected'
//
})
//
expect(await cb.text()).toEqual('not selected')
//
})
//
it('checked', async () => {
//
const cb = await page.$('.cb')
//
expect(await cb.property('checked')).toBe(true)
//
await page.setData({
// checked: false
//
})
//
await page.waitFor(500)
//
expect(await cb.property('checked')).toBe(false)
//
})
//
it('color', async () => {
//
const cb = await page.$('.cb')
//
expect(await cb.property('color')).toBe('#007aff')
//
await page.setData({
// color: '#63acfc'
//
})
//
await page.waitFor(500)
//
expect(await cb.property('color')).toBe('#63acfc')
//
})
//
it('disabled', async () => {
//
const cb = await page.$('.cb2')
//
expect(await cb.property('disabled')).toBe(true)
//
await page.setData({
// disabled: false
//
})
//
await page.waitFor(500)
//
expect(await cb.property('disabled')).toBe(false)
//
})
it
(
'
text
'
,
async
()
=>
{
const
cb
=
await
page
.
$
(
'
.cb1
'
)
expect
(
await
cb
.
text
()).
toEqual
(
'
未选中
'
)
await
page
.
setData
({
text
:
'
not selected
'
,
})
expect
(
await
cb
.
text
()).
toEqual
(
'
not selected
'
)
})
it
(
'
checked
'
,
async
()
=>
{
const
cb
=
await
page
.
$
(
'
.cb
'
)
expect
(
await
cb
.
property
(
'
checked
'
)).
toBe
(
true
)
await
page
.
setData
({
checked
:
false
,
})
await
page
.
waitFor
(
500
)
expect
(
await
cb
.
property
(
'
checked
'
)).
toBe
(
false
)
})
it
(
'
color
'
,
async
()
=>
{
const
cb
=
await
page
.
$
(
'
.cb
'
)
expect
(
await
cb
.
property
(
'
color
'
)).
toBe
(
'
#007aff
'
)
await
page
.
setData
({
color
:
'
#63acfc
'
,
})
await
page
.
waitFor
(
500
)
expect
(
await
cb
.
property
(
'
color
'
)).
toBe
(
'
#63acfc
'
)
})
it
(
'
disabled
'
,
async
()
=>
{
const
cb
=
await
page
.
$
(
'
.cb2
'
)
expect
(
await
cb
.
property
(
'
disabled
'
)).
toBe
(
true
)
await
page
.
setData
({
disabled
:
false
,
})
await
page
.
waitFor
(
500
)
expect
(
await
cb
.
property
(
'
disabled
'
)).
toBe
(
false
)
})
})
pages/component/picker-view/picker-view.test.js
浏览文件 @
343b6fd2
...
...
@@ -12,18 +12,18 @@ beforeAll(async () => {
})
describe
(
'
PickerView.uvue
'
,
()
=>
{
//
it('value', async () => {
//
const el = await page.$('.picker-view')
//
await page.callMethod('setValue')
//
await page.waitFor(1000)
//
expect(await el.property('value')).toEqual([0, 0, 0])
//
expect(await getData('result')).toEqual([0, 0, 0])
it
(
'
value
'
,
async
()
=>
{
const
el
=
await
page
.
$
(
'
.picker-view
'
)
await
page
.
callMethod
(
'
setValue
'
)
await
page
.
waitFor
(
1000
)
expect
(
await
el
.
property
(
'
value
'
)).
toEqual
([
0
,
0
,
0
])
expect
(
await
getData
(
'
result
'
)).
toEqual
([
0
,
0
,
0
])
//
await page.callMethod('setValue1')
//
await page.waitFor(1000)
//
expect(await el.property('value')).toEqual([10, 10, 10])
//
expect(await getData('result')).toEqual([10, 10, 10])
//
})
await
page
.
callMethod
(
'
setValue1
'
)
await
page
.
waitFor
(
1000
)
expect
(
await
el
.
property
(
'
value
'
)).
toEqual
([
10
,
10
,
10
])
expect
(
await
getData
(
'
result
'
)).
toEqual
([
10
,
10
,
10
])
})
it
(
'
length
'
,
async
()
=>
{
const
els
=
await
page
.
$$
(
'
.picker-view
'
)
...
...
@@ -31,28 +31,28 @@ describe('PickerView.uvue', () => {
const
els1
=
await
page
.
$$
(
'
.picker-view-column
'
)
expect
(
els1
.
length
).
toBe
(
3
)
})
//
it('indicator-style', async () => {
//
const el = await page.$('.picker-view')
//
await page.setData({
// indicatorStyle: 'height: 100px;'
//
})
// await page.waitFor(500)
//
expect(await el.property('indicatorStyle')).toBe('height: 100px;')
// })
// it('mask-top-style', async () => {
// const el = await page.$('.picker-view')
// await page.setData({
// maskTopStyle: 'background: #ffffff;'
// })
// await page.waitFor(500)
// expect(await el.property('mask-top-style')).toBe('background: #ffffff;')
// })
// it('mask-bottom-style', async () => {
// const el = await page.$('.picker-view')
// await page.setData({
// maskBottomStyle: 'background: #ffffff;'
// })
// await page.waitFor(500)
// expect(await el.property('mask-bottom-style')).toBe('background: #ffffff;')
//
})
it
(
'
indicator-style
'
,
async
()
=>
{
const
el
=
await
page
.
$
(
'
.picker-view
'
)
await
page
.
setData
({
indicatorStyle
:
'
height: 100px;
'
,
})
await
page
.
waitFor
(
500
)
expect
(
await
el
.
property
(
'
indicatorStyle
'
)).
toBe
(
'
height: 100px;
'
)
})
it
(
'
mask-top-style
'
,
async
()
=>
{
const
el
=
await
page
.
$
(
'
.picker-view
'
)
await
page
.
setData
({
maskTopStyle
:
'
background: #ffffff;
'
,
})
await
page
.
waitFor
(
500
)
expect
(
await
el
.
property
(
'
mask-top-style
'
)).
toBe
(
'
background: #ffffff;
'
)
})
it
(
'
mask-bottom-style
'
,
async
()
=>
{
const
el
=
await
page
.
$
(
'
.picker-view
'
)
await
page
.
setData
({
maskBottomStyle
:
'
background: #ffffff;
'
,
})
await
page
.
waitFor
(
500
)
expect
(
await
el
.
property
(
'
mask-bottom-style
'
)).
toBe
(
'
background: #ffffff;
'
)
})
})
pages/component/radio/radio.test.js
浏览文件 @
343b6fd2
...
...
@@ -12,57 +12,57 @@ beforeAll(async () => {
})
describe
(
'
Radio.uvue
'
,
()
=>
{
//
it('change', async () => {
//
const radio = await page.$('.r')
//
const radio1 = await page.$('.r1')
//
const radio2 = await page.$('.r2')
// expect(await getData('value')).toEqual(""
)
//
await radio1.tap()
// expect(await getData('value')).toEqual("r1"
)
//
await radio.tap()
// expect(await getData('value')).toEqual("r"
)
//
await radio2.tap()
// expect(await getData('value')).toEqual("r"
)
//
})
it
(
'
change
'
,
async
()
=>
{
const
radio
=
await
page
.
$
(
'
.r
'
)
const
radio1
=
await
page
.
$
(
'
.r1
'
)
const
radio2
=
await
page
.
$
(
'
.r2
'
)
expect
(
await
getData
(
'
value
'
)).
toEqual
(
''
)
await
radio1
.
tap
()
expect
(
await
getData
(
'
value
'
)).
toEqual
(
'
r1
'
)
await
radio
.
tap
()
expect
(
await
getData
(
'
value
'
)).
toEqual
(
'
r
'
)
await
radio2
.
tap
()
expect
(
await
getData
(
'
value
'
)).
toEqual
(
'
r
'
)
})
it
(
'
length
'
,
async
()
=>
{
const
radioGroupElements
=
await
page
.
$$
(
'
.radio-group
'
)
expect
(
radioGroupElements
.
length
).
toBe
(
3
)
const
radioElements
=
await
page
.
$$
(
'
.radio
'
)
expect
(
radioElements
.
length
).
toBe
(
11
)
})
//
it('text', async () => {
//
const radio = await page.$('.r1')
//
expect(await radio.text()).toEqual('未选中')
//
await page.setData({
// text: 'not selected'
//
})
//
expect(await radio.text()).toEqual('not selected')
//
})
//
it('checked', async () => {
//
const radio = await page.$('.r')
//
expect(await radio.property('checked')).toBe(true)
//
await page.setData({
// checked: false
//
})
//
await page.waitFor(500)
//
expect(await radio.property('checked')).toBe(false)
//
})
//
it('color', async () => {
//
const radio = await page.$('.r')
//
expect(await radio.property('color')).toBe('#007aff')
//
await page.setData({
// color: '#63acfc'
//
})
//
await page.waitFor(500)
//
expect(await radio.property('color')).toBe('#63acfc')
//
})
//
it('disabled', async () => {
//
const radio = await page.$('.r2')
//
expect(await radio.property('disabled')).toBe(true)
//
await page.setData({
// disabled: false
//
})
//
await page.waitFor(500)
//
expect(await radio.property('disabled')).toBe(false)
//
})
it
(
'
text
'
,
async
()
=>
{
const
radio
=
await
page
.
$
(
'
.r1
'
)
expect
(
await
radio
.
text
()).
toEqual
(
'
未选中
'
)
await
page
.
setData
({
text
:
'
not selected
'
,
})
expect
(
await
radio
.
text
()).
toEqual
(
'
not selected
'
)
})
it
(
'
checked
'
,
async
()
=>
{
const
radio
=
await
page
.
$
(
'
.r
'
)
expect
(
await
radio
.
property
(
'
checked
'
)).
toBe
(
true
)
await
page
.
setData
({
checked
:
false
,
})
await
page
.
waitFor
(
500
)
expect
(
await
radio
.
property
(
'
checked
'
)).
toBe
(
false
)
})
it
(
'
color
'
,
async
()
=>
{
const
radio
=
await
page
.
$
(
'
.r
'
)
expect
(
await
radio
.
property
(
'
color
'
)).
toBe
(
'
#007aff
'
)
await
page
.
setData
({
color
:
'
#63acfc
'
,
})
await
page
.
waitFor
(
500
)
expect
(
await
radio
.
property
(
'
color
'
)).
toBe
(
'
#63acfc
'
)
})
it
(
'
disabled
'
,
async
()
=>
{
const
radio
=
await
page
.
$
(
'
.r2
'
)
expect
(
await
radio
.
property
(
'
disabled
'
)).
toBe
(
true
)
await
page
.
setData
({
disabled
:
false
,
})
await
page
.
waitFor
(
500
)
expect
(
await
radio
.
property
(
'
disabled
'
)).
toBe
(
false
)
})
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录