forked from mirrors/gecko-dev
		
	 87192c6c70
			
		
	
	
		87192c6c70
		
	
	
	
	
		
			
			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
		
			
				
	
	
		
			33 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			33 lines
		
	
	
	
		
			1.1 KiB
		
	
	
	
		
			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));
 | |
|   let start_url = location.href;
 | |
|   await navigation.navigate("#frag").finished;
 | |
|   assert_not_equals(window.scrollY, 0);
 | |
| 
 | |
|   let intercept_resolve;
 | |
|   let navigate_event;
 | |
|   navigation.onnavigate = e => {
 | |
|     navigate_event = e;
 | |
|     e.intercept({ handler: () => new Promise(r => intercept_resolve = r),
 | |
|                   scroll: "manual" });
 | |
|   };
 | |
|   let promises = navigation.navigate(start_url);
 | |
|   await promises.committed;
 | |
|   assert_not_equals(window.scrollY, 0);
 | |
|   navigate_event.scroll();
 | |
|   assert_equals(window.scrollY, 0);
 | |
|   intercept_resolve();
 | |
|   await promises.finished;
 | |
|   assert_equals(window.scrollY, 0);
 | |
| }, "scroll: scroll() should reset scroll position when the destination url contains no fragment");
 | |
| </script>
 | |
| </body>
 |