fune/testing/web-platform/tests/navigation-api/scroll-behavior/manual-basic.html
Nate Chapin 87192c6c70 Bug 1780442 [wpt PR 34919] - Navigation API: Revamp intercepted-navigation scroll handling, a=testonly
Automatic update from web-platform-tests
Navigation API: Revamp intercepted-navigation scroll handling

Follows https://github.com/WICG/navigation-api/pull/239

Intent to Ship: https://groups.google.com/a/chromium.org/g/blink-dev/c/DKeklNbLG5s

Bug: 1345507
Change-Id: Id5c1b9d77953388dbe287f6403b0a49c8359d51b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3758902
Reviewed-by: Chris Harrelson <chrishtr@chromium.org>
Reviewed-by: Domenic Denicola <domenic@chromium.org>
Commit-Queue: Nate Chapin <japhet@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1026382}

--

wpt-commits: 5fb15e04adca47cc972a2e4c665853aca6a1a5b9
wpt-pr: 34919
2022-07-22 02:09:17 +00:00

20 lines
772 B
HTML

<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<div style="height: 1000px; width: 1000px;"></div>
<div id="frag"></div>
<script>
promise_test(async t => {
// Wait for after the load event so that the navigation doesn't get converted
// into a replace navigation.
await new Promise(resolve => window.onload = () => t.step_timeout(resolve, 0));
assert_equals(window.scrollY, 0);
await navigation.navigate("#frag").finished;
assert_not_equals(window.scrollY, 0);
navigation.onnavigate = e => e.intercept({ scroll: "manual" });
await navigation.back().finished;
assert_not_equals(window.scrollY, 0);
}, "scroll: manual should prevent auto scroll on back.");
</script>
</body>