diff --git a/pages/component/input/input.test.js b/pages/component/input/input.test.js index d2d3962ecd90e1be1b8b2401421e95d70d9c8dec..929a8db34905952acb491a868d867f9faf8856c4 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 36a52c337e6182783cd2ddcc18a1bbecbf524a6c..1e445ca61fcfdcba5af46ec286094ada3ad27241 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 @@ 设置光标颜色为透明(点击本行文字生效,再点复位) - +