mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-14 12:04:39 +00:00
add tests for #376
This commit is contained in:
@@ -795,6 +795,30 @@ function run({ mode, basepath = '' }) {
|
||||
assert.equal(title, 'encöded');
|
||||
});
|
||||
});
|
||||
|
||||
it('resets scroll when a link is clicked', () => {
|
||||
return nightmare.goto(`${base}/blog/a-very-long-post`)
|
||||
.init()
|
||||
.evaluate(() => window.scrollTo(0, 200))
|
||||
.click('[href="blog/another-long-post"]')
|
||||
.wait(100)
|
||||
.evaluate(() => window.scrollY)
|
||||
.then(scrollY => {
|
||||
assert.equal(scrollY, 0);
|
||||
});
|
||||
});
|
||||
|
||||
it('preserves scroll when a link with sapper-noscroll is clicked', () => {
|
||||
return nightmare.goto(`${base}/blog/a-very-long-post`)
|
||||
.init()
|
||||
.evaluate(() => window.scrollTo(0, 200))
|
||||
.click('[href="blog/another-long-post"][sapper-noscroll]')
|
||||
.wait(100)
|
||||
.evaluate(() => window.scrollY)
|
||||
.then(scrollY => {
|
||||
assert.equal(scrollY, 200);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('headers', () => {
|
||||
|
||||
Reference in New Issue
Block a user