always re-run preload functions when query string changes - fixes #701

This commit is contained in:
Richard Harris
2019-05-20 23:45:39 -04:00
parent aa31e3ca6a
commit b6e2736eb0
3 changed files with 48 additions and 2 deletions

View File

@@ -109,4 +109,23 @@ describe('preloading', function() {
it('survives the tests with no server errors', () => {
assert.deepEqual(r.errors, []);
});
it('re-runs preload when page.query changes', async () => {
await r.load('/echo?foo=1');
await r.sapper.start();
await r.sapper.prefetchRoutes();
assert.equal(
await r.text('pre'),
`{"foo":"1"}`
);
await r.page.click('a[href="echo?foo=2"]');
await r.wait();
assert.equal(
await r.text('pre'),
`{"foo":"2"}`
);
});
});