From: Eduardo San Martin Morote Date: Fri, 1 May 2020 08:04:03 +0000 (+0200) Subject: test(scroll): test stored position over anchor X-Git-Tag: v4.0.0-alpha.10~37 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6da326b8dbbfbdb818e945d3a8026011ebed27bc;p=thirdparty%2Fvuejs%2Frouter.git test(scroll): test stored position over anchor --- diff --git a/e2e/specs/scroll-behavior.js b/e2e/specs/scroll-behavior.js index 7ff21e3b..8fe37646 100644 --- a/e2e/specs/scroll-behavior.js +++ b/e2e/specs/scroll-behavior.js @@ -152,6 +152,28 @@ module.exports = { 'restores scroll position when reloading' ) + // going to an anchor entry, scrolling, then back then forward restores the position + .click('li:nth-child(4) a') + .waitForElementPresent('.view.bar', TIMEOUT) + // at this point we scrolled to the anchor, scroll again somewhere else + // and then go back + .execute(function () { + window.scrollTo(0, 100) + window.history.back() + }) + .waitForElementPresent('.view.foo', TIMEOUT) + .execute(function () { + window.history.forward() + }) + .waitForElementPresent('.view.bar', TIMEOUT) + .assert.evaluate( + function () { + return window.pageYOffset === 100 + }, + null, + 'scroll to stored position over anchor' + ) + // going again to a popped entry should not restore the saved position .click('li:nth-child(1) a') .waitForElementPresent('.view.home', TIMEOUT)