From f03edbedeeb04037b3db92de5539a796c689399c Mon Sep 17 00:00:00 2001 From: zhenyuWang <13641039885@163.com> Date: Thu, 9 May 2024 21:34:31 +0800 Subject: [PATCH] =?UTF-8?q?test(v-on):=20=E8=A1=A5=E5=85=85=E4=BF=AE?= =?UTF-8?q?=E9=A5=B0=E7=AC=A6=E7=A4=BA=E4=BE=8B=E5=8F=8A=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/directive/v-on/v-on-composition.uvue | 9 +++++++-- pages/directive/v-on/v-on-options.uvue | 9 +++++++-- pages/directive/v-on/v-on.test.js | 22 +++++++++++++++------- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/pages/directive/v-on/v-on-composition.uvue b/pages/directive/v-on/v-on-composition.uvue index bea027c..a854782 100644 --- a/pages/directive/v-on/v-on-composition.uvue +++ b/pages/directive/v-on/v-on-composition.uvue @@ -24,8 +24,13 @@ - - + + + + + + + diff --git a/pages/directive/v-on/v-on-options.uvue b/pages/directive/v-on/v-on-options.uvue index 0909514..82f7ab0 100644 --- a/pages/directive/v-on/v-on-options.uvue +++ b/pages/directive/v-on/v-on-options.uvue @@ -22,8 +22,13 @@ - - + + + + + + + diff --git a/pages/directive/v-on/v-on.test.js b/pages/directive/v-on/v-on.test.js index 63ab735..a0fa663 100644 --- a/pages/directive/v-on/v-on.test.js +++ b/pages/directive/v-on/v-on.test.js @@ -3,26 +3,34 @@ const COMPOSITION_PAGE_PATH = '/pages/directive/v-on/v-on-composition' describe('v-on', () => { let page - + const platformInfo = process.env.uniTestPlatformInfo.toLowerCase() + const isIos = platformInfo.startsWith('ios') + const test = async (pagePath) => { page = await program.reLaunch(pagePath) await page.waitFor('view') - + const count = await page.$('#count') expect(await count.text()).toBe('0') - + const btnList = await page.$$('.btn') for (let i = 0; i < btnList.length; i++) { await btnList[i].tap() } - - expect(await count.text()).toBe('6') + + expect(await count.text()).toBe(isIos ? '7' : '8') + + if (!isIos) { + const onceBtn = await page.$('#btn-once') + await onceBtn.tap() + expect(await count.text()).toBe('8') + } } - + it('v-on options API', async () => { await test(OPTIONS_PAGE_PATH) }) - + it('v-on composition API', async () => { await test(COMPOSITION_PAGE_PATH) }) -- GitLab