From 3e119088a695e6823cd47972922645756e3c2497 Mon Sep 17 00:00:00 2001 From: taohebin Date: Mon, 18 Dec 2023 12:06:20 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20input=E7=A4=BA=E4=BE=8B=20input=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E5=A2=9E=E5=8A=A0id=EF=BC=8C=E5=B9=B6=E4=B8=94?= =?UTF-8?q?=E6=B5=8B=E8=AF=95=E4=BD=BF=E7=94=A8id=E5=BC=95=E7=94=A8?= =?UTF-8?q?=E7=BB=84=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/component/input/input.test.js | 26 +++++++++++----------- pages/component/input/input.uvue | 34 ++++++++++++++--------------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/pages/component/input/input.test.js b/pages/component/input/input.test.js index d2d3962e..929a8db3 100644 --- a/pages/component/input/input.test.js +++ b/pages/component/input/input.test.js @@ -16,7 +16,7 @@ describe('component-native-input', () => { // }) // 测试焦点及键盘弹起 it('focus', async () => { - const input = await page.$('.uni-input-focus'); + const input = await page.$('#uni-input-focus'); expect(await input.property('focus')).toBe("true") // expect(await page.data("inputFocusKeyBoardChangeValue")).toBe(true) await page.setData({ @@ -42,16 +42,16 @@ describe('component-native-input', () => { // 测试修改value属性 it("value", async () => { - const input = await page.$('.uni-input-default'); + const input = await page.$('#uni-input-default'); expect(await input.property('value')).toEqual("hello uni-app x") }) //测试input的类型 it("type", async () => { - const text = await page.$('.uni-input-type-text'); - const number = await page.$('.uni-input-type-number'); - const digit = await page.$('.uni-input-type-digit'); - const tel = await page.$('.uni-input-type-tel'); + const text = await page.$('#uni-input-type-text'); + const number = await page.$('#uni-input-type-number'); + const digit = await page.$('#uni-input-type-digit'); + const tel = await page.$('#uni-input-type-tel'); expect(await text.property('type')).toEqual("text") expect(await number.property('type')).toEqual("number") expect(await digit.property('type')).toEqual("digit") @@ -119,16 +119,16 @@ describe('component-native-input', () => { // }) it("disable", async () => { - const input = await page.$('.uni-input-disable'); + const input = await page.$('#uni-input-disable'); expect(await input.property("disabled")).toBe("true") }) it("confirm-type", async () => { - expect(await (await page.$('.uni-input-confirm-send')).property("confirmType")).toEqual("send") - expect(await (await page.$('.uni-input-confirm-search')).property("confirmType")).toEqual("search") - expect(await (await page.$('.uni-input-confirm-next')).property("confirmType")).toEqual("next") - expect(await (await page.$('.uni-input-confirm-go')).property("confirmType")).toEqual("go") - expect(await (await page.$('.uni-input-confirm-done')).property("confirmType")).toEqual("done") + expect(await (await page.$('#uni-input-confirm-send')).property("confirmType")).toEqual("send") + expect(await (await page.$('#uni-input-confirm-search')).property("confirmType")).toEqual("search") + expect(await (await page.$('#uni-input-confirm-next')).property("confirmType")).toEqual("next") + expect(await (await page.$('#uni-input-confirm-go')).property("confirmType")).toEqual("go") + expect(await (await page.$('#uni-input-confirm-done')).property("confirmType")).toEqual("done") }) // it("maxlength", async () => { @@ -144,7 +144,7 @@ describe('component-native-input', () => { cursor_color: "transparent", }) await page.waitFor(500) - expect(await (await page.$('.uni-input-cursor-color')).property("cursor-color")).toBe("transparent") + expect(await (await page.$('#uni-input-cursor-color')).property("cursor-color")).toBe("transparent") }) it("afterAllTestScreenshot", async () => { diff --git a/pages/component/input/input.uvue b/pages/component/input/input.uvue index 36a52c33..1e445ca6 100644 --- a/pages/component/input/input.uvue +++ b/pages/component/input/input.uvue @@ -9,7 +9,7 @@ 设置输入框的初始内容 - + @@ -18,16 +18,16 @@ type取值(不同输入法表现可能不一致) - + - + - + - + @@ -36,7 +36,7 @@ 密码输入框 - + @@ -45,10 +45,10 @@ 占位符样式 - + - + @@ -57,7 +57,7 @@ 设置禁用输入框 - + @@ -66,7 +66,7 @@ 设置最大输入长度 - + @@ -84,7 +84,7 @@ 自动获取焦点 - + @@ -93,19 +93,19 @@ confirm-type取值(不同输入法表现可能不一致) - + - + - + - + - + @@ -141,7 +141,7 @@ 设置光标颜色为透明(点击本行文字生效,再点复位) - + -- GitLab