navigate-location.html (845B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <form id="form" action=""></form> 5 <script> 6 async_test(t => { 7 navigation.onnavigate = t.step_func_done(e => { 8 assert_equals(e.navigationType, "replace"); 9 assert_true(e.cancelable); 10 assert_true(e.canIntercept); 11 assert_false(e.userInitiated); 12 assert_true(e.hashChange); 13 assert_equals(e.downloadRequest, null); 14 assert_equals(new URL(e.destination.url).hash, "#1"); 15 assert_true(e.destination.sameDocument); 16 assert_equals(e.destination.key, ""); 17 assert_equals(e.destination.id, ""); 18 assert_equals(e.destination.index, -1); 19 assert_equals(e.formData, null); 20 assert_equals(e.sourceElement, null); 21 }); 22 location.href = "#1"; 23 }, "location API fires navigate event"); 24 </script>