diff --git a/pages/API/navigator/new-page/new-page-2.test.js b/pages/API/navigator/new-page/new-page-2.test.js index 45cff1a3d6346d18dcda066c4dd9c027eed0c832..3d02a8126df643a9be7cdcfb504b28782d86b3d0 100644 --- a/pages/API/navigator/new-page/new-page-2.test.js +++ b/pages/API/navigator/new-page/new-page-2.test.js @@ -35,39 +35,38 @@ describe('page-lifecycle', () => { lifeCycleNum = await page.callMethod('getLifeCycleNum') expect(lifeCycleNum).toBe(130) }) - // TODO: pageScrollTo 无法触发 onReachBottom, 待修复后调整 lifeCycleNum it('onPageScroll onReachBottom', async () => { await program.pageScrollTo(2000) const data = await page.data() expect(data.isScrolled).toBe(true) lifeCycleNum = await page.callMethod('getLifeCycleNum') - expect(lifeCycleNum).toBe(130) + expect(lifeCycleNum).toBe(140) }) it('onHide', async () => { page = await program.navigateTo(INTERMEDIATE_PAGE_PATH) await page.waitFor(1000) lifeCycleNum = await page.callMethod('getLifeCycleNum') - expect(lifeCycleNum).toBe(120) + expect(lifeCycleNum).toBe(130) page = await program.navigateBack() await page.waitFor(1000) lifeCycleNum = await page.callMethod('getLifeCycleNum') - expect(lifeCycleNum).toBe(130) + expect(lifeCycleNum).toBe(140) }) it('onUnload', async () => { page = await program.redirectTo(INTERMEDIATE_PAGE_PATH) await page.waitFor(1000) lifeCycleNum = await page.callMethod('getLifeCycleNum') - expect(lifeCycleNum).toBe(30) + expect(lifeCycleNum).toBe(40) }) it('onBackPress', async () => { page = await program.navigateTo(PAGE_PATH) await page.waitFor(1000) lifeCycleNum = await page.callMethod('getLifeCycleNum') - expect(lifeCycleNum).toBe(150) + expect(lifeCycleNum).toBe(160) page = await program.navigateBack() await page.waitFor(1000) lifeCycleNum = await page.callMethod('getLifeCycleNum') - expect(lifeCycleNum).toBe(40) + expect(lifeCycleNum).toBe(50) await page.callMethod('setLifeCycleNum', 0) }) }) diff --git a/pages/API/navigator/new-page/new-page-2.uvue b/pages/API/navigator/new-page/new-page-2.uvue index 02fb0b48a29d80ea652bce85337fb43f7779fb34..728934ea4232e1e6ab1b13e273957c60231c846a 100644 --- a/pages/API/navigator/new-page/new-page-2.uvue +++ b/pages/API/navigator/new-page/new-page-2.uvue @@ -1,7 +1,7 @@ @@ -26,7 +26,6 @@ export default { setLifeCycleNum(state.lifeCycleNum + 10) }, onPullDownRefresh() { - console.log('onPullDownRefresh') // 自动化测试 setLifeCycleNum(state.lifeCycleNum + 10) }, @@ -35,7 +34,6 @@ export default { this.isScrolled = true }, onReachBottom() { - console.log('onReachBottom') // 自动化测试 setLifeCycleNum(state.lifeCycleNum + 10) }, @@ -70,7 +68,7 @@ export default { }, }) }, - pageScrollTo() { + scrollToBottom() { uni.pageScrollTo({ scrollTop: 2000, })