提交 32372c01 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

test(input): 移除 type digit 测试

上级 83ed9254
...@@ -210,55 +210,4 @@ describe('component-native-input', () => { ...@@ -210,55 +210,4 @@ describe('component-native-input', () => {
const input2 = await page.$('#both-model-value'); const input2 = await page.$('#both-model-value');
expect(await input2.value()).toEqual("123") 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');
})
}); });
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
<input id="uni-input-type-number" class="uni-input" type="number" placeholder="数字输入键盘" /> <input id="uni-input-type-number" class="uni-input" type="number" placeholder="数字输入键盘" />
</view> </view>
<view class="input-wrapper"> <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>
<view class="input-wrapper"> <view class="input-wrapper">
<input id="uni-input-type-tel" class="uni-input" :type="inputTypeTel" placeholder="电话输入键盘" /> <input id="uni-input-type-tel" class="uni-input" :type="inputTypeTel" placeholder="电话输入键盘" />
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
<text class="uni-title-text">无value设置的密码输入框</text> <text class="uni-title-text">无value设置的密码输入框</text>
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input class="uni-input" :password="true"/> <input class="uni-input" :password="true" />
</view> </view>
</view> </view>
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
<text class="uni-title-text">设置禁用输入框</text> <text class="uni-title-text">设置禁用输入框</text>
</view> </view>
<view class="input-wrapper"> <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>
</view> </view>
...@@ -140,7 +140,7 @@ ...@@ -140,7 +140,7 @@
<text class="uni-title-text">设置输入框聚焦时光标的位置(点击生效)</text> <text class="uni-title-text">设置输入框聚焦时光标的位置(点击生效)</text>
</view> </view>
<view class="input-wrapper"> <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>
</view> </view>
...@@ -150,14 +150,14 @@ ...@@ -150,14 +150,14 @@
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input ref="input2" class="uni-input" value="0123456789" :selection-start="selectionStart" <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>
<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> <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>
<view class="input-wrapper"> <view class="input-wrapper">
<input id="uni-input-cursor-color" class="uni-input" :cursor-color="cursor_color" value="光标颜色" /> <input id="uni-input-cursor-color" class="uni-input" :cursor-color="cursor_color" value="光标颜色" />
...@@ -173,22 +173,22 @@ ...@@ -173,22 +173,22 @@
</view> </view>
</view> </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> <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>
<view class="input-wrapper"> <view class="input-wrapper">
<input class="uni-input" :hold-keyboard="holdKeyboard" value="hold keyboard " /> <input class="uni-input" :hold-keyboard="holdKeyboard" value="hold keyboard " />
</view> </view>
</view> </view>
<view> <view>
<view class="uni-title"> <view class="uni-title">
<text class="uni-title-text">input事件</text> <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>
<view class="input-wrapper"> <view class="input-wrapper">
<input class="uni-input" @input="onInput" /> <input class="uni-input" @input="onInput" />
...@@ -198,7 +198,9 @@ ...@@ -198,7 +198,9 @@
<view> <view>
<view class="uni-title"> <view class="uni-title">
<text class="uni-title-text">focus事件和blur事件</text> <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>
<view class="input-wrapper"> <view class="input-wrapper">
<input class="uni-input" @focus="onFocus" @blur="onBlur" /> <input class="uni-input" @focus="onFocus" @blur="onBlur" />
...@@ -208,7 +210,9 @@ ...@@ -208,7 +210,9 @@
<view> <view>
<view class="uni-title"> <view class="uni-title">
<text class="uni-title-text">confirm事件</text> <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>
<view class="input-wrapper"> <view class="input-wrapper">
<input class="uni-input" @confirm="onConfirm" /> <input class="uni-input" @confirm="onConfirm" />
...@@ -219,10 +223,11 @@ ...@@ -219,10 +223,11 @@
<view class="uni-title"> <view class="uni-title">
<text class="uni-title-text">keyboardheightchange事件</text> <text class="uni-title-text">keyboardheightchange事件</text>
<text class="uni-subtitle-text" <text class="uni-subtitle-text"
v-if="keyboardHeightChangeEventDetail">{{keyboardHeightChangeEventDetail}}</text> v-if="keyboardHeightChangeEventDetail">{{ keyboardHeightChangeEventDetail }}</text>
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input class="uni-input" @keyboardheightchange="onKeyborardHeightChange" :focus="focusedForKeyboardHeightChangeTest"/> <input class="uni-input" @keyboardheightchange="onKeyborardHeightChange"
:focus="focusedForKeyboardHeightChangeTest" />
</view> </view>
</view> </view>
...@@ -243,8 +248,11 @@ ...@@ -243,8 +248,11 @@
</view> </view>
<view class="input-wrapper"> <view class="input-wrapper">
<input class="uni-input" placeholder="请输入密码" :password="showPassword" /> <input class="uni-input" placeholder="请输入密码" :password="showPassword" />
<image class="uni-icon" :src="!showPassword ? '/static/icons/eye-active.png' : '/static/icons/eye.png'" <image class="uni-icon" :src="
@click="changePassword"></image> !showPassword
? '/static/icons/eye-active.png'
: '/static/icons/eye.png'
" @click="changePassword"></image>
</view> </view>
</view> </view>
...@@ -253,21 +261,19 @@ ...@@ -253,21 +261,19 @@
<text class="uni-title-text">同时存在 v-model 和 value</text> <text class="uni-title-text">同时存在 v-model 和 value</text>
</view> </view>
<view class="input-wrapper"> <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>
<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> <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>
<view class="input-wrapper"> <view class="input-wrapper">
<input class="uni-input" :adjust-position="adjustPosition"/> <input class="uni-input" :adjust-position="adjustPosition" />
</view> </view>
</view> </view>
</view> </view>
<!-- #ifdef APP --> <!-- #ifdef APP -->
</scroll-view> </scroll-view>
...@@ -293,7 +299,7 @@ ...@@ -293,7 +299,7 @@
inputPassword: true, inputPassword: true,
inputTypeTel: "tel", inputTypeTel: "tel",
inputPlaceHolderStyle: "color:red", inputPlaceHolderStyle: "color:red",
inputPlaceHolderClass: "uni-input-placeholder-class" as string.ClassString , inputPlaceHolderClass: "uni-input-placeholder-class" as string.ClassString,
inputMaxLengthValue: "", inputMaxLengthValue: "",
onMaxLengthInputValue: "", onMaxLengthInputValue: "",
inputMaxLengthFocus: false, inputMaxLengthFocus: false,
...@@ -303,8 +309,7 @@ ...@@ -303,8 +309,7 @@
keyboardHeight: 0, keyboardHeight: 0,
focusedForKeyboardHeightChangeTest: false, focusedForKeyboardHeightChangeTest: false,
demoValue: '123', demoValue: '123',
adjustPosition: false, adjustPosition: false
digitValue: ''
} }
}, },
methods: { methods: {
...@@ -318,7 +323,7 @@ ...@@ -318,7 +323,7 @@
(this.$refs['input'] as UniInputElement).focus(); (this.$refs['input'] as UniInputElement).focus();
this.cursor = cursor; this.cursor = cursor;
}, },
onCursorBlurChange(){ onCursorBlurChange() {
this.cursor = 0 this.cursor = 0
}, },
setSelection: function (selectionStart : number, selectionEnd : number) { setSelection: function (selectionStart : number, selectionEnd : number) {
...@@ -326,7 +331,7 @@ ...@@ -326,7 +331,7 @@
this.selectionStart = selectionStart; this.selectionStart = selectionStart;
this.selectionEnd = selectionEnd; this.selectionEnd = selectionEnd;
}, },
onSelectionBlurChange(){ onSelectionBlurChange() {
this.selectionEnd = 0; this.selectionEnd = 0;
}, },
clearInput: function (event : UniInputEvent) { clearInput: function (event : UniInputEvent) {
...@@ -382,7 +387,7 @@ ...@@ -382,7 +387,7 @@
const checked = event.detail.value; const checked = event.detail.value;
this.holdKeyboard = checked this.holdKeyboard = checked
}, },
changeAdjustPosition(event : UniSwitchChangeEvent){ changeAdjustPosition(event : UniSwitchChangeEvent) {
const checked = event.detail.value; const checked = event.detail.value;
this.adjustPosition = checked this.adjustPosition = checked
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册