This commit is contained in:
cudr
2018-12-26 13:20:07 +03:00
parent cfba9b2168
commit b6bc90cea9
5 changed files with 34 additions and 2 deletions

View File

@@ -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>

View File

@@ -0,0 +1 @@
<h1>{params.slug}</h1>

View File

@@ -0,0 +1 @@
<svelte:component this={child.component} {...child.props}/>

View File

@@ -0,0 +1 @@
<h1>prefetch</h1>

View File

@@ -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'
);
});
});