failing test for skipped segments

This commit is contained in:
Richard Harris
2019-05-05 10:49:38 -04:00
parent 49f8b2c4bd
commit d51e1a0af8
2 changed files with 32 additions and 4 deletions

View File

@@ -0,0 +1,14 @@
<script context="module">
export function preload({ params }) {
return params;
}
</script>
<script>
export let one;
export let two;
</script>
<h1>{one}:{two}</h1>
<a href="y/1">y/1</a>

View File

@@ -282,7 +282,7 @@ describe('basics', function() {
assert.equal(await title(), 'bar'); assert.equal(await title(), 'bar');
}); });
it('navigates to ...rest', async () => { it('navigates to ...rest', async () => {
await page.goto(`${base}/abc/xyz`); await page.goto(`${base}/abc/xyz`);
await start(); await start();
@@ -298,7 +298,7 @@ describe('basics', function() {
await page.evaluate(() => document.body.textContent), await page.evaluate(() => document.body.textContent),
'xyz,abc,qwe' 'xyz,abc,qwe'
); );
}); });
it('navigates between dynamic routes with same segments', async () => { it('navigates between dynamic routes with same segments', async () => {
await page.goto(`${base}/dirs/bar/xyz`); await page.goto(`${base}/dirs/bar/xyz`);
@@ -324,4 +324,18 @@ describe('basics', function() {
assert.ok(html.body.indexOf('<h1>HTML</h1>') !== -1); assert.ok(html.body.indexOf('<h1>HTML</h1>') !== -1);
}); });
it('invalidates page when a segment is skipped', async () => {
await page.goto(`${base}/skipped/x/1`);
await start();
await prefetchRoutes();
await page.click('a[href="skipped/y/1"]');
await wait(50);
assert.equal(
await title(),
'y:1'
);
});
}); });