提交 eb6cb318 编写于 作者: taohebin@dcloud.io's avatar taohebin@dcloud.io

test: input增加自动化测试例

上级 b1c6cee3
...@@ -1312,6 +1312,13 @@ ...@@ -1312,6 +1312,13 @@
{ {
"navigationBarTitleText" : "overflow-visible-event" "navigationBarTitleText" : "overflow-visible-event"
} }
},
{
"path" : "pages/component/input/blank-for-test",
"style" :
{
"navigationBarTitleText" : "测试空白页面"
}
} }
], ],
"globalStyle": { "globalStyle": {
......
<template>
<view style="justify-content: center;align-items: center;">
<text>测试空白页面</text>
</view>
</template>
<script>
export default {
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>
...@@ -172,6 +172,26 @@ describe('component-native-input', () => { ...@@ -172,6 +172,26 @@ describe('component-native-input', () => {
}) })
}) })
it("keyboard height changed after page back", async () => {
await program.navigateTo("/pages/component/input/blank-for-test")
await page.waitFor(2000);
await program.navigateBack()
await page.waitFor(1000);
await page.setData({
focusedForKeyboardHeightChangeTest: true
})
await page.waitFor(500);
const keyboardHeight = await page.data('keyboardHeight');
console.log("keyboardHeight :", keyboardHeight);
expect(keyboardHeight).toBeGreaterThan(25)
//reset
await page.setData({
focusedForKeyboardHeightChangeTest: false,
keyboardHeight:0
})
})
it("afterAllTestScreenshot", async () => { it("afterAllTestScreenshot", async () => {
const image = await program.screenshot({ const image = await program.screenshot({
fullPage: true fullPage: true
......
...@@ -213,7 +213,7 @@ ...@@ -213,7 +213,7 @@
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" /> <input class="uni-input" @keyboardheightchange="onKeyborardHeightChange" :focus="focusedForKeyboardHeightChangeTest"/>
</view> </view>
</view> </view>
...@@ -270,6 +270,8 @@ ...@@ -270,6 +270,8 @@
inputPasswordValue: "cipher", inputPasswordValue: "cipher",
inputFocusKeyBoardChangeValue: true, inputFocusKeyBoardChangeValue: true,
holdKeyboard: false, holdKeyboard: false,
keyboardHeight: 0,
focusedForKeyboardHeightChangeTest: false,
} }
}, },
methods: { methods: {
...@@ -328,6 +330,7 @@ ...@@ -328,6 +330,7 @@
onKeyborardHeightChange: function (event : UniInputKeyboardHeightChangeEvent) { onKeyborardHeightChange: function (event : UniInputKeyboardHeightChangeEvent) {
console.log("键盘高度发生变化", JSON.stringify(event.detail)); console.log("键盘高度发生变化", JSON.stringify(event.detail));
this.keyboardHeightChangeEventDetail = JSON.stringify(event.detail); this.keyboardHeightChangeEventDetail = JSON.stringify(event.detail);
this.keyboardHeight = event.detail.height;
}, },
test_check_input_value() : number { test_check_input_value() : number {
return this.onMaxLengthInputValue.length return this.onMaxLengthInputValue.length
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册