navigate-anchor-fragment.html (952B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <a id="a" href="#1"></a> 5 <script> 6 async_test(t => { 7 navigation.onnavigate = t.step_func(e => { 8 assert_equals(e.navigationType, "push"); 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(e.formData, null); 15 assert_equals(new URL(e.destination.url).hash, "#1"); 16 assert_true(e.destination.sameDocument); 17 assert_equals(e.destination.key, ""); 18 assert_equals(e.destination.id, ""); 19 assert_equals(e.destination.index, -1); 20 assert_equals(e.sourceElement, document.getElementById("a")); 21 e.preventDefault(); 22 t.step_timeout(t.step_func_done(() => assert_equals(location.hash, "")), 0); 23 }); 24 a.click(); 25 }, "Fragment <a> click fires navigate event"); 26 </script>