提交 f6a0a744 编写于 作者: 张磊

更新input测试

上级 0ce4c494
......@@ -8,25 +8,36 @@ describe('component-native-input', () => {
await page.waitFor(3000);
});
it("beforeAllTestScreenshot", async () => {
const image = await program.screenshot({
fullPage: true
})
expect(image).toMatchImageSnapshot()
})
// 测试焦点及键盘弹起
it('focus', async () => {
const input = await page.$('.uni-input-focus');
expect(await input.property('focus')).toBe(true)
expect(await page.data("inputFocusKeyBoardChangeValue")).toBe(true)
await page.setData({
focus: false,
})
expect(await input.property('focus')).toBe(false)
await page.waitFor(1000)
expect(await page.data("inputFocusKeyBoardChangeValue")).toBe(false)
await page.setData({
focus: true,
})
expect(await input.property('focus')).toBe(true)
await page.waitFor(1000)
expect(await page.data("inputFocusKeyBoardChangeValue")).toBe(true)
await page.setData({
focus: false,
})
expect(await input.property('focus')).toBe(false)
await page.waitFor(3000)
await page.waitFor(1000)
expect(await page.data("inputFocusKeyBoardChangeValue")).toBe(false)
await page.waitFor(1000)
});
// 测试修改value属性
......@@ -53,8 +64,13 @@ describe('component-native-input', () => {
expect(await input.property('password')).toBe(true)
await page.setData({
inputPassword: false,
inputPasswordValue: "inputPasswordValue"
})
expect(await input.property('password')).toBe(false)
await page.waitFor(500)
await page.setData({
inputPassword: true
})
})
// 测试placeholder
it("placeholder", async () => {
......@@ -79,12 +95,12 @@ describe('component-native-input', () => {
})
await page.setData({
inputPlaceHolderStyle: "color:#CC19CC;background-color:#00b1c0;text-align:center;font-size:100px;font-weight:900",
inputPlaceHolderStyle: "color:#CC19CC;background-color:#00b1c0;text-align:center;font-size:44px;font-weight:900",
})
expect(await placeholder1.property("placeholder-style")).toEqual({
"backgroundColor": "#00b1c0",
"color": "#CC19CC",
"fontSize": "100px",
"fontSize": "44px",
"fontWeight": "900",
"textAlign": "center"
})
......@@ -114,4 +130,19 @@ describe('component-native-input', () => {
expect(await (await page.$('.uni-input-confirm-go')).property("confirmType")).toEqual("go")
expect(await (await page.$('.uni-input-confirm-done')).property("confirmType")).toEqual("done")
})
});
\ No newline at end of file
it("maxlength", async () => {
const input = await page.$('.uni-input-maxlength');
await page.setData({
inputMaxLengthValue: "uni-input-maxlength"
})
await page.waitFor(500)
})
it("afterAllTestScreenshot", async () => {
const image = await program.screenshot({
fullPage: true
})
expect(image).toMatchImageSnapshot()
})
});
......@@ -36,7 +36,7 @@
<text class="uni-title-text">密码输入框</text>
</view>
<view class="uni-input-wrapper">
<input class="uni-input uni-input-password" :password="inputPassword" />
<input class="uni-input uni-input-password" :password="inputPassword" :value="inputPasswordValue" />
</view>
</view>
......@@ -84,7 +84,7 @@
<text class="uni-title-text">自动获取焦点</text>
</view>
<view class="uni-input-wrapper">
<input class="uni-input uni-input-focus" :focus="focus"/>
<input class="uni-input uni-input-focus" :focus="focus" @keyboardheightchange="inputFocusKeyBoardChange"/>
</view>
</view>
......@@ -232,10 +232,15 @@
inputPlaceHolderClass: "uni-input-placeholder-class",
inputMaxLengthValue:"",
onMaxLengthInputValue:"",
inputMaxLengthFocus:false
inputMaxLengthFocus:false,
inputPasswordValue:"",
inputFocusKeyBoardChangeValue:true
}
},
methods: {
inputFocusKeyBoardChange(e:InputKeyboardHeightChangeEvent) {
this.inputFocusKeyBoardChangeValue = e.detail.height > 50
},
onMaxLengthInput(event:InputEvent) {
this.onMaxLengthInputValue = event.detail.value
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册