navigation-navigate-same-doc.html (904B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script> 5 promise_test(async t => { 6 let start_index = navigation.currentEntry.index; 7 8 // Wait for after the load event so that the navigation doesn't get converted 9 // into a replace navigation. 10 await new Promise(resolve => window.onload = () => t.step_timeout(resolve, 0)); 11 12 let oncurrententrychange_called = false; 13 navigation.oncurrententrychange = t.step_func(e => { 14 oncurrententrychange_called = true; 15 assert_equals(e.from, navigation.entries()[start_index]); 16 assert_equals(e.navigationType, "push"); 17 assert_equals(navigation.currentEntry.index, start_index + 1); 18 }); 19 let result = navigation.navigate("#foo"); 20 assert_true(oncurrententrychange_called); 21 await result.committed; 22 }, "currententrychange fires for navigation.navigate()"); 23 </script>