From eb6cb318e02c3d4e598fa83fe79ceae89cf15b3a Mon Sep 17 00:00:00 2001 From: taohebin Date: Mon, 29 Apr 2024 16:23:13 +0800 Subject: [PATCH] =?UTF-8?q?test:=20input=E5=A2=9E=E5=8A=A0=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=8C=96=E6=B5=8B=E8=AF=95=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages.json | 7 +++++++ pages/component/input/blank-for-test.uvue | 22 ++++++++++++++++++++++ pages/component/input/input.test.js | 20 ++++++++++++++++++++ pages/component/input/input.uvue | 7 +++++-- 4 files changed, 54 insertions(+), 2 deletions(-) create mode 100644 pages/component/input/blank-for-test.uvue diff --git a/pages.json b/pages.json index 2998aab1..74374398 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 00000000..51bef5df --- /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 1a3dc39f..38a2fa6d 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 be54a857..6a547a53 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 -- GitLab