constructor.html (1031B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script> 5 test(() => { 6 assert_throws_js(TypeError, () => { 7 new NavigationCurrentEntryChangeEvent("currententrychange"); 8 }); 9 }, "can't bypass required members by omitting the dictionary entirely"); 10 11 test(() => { 12 assert_throws_js(TypeError, () => { 13 new NavigationCurrentEntryChangeEvent("currententrychange", { 14 navigationType: "push" 15 }); 16 }); 17 }, "from is required"); 18 19 test(() => { 20 const event = new NavigationCurrentEntryChangeEvent("currententrychange", { 21 navigationType: "replace", 22 from: navigation.currentEntry 23 }); 24 assert_equals(event.navigationType, "replace"); 25 assert_equals(event.from, navigation.currentEntry); 26 }, "all properties are reflected back"); 27 28 test(t => { 29 const event = new NavigationCurrentEntryChangeEvent("currententrychange", { from: navigation.currentEntry }); 30 assert_equals(event.navigationType, null); 31 }, "defaults are as expected"); 32 </script>