From da6e1527966fb0a7f73f96129df7f38da92e4c02 Mon Sep 17 00:00:00 2001 From: zhenyuWang <13641039885@163.com> Date: Thu, 25 Jan 2024 21:55:33 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E8=B0=83=E6=95=B4=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E7=94=9F=E5=91=BD=E5=91=A8=E6=9C=9F=E6=B5=8B=E8=AF=95=E4=BE=8B?= =?UTF-8?q?=E5=85=BC=E5=AE=B9=20=20web=20=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../component-lifecycle.test.js | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/pages/composition-api/lifecycle/component-lifecycle/component-lifecycle.test.js b/pages/composition-api/lifecycle/component-lifecycle/component-lifecycle.test.js index f5a68c6..31f6971 100644 --- a/pages/composition-api/lifecycle/component-lifecycle/component-lifecycle.test.js +++ b/pages/composition-api/lifecycle/component-lifecycle/component-lifecycle.test.js @@ -16,12 +16,12 @@ describe('component-lifecycle', () => { page = await program.navigateTo(PAGE_PATH) await page.waitFor(700) }) - // afterAll(async () => { - // const resetLifecycleNum = 1100 - // await page.callMethod('setLifeCycleNum', resetLifecycleNum) - // lifeCycleNum = await page.callMethod('getLifeCycleNum') - // expect(lifeCycleNum).toBe(resetLifecycleNum) - // }) + afterAll(async () => { + const resetLifecycleNum = 1100 + await page.callMethod('setLifeCycleNum', resetLifecycleNum) + lifeCycleNum = await page.callMethod('getLifeCycleNum') + expect(lifeCycleNum).toBe(resetLifecycleNum) + }) it('onLoad onPageShow onReady onBeforeMount onMounted', async () => { lifeCycleNum = await page.callMethod('getLifeCycleNum') @@ -43,14 +43,14 @@ describe('component-lifecycle', () => { await page.callMethod('pageSetlifeCycleNum', 0) }) it('onPageScroll onReachBottom', async () => { - await program.pageScrollTo(2000) - // 测试 web 端组件内监听 onPageScroll 不触发 + await program.pageScrollTo(2000) + // web 端组件内监听 onPageScroll onReachBottom 不触发 if (process.env.uniTestPlatformInfo.startsWith('android')) { const isScrolled = await page.callMethod('getIsScrolled') expect(isScrolled).toBe(true) + lifeCycleNum = await page.callMethod('getLifeCycleNum') + expect(lifeCycleNum).toBe(10) } - lifeCycleNum = await page.callMethod('getLifeCycleNum') - expect(lifeCycleNum).toBe(10) await page.callMethod('pageSetlifeCycleNum', 0) }) it('onHide', async () => { -- GitLab