navigate-history-push-not-loaded.html (905B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script src="resources/helpers.js"></script> 5 6 <script> 7 promise_test(async t => { 8 let start_length = navigation.entries().length; 9 let start_index = navigation.currentEntry.index; 10 // Purposefully do not wait until after the load event (unlike some sibling tests). 11 assert_equals(document.readyState, "loading", "Document must not have loaded yet"); 12 13 let navigateEventType; 14 navigation.onnavigate = e => navigateEventType = e.navigationType; 15 16 await navigation.navigate("#1", { history: "push" }).finished; 17 assert_equals(navigateEventType, "push"); 18 assert_equals(navigation.entries().length, start_length+1); 19 assert_equals(navigation.currentEntry.index, start_index+1); 20 }, "navigate() with history: 'push' in a document that has not yet had its load event"); 21 </script>