diff --git a/pages/component/textarea/textarea.test.js b/pages/component/textarea/textarea.test.js index 7a5cd7fe0516349528d6b3077e97c2f8d25e8cf2..ba21821f7378ed824bcf42c8fb7437888da319fd 100644 --- a/pages/component/textarea/textarea.test.js +++ b/pages/component/textarea/textarea.test.js @@ -11,6 +11,25 @@ describe('component-native-textarea', () => { await page.waitFor(1000); }); + beforeEach(async () => { + await page.setData({ + jest_result: false, + }) + }); + + if(process.env.uniTestPlatformInfo.startsWith('android')){ + it("input event triggered when the default value is", async () => { + await program.adbCommand("input text 1") + await page.waitFor(2000) + let res = await page.data('jest_result'); + expect(res).toBe(true) + }) + it("reset status", async () => { + await program.adbCommand("input keyevent KEYCODE_DEL") + await page.waitFor(2000) + }) + } + it('focus', async () => { expect(await textarea.attribute("focus")).toBe("true") await page.setData({ diff --git a/pages/component/textarea/textarea.uvue b/pages/component/textarea/textarea.uvue index c34b3ed20fd1c26c296606694dfb9fb1db15d236..1a7df96b838549d725a5bb30cf4192aee82d4379 100644 --- a/pages/component/textarea/textarea.uvue +++ b/pages/component/textarea/textarea.uvue @@ -23,7 +23,8 @@ selectionStart: -1, selectionEnd: -1, hold_keyboard: false, - adjust_position: false + adjust_position: false, + jest_result: false } }, @@ -36,7 +37,10 @@ textarea_tap() { console.log("手指触摸后马上离开") }, textarea_longpress() { console.log("如果一个组件被绑定了 longpress 事件,那么当用户长按这个组件时,该事件将会被触发。") }, 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 上") + this.jest_result = true + }, textarea_linechange() { console.log("输入框行数变化时调用,event.detail = {height: 0, height: 0, lineCount: 0}") }, textarea_blur() { console.log("输入框失去焦点时触发,event.detail = {value, cursor}") }, textarea_keyboardheightchange() { console.log("键盘高度发生变化的时候触发此事件,event.detail = {height: height, duration: duration}") },