Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Accustomed_
hello uni-app x
提交
f6a0a744
H
hello uni-app x
项目概览
Accustomed_
/
hello uni-app x
与 Fork 源项目一致
Fork自
DCloud / hello uni-app x
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
f6a0a744
编写于
9月 23, 2023
作者:
张
张磊
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
更新input测试
上级
0ce4c494
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
43 addition
and
7 deletion
+43
-7
pages/component/input/input.test.js
pages/component/input/input.test.js
+35
-4
pages/component/input/input.uvue
pages/component/input/input.uvue
+8
-3
未找到文件。
pages/component/input/input.test.js
浏览文件 @
f6a0a744
...
...
@@ -8,25 +8,36 @@ describe('component-native-input', () => {
await
page
.
waitFor
(
3000
);
});
it
(
"
beforeAllTestScreenshot
"
,
async
()
=>
{
const
image
=
await
program
.
screenshot
({
fullPage
:
true
})
expect
(
image
).
toMatchImageSnapshot
()
})
// 测试焦点及键盘弹起
it
(
'
focus
'
,
async
()
=>
{
const
input
=
await
page
.
$
(
'
.uni-input-focus
'
);
expect
(
await
input
.
property
(
'
focus
'
)).
toBe
(
true
)
expect
(
await
page
.
data
(
"
inputFocusKeyBoardChangeValue
"
)).
toBe
(
true
)
await
page
.
setData
({
focus
:
false
,
})
expect
(
await
input
.
property
(
'
focus
'
)).
toBe
(
false
)
await
page
.
waitFor
(
1000
)
expect
(
await
page
.
data
(
"
inputFocusKeyBoardChangeValue
"
)).
toBe
(
false
)
await
page
.
setData
({
focus
:
true
,
})
expect
(
await
input
.
property
(
'
focus
'
)).
toBe
(
true
)
await
page
.
waitFor
(
1000
)
expect
(
await
page
.
data
(
"
inputFocusKeyBoardChangeValue
"
)).
toBe
(
true
)
await
page
.
setData
({
focus
:
false
,
})
expect
(
await
input
.
property
(
'
focus
'
)).
toBe
(
false
)
await
page
.
waitFor
(
3000
)
await
page
.
waitFor
(
1000
)
expect
(
await
page
.
data
(
"
inputFocusKeyBoardChangeValue
"
)).
toBe
(
false
)
await
page
.
waitFor
(
1000
)
});
// 测试修改value属性
...
...
@@ -53,8 +64,13 @@ describe('component-native-input', () => {
expect
(
await
input
.
property
(
'
password
'
)).
toBe
(
true
)
await
page
.
setData
({
inputPassword
:
false
,
inputPasswordValue
:
"
inputPasswordValue
"
})
expect
(
await
input
.
property
(
'
password
'
)).
toBe
(
false
)
await
page
.
waitFor
(
500
)
await
page
.
setData
({
inputPassword
:
true
})
})
// 测试placeholder
it
(
"
placeholder
"
,
async
()
=>
{
...
...
@@ -79,12 +95,12 @@ describe('component-native-input', () => {
})
await
page
.
setData
({
inputPlaceHolderStyle
:
"
color:#CC19CC;background-color:#00b1c0;text-align:center;font-size:
100
px;font-weight:900
"
,
inputPlaceHolderStyle
:
"
color:#CC19CC;background-color:#00b1c0;text-align:center;font-size:
44
px;font-weight:900
"
,
})
expect
(
await
placeholder1
.
property
(
"
placeholder-style
"
)).
toEqual
({
"
backgroundColor
"
:
"
#00b1c0
"
,
"
color
"
:
"
#CC19CC
"
,
"
fontSize
"
:
"
100
px
"
,
"
fontSize
"
:
"
44
px
"
,
"
fontWeight
"
:
"
900
"
,
"
textAlign
"
:
"
center
"
})
...
...
@@ -114,4 +130,19 @@ describe('component-native-input', () => {
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
it
(
"
maxlength
"
,
async
()
=>
{
const
input
=
await
page
.
$
(
'
.uni-input-maxlength
'
);
await
page
.
setData
({
inputMaxLengthValue
:
"
uni-input-maxlength
"
})
await
page
.
waitFor
(
500
)
})
it
(
"
afterAllTestScreenshot
"
,
async
()
=>
{
const
image
=
await
program
.
screenshot
({
fullPage
:
true
})
expect
(
image
).
toMatchImageSnapshot
()
})
});
pages/component/input/input.uvue
浏览文件 @
f6a0a744
...
...
@@ -36,7 +36,7 @@
<text class="uni-title-text">密码输入框</text>
</view>
<view class="uni-input-wrapper">
<input class="uni-input uni-input-password" :password="inputPassword" />
<input class="uni-input uni-input-password" :password="inputPassword"
:value="inputPasswordValue"
/>
</view>
</view>
...
...
@@ -84,7 +84,7 @@
<text class="uni-title-text">自动获取焦点</text>
</view>
<view class="uni-input-wrapper">
<input class="uni-input uni-input-focus" :focus="focus"/>
<input class="uni-input uni-input-focus" :focus="focus"
@keyboardheightchange="inputFocusKeyBoardChange"
/>
</view>
</view>
...
...
@@ -232,10 +232,15 @@
inputPlaceHolderClass: "uni-input-placeholder-class",
inputMaxLengthValue:"",
onMaxLengthInputValue:"",
inputMaxLengthFocus:false
inputMaxLengthFocus:false,
inputPasswordValue:"",
inputFocusKeyBoardChangeValue:true
}
},
methods: {
inputFocusKeyBoardChange(e:InputKeyboardHeightChangeEvent) {
this.inputFocusKeyBoardChangeValue = e.detail.height > 50
},
onMaxLengthInput(event:InputEvent) {
this.onMaxLengthInputValue = event.detail.value
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录