Skip to content

Commit

Permalink
apply Ben's suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
eltigerchino committed Jul 23, 2024
1 parent 139a318 commit b2bdc84
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions packages/kit/test/apps/basics/test/cross-platform/client.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }) => {
Expand Down

0 comments on commit b2bdc84

Please sign in to comment.