From 38736a2009f123b266ff23005f8f6d20379cedef Mon Sep 17 00:00:00 2001 From: hdx Date: Tue, 26 Sep 2023 14:20:20 +0800 Subject: [PATCH] =?UTF-8?q?navigator=E7=BB=84=E4=BB=B6=EF=BC=9A=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E8=87=AA=E5=8A=A8=E5=8C=96=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/component/navigator/navigator.test.js | 30 +++++++++++++++++++++ pages/component/navigator/navigator.uvue | 4 +-- 2 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 pages/component/navigator/navigator.test.js diff --git a/pages/component/navigator/navigator.test.js b/pages/component/navigator/navigator.test.js new file mode 100644 index 00000000..f424dded --- /dev/null +++ b/pages/component/navigator/navigator.test.js @@ -0,0 +1,30 @@ +const PAGE_PATH = '/pages/component/navigator/navigator' +const PAGE_PATH_NAVIGATE = '/pages/component/navigator/navigate' +const PAGE_PATH_REDIRECT = '/pages/component/navigator/redirect' + +describe('navigator', () => { + let page + beforeAll(async () => {}) + it('navigate', async () => { + page = await program.reLaunch(PAGE_PATH) + await page.waitFor(500) + + const btnNavigate = await page.$('.navigate') + await btnNavigate.tap() + await page.waitFor(100) + + const currentPage = await program.currentPage() + expect(currentPage.path).toBe(PAGE_PATH_NAVIGATE.substring(1)) + }) + it('redirect', async () => { + page = await program.reLaunch(PAGE_PATH) + await page.waitFor(500) + + const btnRedirect = await page.$('.redirect') + await btnRedirect.tap() + await page.waitFor(100) + + const currentPage = await program.currentPage() + expect(currentPage.path).toBe(PAGE_PATH_REDIRECT.substring(1)) + }) +}) diff --git a/pages/component/navigator/navigator.uvue b/pages/component/navigator/navigator.uvue index 81680683..da656d03 100644 --- a/pages/component/navigator/navigator.uvue +++ b/pages/component/navigator/navigator.uvue @@ -2,10 +2,10 @@ - + - + -- GitLab