mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-12 03:05:12 +00:00
Merge pull request #539 from cudr/nested-routes-navigate-fix
Fix nested routes navigates
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
<h1>Great success!</h1>
|
||||
|
||||
<a href="slow-preload">slow preload</a>
|
||||
<a href="foo">foo</a>
|
||||
<a href="foo">foo</a>
|
||||
<a href="prefetch/qwe" rel=prefetch>prefetch qwe</a>
|
||||
<a href="prefetch/xyz" rel=prefetch>prefetch xyz</a>
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<h1>{params.slug}</h1>
|
||||
1
test/apps/preloading/src/routes/prefetch/_layout.html
Normal file
1
test/apps/preloading/src/routes/prefetch/_layout.html
Normal file
@@ -0,0 +1 @@
|
||||
<svelte:component this={child.component} {...child.props}/>
|
||||
1
test/apps/preloading/src/routes/prefetch/index.html
Normal file
1
test/apps/preloading/src/routes/prefetch/index.html
Normal file
@@ -0,0 +1 @@
|
||||
<h1>prefetch</h1>
|
||||
@@ -83,4 +83,31 @@ describe('preloading', function() {
|
||||
assert.equal(page.url(), `${base}/foo`);
|
||||
assert.equal(await title(), 'foo');
|
||||
});
|
||||
});
|
||||
|
||||
it('navigates to prefetched urls', async () => {
|
||||
await page.goto(base);
|
||||
await start();
|
||||
await prefetchRoutes();
|
||||
|
||||
await page.hover('a[href="prefetch/qwe"]');
|
||||
await wait(100);
|
||||
await page.hover('a[href="prefetch/xyz"]');
|
||||
await wait(100);
|
||||
|
||||
await page.click('a[href="prefetch/qwe"]');
|
||||
await wait(50);
|
||||
|
||||
assert.equal(
|
||||
await title(),
|
||||
'qwe'
|
||||
);
|
||||
|
||||
await page.goto(`${base}/prefetch`);
|
||||
await wait(50);
|
||||
|
||||
assert.equal(
|
||||
await title(),
|
||||
'prefetch'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user