Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
32372c01
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看板
提交
32372c01
编写于
6月 27, 2024
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test(input): 移除 type digit 测试
上级
83ed9254
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
424 addition
and
470 deletion
+424
-470
pages/component/input/input.test.js
pages/component/input/input.test.js
+1
-52
pages/component/input/input.uvue
pages/component/input/input.uvue
+423
-418
未找到文件。
pages/component/input/input.test.js
浏览文件 @
32372c01
...
...
@@ -210,55 +210,4 @@ describe('component-native-input', () => {
const
input2
=
await
page
.
$
(
'
#both-model-value
'
);
expect
(
await
input2
.
value
()).
toEqual
(
"
123
"
)
})
it
(
'
digit input .
'
,
async
()
=>
{
// ios 非 webview 模式规避该测试
// ios input type='digit' 输入 . 实际得到 。,只有系统软键盘才可以输入 .
if
(
isIos
&&
!
process
.
env
.
UNI_AUTOMATOR_APP_WEBVIEW
){
return
}
await
page
.
setData
({
focus
:
false
,
digitValue
:
'
1
'
})
await
program
.
pageScrollTo
(
0
)
const
digitInput
=
await
page
.
$
(
'
#uni-input-type-digit
'
)
expect
(
await
digitInput
.
value
()).
toEqual
(
'
1
'
)
if
(
isAndroid
)
{
if
(
platformInfo
.
indexOf
(
'
6
'
)
!=
-
1
&&
platformInfo
.
indexOf
(
'
x86
'
)
==
-
1
)
{
await
program
.
tap
({
x
:
200
,
y
:
850
,
})
}
else
if
(
platformInfo
.
indexOf
(
'
12
'
)
!=
-
1
)
{
await
program
.
tap
({
x
:
200
,
y
:
1500
,
})
}
else
{
await
program
.
tap
({
x
:
200
,
y
:
1200
,
})
}
}
else
if
(
isIos
)
{
await
program
.
tap
({
x
:
200
,
y
:
450
,
})
}
else
{
await
program
.
tap
({
x
:
200
,
y
:
400
,
})
}
await
page
.
waitFor
(
1000
)
await
program
.
keyboardInput
(
'
.2
'
)
await
page
.
waitFor
(
500
)
await
program
.
tap
({
x
:
0
,
y
:
0
,
})
await
page
.
waitFor
(
500
)
expect
(
await
digitInput
.
value
()).
toEqual
(
'
1.2
'
);
})
});
pages/component/input/input.uvue
浏览文件 @
32372c01
...
...
@@ -24,7 +24,7 @@
<input id="uni-input-type-number" class="uni-input" type="number" placeholder="数字输入键盘" />
</view>
<view class="input-wrapper">
<input id="uni-input-type-digit" class="uni-input" type="digit" placeholder="带小数点的数字输入键盘"
v-model="digitValue" />
<input id="uni-input-type-digit" class="uni-input" type="digit" placeholder="带小数点的数字输入键盘"
/>
</view>
<view class="input-wrapper">
<input id="uni-input-type-tel" class="uni-input" :type="inputTypeTel" placeholder="电话输入键盘" />
...
...
@@ -45,7 +45,7 @@
<text class="uni-title-text">无value设置的密码输入框</text>
</view>
<view class="input-wrapper">
<input class="uni-input" :password="true"
/>
<input class="uni-input" :password="true"
/>
</view>
</view>
...
...
@@ -72,7 +72,7 @@
<text class="uni-title-text">设置禁用输入框</text>
</view>
<view class="input-wrapper">
<input id="uni-input-disable" class="uni-input" :disabled="true"
/>
<input id="uni-input-disable" class="uni-input" :disabled="true"
/>
</view>
</view>
...
...
@@ -140,7 +140,7 @@
<text class="uni-title-text">设置输入框聚焦时光标的位置(点击生效)</text>
</view>
<view class="input-wrapper">
<input ref="input" class="uni-input" value="0123456789" :cursor="cursor" @blur="onCursorBlurChange"
/>
<input ref="input" class="uni-input" value="0123456789" :cursor="cursor" @blur="onCursorBlurChange"
/>
</view>
</view>
...
...
@@ -150,14 +150,14 @@
</view>
<view class="input-wrapper">
<input ref="input2" class="uni-input" value="0123456789" :selection-start="selectionStart"
:selection-end="selectionEnd" @blur="onSelectionBlurChange"
/>
:selection-end="selectionEnd" @blur="onSelectionBlurChange"
/>
</view>
</view>
<view>
<view class="uni-title" style="flex-direction: row;
align-items: center;">
<view class="uni-title" style="flex-direction: row;
align-items: center">
<text class="uni-title-text">设置光标颜色为红色</text>
<switch style="margin-left: 10px
;" @change="changeCursorColor" :checked="cursor_color=='red'"></switch>
<switch style="margin-left: 10px
" @change="changeCursorColor" :checked="cursor_color == 'red'"></switch>
</view>
<view class="input-wrapper">
<input id="uni-input-cursor-color" class="uni-input" :cursor-color="cursor_color" value="光标颜色" />
...
...
@@ -173,22 +173,22 @@
</view>
</view>
<view>
<view class="uni-title" style="flex-direction: row;
align-items: center;">
<view class="uni-title" style="flex-direction: row;
align-items: center">
<text class="uni-title-text">设置hold-keyboard</text>
<switch style="margin-left: 10px
;" @change="changeHoldKeyboard" :checked="holdKeyboard"></switch>
<switch style="margin-left: 10px
" @change="changeHoldKeyboard" :checked="holdKeyboard"></switch>
</view>
<view class="input-wrapper">
<input class="uni-input" :hold-keyboard="holdKeyboard" value="hold keyboard " />
</view>
</view>
<view>
<view class="uni-title">
<text class="uni-title-text">input事件</text>
<text class="uni-subtitle-text" v-if="inputEventDetail">{{inputEventDetail}}</text>
<text class="uni-subtitle-text" v-if="inputEventDetail">{{
inputEventDetail
}}</text>
</view>
<view class="input-wrapper">
<input class="uni-input" @input="onInput" />
...
...
@@ -198,7 +198,9 @@
<view>
<view class="uni-title">
<text class="uni-title-text">focus事件和blur事件</text>
<text class="uni-subtitle-text" v-if="focusAndBlurEventDetail">{{focusAndBlurEventDetail}}</text>
<text class="uni-subtitle-text" v-if="focusAndBlurEventDetail">{{
focusAndBlurEventDetail
}}</text>
</view>
<view class="input-wrapper">
<input class="uni-input" @focus="onFocus" @blur="onBlur" />
...
...
@@ -208,7 +210,9 @@
<view>
<view class="uni-title">
<text class="uni-title-text">confirm事件</text>
<text class="uni-subtitle-text" v-if="confirmEventDetail">{{confirmEventDetail}}</text>
<text class="uni-subtitle-text" v-if="confirmEventDetail">{{
confirmEventDetail
}}</text>
</view>
<view class="input-wrapper">
<input class="uni-input" @confirm="onConfirm" />
...
...
@@ -219,10 +223,11 @@
<view class="uni-title">
<text class="uni-title-text">keyboardheightchange事件</text>
<text class="uni-subtitle-text"
v-if="keyboardHeightChangeEventDetail">{{
keyboardHeightChangeEventDetail}}</text>
v-if="keyboardHeightChangeEventDetail">{{
keyboardHeightChangeEventDetail }}</text>
</view>
<view class="input-wrapper">
<input class="uni-input" @keyboardheightchange="onKeyborardHeightChange" :focus="focusedForKeyboardHeightChangeTest"/>
<input class="uni-input" @keyboardheightchange="onKeyborardHeightChange"
:focus="focusedForKeyboardHeightChangeTest" />
</view>
</view>
...
...
@@ -243,8 +248,11 @@
</view>
<view class="input-wrapper">
<input class="uni-input" placeholder="请输入密码" :password="showPassword" />
<image class="uni-icon" :src="!showPassword ? '/static/icons/eye-active.png' : '/static/icons/eye.png'"
@click="changePassword"></image>
<image class="uni-icon" :src="
!showPassword
? '/static/icons/eye-active.png'
: '/static/icons/eye.png'
" @click="changePassword"></image>
</view>
</view>
...
...
@@ -253,21 +261,19 @@
<text class="uni-title-text">同时存在 v-model 和 value</text>
</view>
<view class="input-wrapper">
<input id="both-model-value" class="uni-input" v-model='demoValue' value='456' />
<input id="both-model-value" class="uni-input" v-model="demoValue" value="456" />
</view>
</view>
<view>
<view class="uni-title" style="flex-direction: row;
align-items: center;">
<view class="uni-title" style="flex-direction: row;
align-items: center">
<text class="uni-title-text">设置adjust-position</text>
<switch style="margin-left: 10px
;" @change="changeAdjustPosition" :checked="adjustPosition"></switch>
<switch style="margin-left: 10px
" @change="changeAdjustPosition" :checked="adjustPosition"></switch>
</view>
<view class="input-wrapper">
<input class="uni-input" :adjust-position="adjustPosition"
/>
<input class="uni-input" :adjust-position="adjustPosition"
/>
</view>
</view>
</view>
<!-- #ifdef APP -->
</scroll-view>
...
...
@@ -293,7 +299,7 @@
inputPassword: true,
inputTypeTel: "tel",
inputPlaceHolderStyle: "color:red",
inputPlaceHolderClass: "uni-input-placeholder-class" as string.ClassString
,
inputPlaceHolderClass: "uni-input-placeholder-class" as string.ClassString
,
inputMaxLengthValue: "",
onMaxLengthInputValue: "",
inputMaxLengthFocus: false,
...
...
@@ -303,8 +309,7 @@
keyboardHeight: 0,
focusedForKeyboardHeightChangeTest: false,
demoValue: '123',
adjustPosition: false,
digitValue: ''
adjustPosition: false
}
},
methods: {
...
...
@@ -318,7 +323,7 @@
(this.$refs['input'] as UniInputElement).focus();
this.cursor = cursor;
},
onCursorBlurChange()
{
onCursorBlurChange()
{
this.cursor = 0
},
setSelection: function (selectionStart : number, selectionEnd : number) {
...
...
@@ -326,7 +331,7 @@
this.selectionStart = selectionStart;
this.selectionEnd = selectionEnd;
},
onSelectionBlurChange()
{
onSelectionBlurChange()
{
this.selectionEnd = 0;
},
clearInput: function (event : UniInputEvent) {
...
...
@@ -382,7 +387,7 @@
const checked = event.detail.value;
this.holdKeyboard = checked
},
changeAdjustPosition(event : UniSwitchChangeEvent)
{
changeAdjustPosition(event : UniSwitchChangeEvent)
{
const checked = event.detail.value;
this.adjustPosition = checked
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录