From 03fdc43ec9d723c053b35e2165cf4f941eda6c9e Mon Sep 17 00:00:00 2001 From: taohebin Date: Thu, 7 Mar 2024 17:59:17 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20input=E5=A2=9E=E5=8A=A0maxlength?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=80=BC=20=20=E8=87=AA=E5=8A=A8=E5=8C=96?= =?UTF-8?q?=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/component/input/input.test.js | 16 ++++++++++++++++ pages/component/input/input.uvue | 5 +++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/pages/component/input/input.test.js b/pages/component/input/input.test.js index a1d7c942..be9d4e6c 100644 --- a/pages/component/input/input.test.js +++ b/pages/component/input/input.test.js @@ -147,6 +147,22 @@ describe('component-native-input', () => { expect(await (await page.$('#uni-input-cursor-color')).attribute("cursor-color")).toBe("red") }) + it("maxlength default", async () => { + const input = await page.$('#uni-input-disable'); + let str = ""; + for(let i = 0;i < 200;i++){ + str += `${i}` + } + await page.setData({ + disableValue: str + }) + let length = (await input.attribute("value")).length + expect(length).toBe(140) + await page.setData({ + disableValue: "" + }) + }) + 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 c5d138f5..52e85b2d 100644 --- a/pages/component/input/input.uvue +++ b/pages/component/input/input.uvue @@ -59,7 +59,7 @@ 设置禁用输入框 - + @@ -265,7 +265,8 @@ inputMaxLengthFocus: false, inputPasswordValue: "", inputFocusKeyBoardChangeValue: true, - holdKeyboard: false + holdKeyboard: false, + disableValue: "" } }, methods: { -- GitLab