提交 de40580c 编写于 作者: 辛宝Otto's avatar 辛宝Otto 🥊

feat: 补充 input/textarea 同时设置 v-model/value 的测试

上级 a051839d
...@@ -198,4 +198,9 @@ describe('component-native-input', () => { ...@@ -198,4 +198,9 @@ describe('component-native-input', () => {
}) })
expect(image).toSaveImageSnapshot() expect(image).toSaveImageSnapshot()
}) })
it('both set modelValue and value', async()=>{
const input2 = await page.$('#both-model-value');
expect(await input2.value()).toEqual("123")
})
}); });
...@@ -238,6 +238,16 @@ ...@@ -238,6 +238,16 @@
@click="changePassword"></image> @click="changePassword"></image>
</view> </view>
</view> </view>
<view>
<view class="uni-title">
<text class="uni-title-text">同时存在 v-model 和 value</text>
</view>
<view class="input-wrapper">
<input id="both-model-value" class="uni-input" v-model='demoValue' value='456' />
</view>
</view>
</view> </view>
<!-- #ifdef APP --> <!-- #ifdef APP -->
</scroll-view> </scroll-view>
...@@ -272,6 +282,7 @@ ...@@ -272,6 +282,7 @@
holdKeyboard: false, holdKeyboard: false,
keyboardHeight: 0, keyboardHeight: 0,
focusedForKeyboardHeightChangeTest: false, focusedForKeyboardHeightChangeTest: false,
demoValue: '123'
} }
}, },
methods: { methods: {
......
...@@ -73,4 +73,9 @@ describe('component-native-textarea', () => { ...@@ -73,4 +73,9 @@ describe('component-native-textarea', () => {
await page.waitFor(500) await page.waitFor(500)
} }
}) })
it('both set modelValue and value', async () => {
let textarea2 = await page.$('.both-set-textarea');
expect(await textarea2.value()).toBe("123")
})
}); });
...@@ -18,7 +18,8 @@ export default { ...@@ -18,7 +18,8 @@ export default {
cursor: 0, cursor: 0,
inputmode_enum_current: 0, inputmode_enum_current: 0,
confirm_type_current: 0, confirm_type_current: 0,
placeholder_value: "请输入" placeholder_value: "请输入",
defaultModel:'123'
} }
}, },
...@@ -32,7 +33,7 @@ export default { ...@@ -32,7 +33,7 @@ export default {
textarea_longpress() { console.log("如果一个组件被绑定了 longpress 事件,那么当用户长按这个组件时,该事件将会被触发。") }, textarea_longpress() { console.log("如果一个组件被绑定了 longpress 事件,那么当用户长按这个组件时,该事件将会被触发。") },
textarea_confirm() { console.log("点击完成时, 触发 confirm 事件,event.detail = {value: value}") }, textarea_confirm() { console.log("点击完成时, 触发 confirm 事件,event.detail = {value: value}") },
textarea_input() { console.log("当键盘输入时,触发 input 事件,event.detail = {value, cursor}, @input 处理函数的返回值并不会反映到 textarea 上") }, textarea_input() { console.log("当键盘输入时,触发 input 事件,event.detail = {value, cursor}, @input 处理函数的返回值并不会反映到 textarea 上") },
textarea_linechange() { console.log("输入框行数变化时调用,event.detail = {height: 0, height: 0, lineCount: 0}") }, textarea_linechange(e) { console.log(e,"输入框行数变化时调用,event.detail = {height: 0, height: 0, lineCount: 0}") },
textarea_blur() { console.log("输入框失去焦点时触发,event.detail = {value, cursor}") }, textarea_blur() { console.log("输入框失去焦点时触发,event.detail = {value, cursor}") },
textarea_keyboardheightchange() { console.log("键盘高度发生变化的时候触发此事件,event.detail = {height: height, duration: duration}") }, textarea_keyboardheightchange() { console.log("键盘高度发生变化的时候触发此事件,event.detail = {height: height, duration: duration}") },
textarea_focus() { console.log("输入框聚焦时触发,event.detail = { value, height },height 为键盘高度") }, textarea_focus() { console.log("输入框聚焦时触发,event.detail = { value, height },height 为键盘高度") },
...@@ -142,6 +143,11 @@ export default { ...@@ -142,6 +143,11 @@ export default {
<textarea id="textarea-height-exception" style="flex:1;border: 1 solid #666;margin: 10px" placeholder="底部textarea测试键盘遮挡"/> <textarea id="textarea-height-exception" style="flex:1;border: 1 solid #666;margin: 10px" placeholder="底部textarea测试键盘遮挡"/>
</view> </view>
</view> </view>
<view>同时存在 v-model 和 value</view>
<view class="main">
<textarea class="list-item both-set-textarea" v-model='defaultModel' value='456'></textarea>
</view>
<!-- #ifdef APP --> <!-- #ifdef APP -->
</scroll-view> </scroll-view>
<!-- #endif --> <!-- #endif -->
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册