mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-13 19:45:26 +00:00
cancel navigation if overtaken by a second navigation - fixes #48
This commit is contained in:
@@ -208,6 +208,40 @@ function run(env) {
|
||||
|
||||
assert.ok(scrollY > 0, scrollY);
|
||||
});
|
||||
|
||||
it('cancels navigation if subsequent navigation occurs during preload', async () => {
|
||||
await nightmare
|
||||
.goto(base)
|
||||
.wait(() => window.READY)
|
||||
.click('a[href="/slow-preload"]')
|
||||
.wait(100)
|
||||
.click('a[href="/about"]')
|
||||
.wait(100);
|
||||
|
||||
assert.equal(
|
||||
await nightmare.path(),
|
||||
'/about'
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
await nightmare.evaluate(() => document.querySelector('h1').textContent),
|
||||
'About this site'
|
||||
);
|
||||
|
||||
await nightmare
|
||||
.evaluate(() => window.fulfil({}))
|
||||
.wait(100);
|
||||
|
||||
assert.equal(
|
||||
await nightmare.path(),
|
||||
'/about'
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
await nightmare.evaluate(() => document.querySelector('h1').textContent),
|
||||
'About this site'
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
describe('headers', () => {
|
||||
|
||||
Reference in New Issue
Block a user