From b2bdc84087c70b2e097d084ed9e76878d332d146 Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Wed, 24 Jul 2024 03:09:32 +0800 Subject: [PATCH] apply Ben's suggestions --- .../apps/basics/test/cross-platform/client.test.js | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/packages/kit/test/apps/basics/test/cross-platform/client.test.js b/packages/kit/test/apps/basics/test/cross-platform/client.test.js index aeefb2082dd8..313cdfec80ae 100644 --- a/packages/kit/test/apps/basics/test/cross-platform/client.test.js +++ b/packages/kit/test/apps/basics/test/cross-platform/client.test.js @@ -220,23 +220,18 @@ test.describe('Navigation lifecycle functions', () => { expect(await page.innerHTML('pre')).toBe('2 false goto'); }); - test('beforeNavigate is triggered after clicking a download link', async ({ page, baseURL }) => { - const pathname = '/navigation-lifecycle/before-navigate/prevent-navigation'; - const current_url = baseURL + pathname; - - await page.goto(pathname); + test('beforeNavigate is triggered after clicking a download link', async ({ page }) => { + await page.goto('/navigation-lifecycle/before-navigate/prevent-navigation'); const download = page.waitForEvent('download'); await page.locator('a[download]').click(); - await page.waitForURL(current_url); await (await download).cancel(); - expect(await page.locator('pre').innerText()).toBe('0 false undefined'); + await expect(page.locator('pre')).toHaveText('0 false undefined'); await page.locator('a[href="/navigation-lifecycle/before-navigate/a"]').click(); - await page.waitForURL(current_url); - expect(await page.locator('pre').innerText()).toBe('1 false link'); + await expect(page.locator('pre')).toHaveText('1 false link'); }); test('afterNavigate calls callback', async ({ page, clicknav }) => {