handle deep links

This commit is contained in:
Rich Harris
2017-12-24 07:53:39 -05:00
committed by GitHub
parent 9a936669c6
commit c8366dec74
3 changed files with 45 additions and 4 deletions

View File

@@ -166,7 +166,7 @@ function run(env) {
});
it('navigates to a new page without reloading', async () => {
await nightmare.goto(base);
await nightmare.goto(base).wait(() => window.READY).wait(100);
const requests = await capture(async () => {
await nightmare.click('a[href="/about"]');
@@ -198,6 +198,16 @@ function run(env) {
'What is Sapper?'
);
});
it('scrolls to active deeplink', async () => {
const scrollY = await nightmare
.goto(`${base}/blog/a-very-long-post#four`)
.wait(() => window.READY)
.wait(100)
.evaluate(() => window.scrollY);
assert.ok(scrollY > 0, scrollY);
});
});
describe('headers', () => {