diff --git a/pages.json b/pages.json index 2998aab127c296caebbc81ad8dadf2bc108a8063..74374398e9d595dfeac3573b467479eb886f2772 100644 --- a/pages.json +++ b/pages.json @@ -1312,6 +1312,13 @@ { "navigationBarTitleText" : "overflow-visible-event" } + }, + { + "path" : "pages/component/input/blank-for-test", + "style" : + { + "navigationBarTitleText" : "测试空白页面" + } } ], "globalStyle": { diff --git a/pages/component/input/blank-for-test.uvue b/pages/component/input/blank-for-test.uvue new file mode 100644 index 0000000000000000000000000000000000000000..51bef5dfc0a6f4151106fce4f6ccc24268c905e1 --- /dev/null +++ b/pages/component/input/blank-for-test.uvue @@ -0,0 +1,22 @@ + + + + + diff --git a/pages/component/input/input.test.js b/pages/component/input/input.test.js index 1a3dc39fc0586ee39d8fead25d9f33191b693311..38a2fa6d879857f1c03a641d0d1ba31c25fc9cfd 100644 --- a/pages/component/input/input.test.js +++ b/pages/component/input/input.test.js @@ -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 () => { const image = await program.screenshot({ fullPage: true diff --git a/pages/component/input/input.uvue b/pages/component/input/input.uvue index be54a8571e7a03a546299fc99a69b97a7fb271c3..6a547a53832f7fa869721c2d58c08565c7b2eb73 100644 --- a/pages/component/input/input.uvue +++ b/pages/component/input/input.uvue @@ -213,7 +213,7 @@ v-if="keyboardHeightChangeEventDetail">{{keyboardHeightChangeEventDetail}} - + @@ -270,6 +270,8 @@ inputPasswordValue: "cipher", inputFocusKeyBoardChangeValue: true, holdKeyboard: false, + keyboardHeight: 0, + focusedForKeyboardHeightChangeTest: false, } }, methods: { @@ -327,7 +329,8 @@ }, onKeyborardHeightChange: function (event : UniInputKeyboardHeightChangeEvent) { 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 { return this.onMaxLengthInputValue.length