anchor-click.html (700B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <a id="a" href="#foo"></a> 5 <script> 6 test(t => { 7 let start_index = navigation.currentEntry.index; 8 9 let oncurrententrychange_called = false; 10 navigation.oncurrententrychange = t.step_func(e => { 11 oncurrententrychange_called = true; 12 assert_equals(e.from, navigation.entries()[start_index]); 13 assert_equals(e.from.index, start_index); 14 assert_equals(e.navigationType, "push"); 15 assert_equals(navigation.currentEntry.index, start_index + 1); 16 }); 17 a.click(); 18 assert_true(oncurrententrychange_called); 19 }, "currententrychange fires for link click"); 20 </script>