Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
ab56e4e2
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看板
提交
ab56e4e2
编写于
9月 21, 2023
作者:
张
张磊
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add input.test.js
上级
0e1fe442
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
413 addition
and
283 deletion
+413
-283
pages/component/input/input.test.js
pages/component/input/input.test.js
+117
-0
pages/component/input/input.uvue
pages/component/input/input.uvue
+296
-283
未找到文件。
pages/component/input/input.test.js
0 → 100644
浏览文件 @
ab56e4e2
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe
(
'
component-native-input
'
,
()
=>
{
let
page
;
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/component/input/input
'
)
await
page
.
waitFor
(
3000
);
});
// 测试焦点及键盘弹起
it
(
'
focus
'
,
async
()
=>
{
const
input
=
await
page
.
$
(
'
.uni-input-focus
'
);
expect
(
await
input
.
property
(
'
focus
'
)).
toBe
(
true
)
await
page
.
setData
({
focus
:
false
,
})
expect
(
await
input
.
property
(
'
focus
'
)).
toBe
(
false
)
await
page
.
waitFor
(
1000
)
await
page
.
setData
({
focus
:
true
,
})
expect
(
await
input
.
property
(
'
focus
'
)).
toBe
(
true
)
await
page
.
waitFor
(
1000
)
await
page
.
setData
({
focus
:
false
,
})
expect
(
await
input
.
property
(
'
focus
'
)).
toBe
(
false
)
await
page
.
waitFor
(
3000
)
});
// 测试修改value属性
it
(
"
value
"
,
async
()
=>
{
const
input
=
await
page
.
$
(
'
.uni-input-default
'
);
expect
(
await
input
.
property
(
'
value
'
)).
toEqual
(
"
hello uni-app x
"
)
})
//测试input的类型
it
(
"
type
"
,
async
()
=>
{
const
text
=
await
page
.
$
(
'
.uni-input-type-text
'
);
const
number
=
await
page
.
$
(
'
.uni-input-type-number
'
);
const
digit
=
await
page
.
$
(
'
.uni-input-type-digit
'
);
const
tel
=
await
page
.
$
(
'
.uni-input-type-tel
'
);
expect
(
await
text
.
property
(
'
type
'
)).
toEqual
(
"
text
"
)
expect
(
await
number
.
property
(
'
type
'
)).
toEqual
(
"
number
"
)
expect
(
await
digit
.
property
(
'
type
'
)).
toEqual
(
"
digit
"
)
expect
(
await
tel
.
property
(
'
type
'
)).
toEqual
(
"
tel
"
)
})
// 测试密码属性
it
(
"
password
"
,
async
()
=>
{
const
input
=
await
page
.
$
(
'
.uni-input-password
'
);
expect
(
await
input
.
property
(
'
password
'
)).
toBe
(
true
)
await
page
.
setData
({
inputPassword
:
false
,
})
expect
(
await
input
.
property
(
'
password
'
)).
toBe
(
false
)
})
// 测试placeholder
it
(
"
placeholder
"
,
async
()
=>
{
const
placeholder1
=
await
page
.
$
(
'
.uni-input-placeholder1
'
);
expect
(
await
placeholder1
.
property
(
"
placeholder-style
"
)).
toMatchObject
({
"
color
"
:
"
red
"
})
expect
(
await
placeholder1
.
property
(
"
placeholder
"
)).
toEqual
(
"
占位符文字颜色为红色
"
)
await
page
.
setData
({
inputPlaceHolderStyle
:
"
color:#CC00CC
"
,
})
expect
(
await
placeholder1
.
property
(
"
placeholder-style
"
)).
toMatchObject
({
"
color
"
:
"
#CC00CC
"
})
await
page
.
setData
({
inputPlaceHolderStyle
:
"
color:#CC19CC;background-color:#00b1c0
"
,
})
expect
(
await
placeholder1
.
property
(
"
placeholder-style
"
)).
toMatchObject
({
"
color
"
:
"
#CC19CC
"
,
"
backgroundColor
"
:
"
#00b1c0
"
})
await
page
.
setData
({
inputPlaceHolderStyle
:
"
color:#CC19CC;background-color:#00b1c0;text-align:center;font-size:100px;font-weight:900
"
,
})
expect
(
await
placeholder1
.
property
(
"
placeholder-style
"
)).
toEqual
({
"
backgroundColor
"
:
"
#00b1c0
"
,
"
color
"
:
"
#CC19CC
"
,
"
fontSize
"
:
"
100px
"
,
"
fontWeight
"
:
"
900
"
,
"
textAlign
"
:
"
center
"
})
const
placeholder2
=
await
page
.
$
(
'
.uni-input-placeholder2
'
);
expect
(
await
placeholder2
.
property
(
"
placeholder-class
"
)).
toMatchObject
({
"
backgroundColor
"
:
"
#008000
"
})
await
page
.
setData
({
inputPlaceHolderClass
:
"
uni-input-placeholder-class-ts
"
,
})
expect
(
await
placeholder2
.
property
(
"
placeholder-class
"
)).
toMatchObject
({
"
backgroundColor
"
:
"
#FFA500
"
})
expect
(
await
placeholder2
.
property
(
"
placeholder
"
)).
toEqual
(
"
占位符背景色为绿色
"
)
})
it
(
"
disable
"
,
async
()
=>
{
const
input
=
await
page
.
$
(
'
.uni-input-disable
'
);
expect
(
await
input
.
property
(
"
disabled
"
)).
toBe
(
true
)
})
it
(
"
confirm-type
"
,
async
()
=>
{
expect
(
await
(
await
page
.
$
(
'
.uni-input-confirm-send
'
)).
property
(
"
confirmType
"
)).
toEqual
(
"
send
"
)
expect
(
await
(
await
page
.
$
(
'
.uni-input-confirm-search
'
)).
property
(
"
confirmType
"
)).
toEqual
(
"
search
"
)
expect
(
await
(
await
page
.
$
(
'
.uni-input-confirm-next
'
)).
property
(
"
confirmType
"
)).
toEqual
(
"
next
"
)
expect
(
await
(
await
page
.
$
(
'
.uni-input-confirm-go
'
)).
property
(
"
confirmType
"
)).
toEqual
(
"
go
"
)
expect
(
await
(
await
page
.
$
(
'
.uni-input-confirm-done
'
)).
property
(
"
confirmType
"
)).
toEqual
(
"
done
"
)
})
});
\ No newline at end of file
pages/component/input/input.uvue
浏览文件 @
ab56e4e2
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录