提交 3e119088 编写于 作者: taohebin@dcloud.io's avatar taohebin@dcloud.io

fix: input示例 input组件增加id,并且测试使用id引用组件

上级 4e1497be
...@@ -16,7 +16,7 @@ describe('component-native-input', () => { ...@@ -16,7 +16,7 @@ describe('component-native-input', () => {
// }) // })
// 测试焦点及键盘弹起 // 测试焦点及键盘弹起
it('focus', async () => { 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 input.property('focus')).toBe("true")
// expect(await page.data("inputFocusKeyBoardChangeValue")).toBe(true) // expect(await page.data("inputFocusKeyBoardChangeValue")).toBe(true)
await page.setData({ await page.setData({
...@@ -42,16 +42,16 @@ describe('component-native-input', () => { ...@@ -42,16 +42,16 @@ describe('component-native-input', () => {
// 测试修改value属性 // 测试修改value属性
it("value", async () => { 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") expect(await input.property('value')).toEqual("hello uni-app x")
}) })
//测试input的类型 //测试input的类型
it("type", async () => { it("type", async () => {
const text = await page.$('.uni-input-type-text'); const text = await page.$('#uni-input-type-text');
const number = await page.$('.uni-input-type-number'); const number = await page.$('#uni-input-type-number');
const digit = await page.$('.uni-input-type-digit'); const digit = await page.$('#uni-input-type-digit');
const tel = await page.$('.uni-input-type-tel'); const tel = await page.$('#uni-input-type-tel');
expect(await text.property('type')).toEqual("text") expect(await text.property('type')).toEqual("text")
expect(await number.property('type')).toEqual("number") expect(await number.property('type')).toEqual("number")
expect(await digit.property('type')).toEqual("digit") expect(await digit.property('type')).toEqual("digit")
...@@ -119,16 +119,16 @@ describe('component-native-input', () => { ...@@ -119,16 +119,16 @@ describe('component-native-input', () => {
// }) // })
it("disable", async () => { it("disable", async () => {
const input = await page.$('.uni-input-disable'); const input = await page.$('#uni-input-disable');
expect(await input.property("disabled")).toBe("true") expect(await input.property("disabled")).toBe("true")
}) })
it("confirm-type", async () => { it("confirm-type", async () => {
expect(await (await page.$('.uni-input-confirm-send')).property("confirmType")).toEqual("send") 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-search')).property("confirmType")).toEqual("search")
expect(await (await page.$('.uni-input-confirm-next')).property("confirmType")).toEqual("next") 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-go')).property("confirmType")).toEqual("go")
expect(await (await page.$('.uni-input-confirm-done')).property("confirmType")).toEqual("done") expect(await (await page.$('#uni-input-confirm-done')).property("confirmType")).toEqual("done")
}) })
// it("maxlength", async () => { // it("maxlength", async () => {
...@@ -144,7 +144,7 @@ describe('component-native-input', () => { ...@@ -144,7 +144,7 @@ describe('component-native-input', () => {
cursor_color: "transparent", cursor_color: "transparent",
}) })
await page.waitFor(500) 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 () => { it("afterAllTestScreenshot", async () => {
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
<text class="uni-title-text">设置输入框的初始内容</text> <text class="uni-title-text">设置输入框的初始内容</text>
</view> </view>
<view class="uni-input-wrapper"> <view class="uni-input-wrapper">
<input class="uni-input uni-input-default" value="hello uni-app x" /> <input id="uni-input-default" class="uni-input" value="hello uni-app x" />
</view> </view>
</view> </view>
...@@ -18,16 +18,16 @@ ...@@ -18,16 +18,16 @@
<text class="uni-title-text">type取值(不同输入法表现可能不一致)</text> <text class="uni-title-text">type取值(不同输入法表现可能不一致)</text>
</view> </view>
<view class="uni-input-wrapper"> <view class="uni-input-wrapper">
<input class="uni-input uni-input-type-text" type="text" placeholder="文本输入键盘" /> <input id="uni-input-type-text" class="uni-input" type="text" placeholder="文本输入键盘" />
</view> </view>
<view class="uni-input-wrapper"> <view class="uni-input-wrapper">
<input class="uni-input uni-input-type-number" type="number" placeholder="数字输入键盘" /> <input id="uni-input-type-number" class="uni-input" type="number" placeholder="数字输入键盘" />
</view> </view>
<view class="uni-input-wrapper"> <view class="uni-input-wrapper">
<input class="uni-input uni-input-type-digit" type="digit" placeholder="带小数点的数字输入键盘" /> <input id="uni-input-type-digit" class="uni-input" type="digit" placeholder="带小数点的数字输入键盘" />
</view> </view>
<view class="uni-input-wrapper"> <view class="uni-input-wrapper">
<input class="uni-input uni-input-type-tel" :type="inputTypeTel" placeholder="电话输入键盘" /> <input id="uni-input-type-tel" class="uni-input" :type="inputTypeTel" placeholder="电话输入键盘" />
</view> </view>
</view> </view>
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
<text class="uni-title-text">密码输入框</text> <text class="uni-title-text">密码输入框</text>
</view> </view>
<view class="uni-input-wrapper"> <view class="uni-input-wrapper">
<input class="uni-input uni-input-password" :password="inputPassword" :value="inputPasswordValue" /> <input id="uni-input-password" class="uni-input" :password="inputPassword" :value="inputPasswordValue" />
</view> </view>
</view> </view>
...@@ -45,10 +45,10 @@ ...@@ -45,10 +45,10 @@
<text class="uni-title-text">占位符样式</text> <text class="uni-title-text">占位符样式</text>
</view> </view>
<view class="uni-input-wrapper"> <view class="uni-input-wrapper">
<input class="uni-input uni-input-placeholder1" :placeholder-style="inputPlaceHolderStyle" placeholder="占位符文字颜色为红色" /> <input id="uni-input-placeholder1" class="uni-input" :placeholder-style="inputPlaceHolderStyle" placeholder="占位符文字颜色为红色" />
</view> </view>
<view class="uni-input-wrapper"> <view class="uni-input-wrapper">
<input class="uni-input uni-input-placeholder2" :placeholder-class="inputPlaceHolderClass" placeholder="占位符背景色为绿色" /> <input id="uni-input-placeholder2" class="uni-input" :placeholder-class="inputPlaceHolderClass" placeholder="占位符背景色为绿色" />
</view> </view>
</view> </view>
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
<text class="uni-title-text">设置禁用输入框</text> <text class="uni-title-text">设置禁用输入框</text>
</view> </view>
<view class="uni-input-wrapper"> <view class="uni-input-wrapper">
<input class="uni-input uni-input-disable" :disabled="true" /> <input id="uni-input-disable" class="uni-input" :disabled="true" />
</view> </view>
</view> </view>
...@@ -66,7 +66,7 @@ ...@@ -66,7 +66,7 @@
<text class="uni-title-text">设置最大输入长度</text> <text class="uni-title-text">设置最大输入长度</text>
</view> </view>
<view class="uni-input-wrapper"> <view class="uni-input-wrapper">
<input class="uni-input uni-input-maxlength" :maxlength="10" placeholder="最大输入长度为10" :value="inputMaxLengthValue" @input="onMaxLengthInput" :focus="inputMaxLengthFocus" /> <input id="uni-input-maxlength" class="uni-input" :maxlength="10" placeholder="最大输入长度为10" :value="inputMaxLengthValue" @input="onMaxLengthInput" :focus="inputMaxLengthFocus" />
</view> </view>
</view> </view>
...@@ -84,7 +84,7 @@ ...@@ -84,7 +84,7 @@
<text class="uni-title-text">自动获取焦点</text> <text class="uni-title-text">自动获取焦点</text>
</view> </view>
<view class="uni-input-wrapper"> <view class="uni-input-wrapper">
<input class="uni-input uni-input-focus" :focus="focus" @keyboardheightchange="inputFocusKeyBoardChange"/> <input id="uni-input-focus" class="uni-input" :focus="focus" @keyboardheightchange="inputFocusKeyBoardChange"/>
</view> </view>
</view> </view>
...@@ -93,19 +93,19 @@ ...@@ -93,19 +93,19 @@
<text class="uni-title-text">confirm-type取值(不同输入法表现可能不一致)</text> <text class="uni-title-text">confirm-type取值(不同输入法表现可能不一致)</text>
</view> </view>
<view class="uni-input-wrapper"> <view class="uni-input-wrapper">
<input class="uni-input uni-input-confirm-send" confirmType="send" placeholder="键盘右下角按钮显示为发送" /> <input id="uni-input-confirm-send" class="uni-input" confirmType="send" placeholder="键盘右下角按钮显示为发送" />
</view> </view>
<view class="uni-input-wrapper"> <view class="uni-input-wrapper">
<input class="uni-input uni-input-confirm-search" confirmType="search" placeholder="键盘右下角按钮显示为搜索" /> <input id="uni-input-confirm-search" class="uni-input" confirmType="search" placeholder="键盘右下角按钮显示为搜索" />
</view> </view>
<view class="uni-input-wrapper"> <view class="uni-input-wrapper">
<input class="uni-input uni-input-confirm-next" confirmType="next" placeholder="键盘右下角按钮显示为下一个" /> <input id="uni-input-confirm-next" class="uni-input" confirmType="next" placeholder="键盘右下角按钮显示为下一个" />
</view> </view>
<view class="uni-input-wrapper"> <view class="uni-input-wrapper">
<input class="uni-input uni-input-confirm-go" confirmType="go" placeholder="键盘右下角按钮显示为前往" /> <input id="uni-input-confirm-go" class="uni-input" confirmType="go" placeholder="键盘右下角按钮显示为前往" />
</view> </view>
<view class="uni-input-wrapper"> <view class="uni-input-wrapper">
<input class="uni-input uni-input-confirm-done" confirmType="done" placeholder="键盘右下角按钮显示为完成" /> <input id="uni-input-confirm-done" class="uni-input" confirmType="done" placeholder="键盘右下角按钮显示为完成" />
</view> </view>
</view> </view>
...@@ -141,7 +141,7 @@ ...@@ -141,7 +141,7 @@
<text class="uni-title-text">设置光标颜色为透明(点击本行文字生效,再点复位)</text> <text class="uni-title-text">设置光标颜色为透明(点击本行文字生效,再点复位)</text>
</view> </view>
<view class="uni-input-wrapper"> <view class="uni-input-wrapper">
<input class="uni-input uni-input-cursor-color" :cursor-color="cursor_color" value="光标颜色" /> <input id="uni-input-cursor-color" class="uni-input" :cursor-color="cursor_color" value="光标颜色" />
</view> </view>
</view> </view>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册