navigate-same-document.html (1327B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <meta name="variant" content="?no-currententrychange"> 5 <meta name="variant" content="?currententrychange"> 6 7 <script type="module"> 8 import { Recorder, hasVariant } from "./resources/helpers.mjs"; 9 10 promise_test(async t => { 11 // Wait for after the load event so that the navigation doesn't get converted 12 // into a replace navigation. 13 await new Promise(resolve => window.onload = () => t.step_timeout(resolve, 0)); 14 15 const recorder = new Recorder({ 16 skipCurrentChange: !hasVariant("currententrychange"), 17 finalExpectedEvent: "finished fulfilled" 18 }); 19 20 recorder.setUpNavigationAPIListeners(); 21 22 const result = navigation.navigate("#1"); 23 recorder.setUpResultListeners(result); 24 25 Promise.resolve().then(() => recorder.record("promise microtask")); 26 27 await recorder.readyToAssert; 28 29 recorder.assert([ 30 /* event name, location.hash value, navigation.transition properties */ 31 ["navigate", "", null], 32 ["currententrychange", "#1", null], 33 ["committed fulfilled", "#1", null], 34 ["promise microtask", "#1", null], 35 ["navigatesuccess", "#1", null], 36 ["finished fulfilled", "#1", null], 37 ]); 38 }, "event and promise ordering for same-document navigation.navigate()"); 39 </script>