Bug 1760181 [wpt PR 33182] - App history API to navigation API rename (2/n), a=testonly
[gecko.git] / testing / web-platform / tests / navigation-api / currententrychange-event / constructor.html
blob64ea8cf37ebd545cb349e4b0d863be3061851b99
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 AppHistoryCurrentChangeEvent("currententrychange");
8 });
9 }, "can't bypass required members by omitting the dictionary entirely");
11 test(() => {
12 assert_throws_js(TypeError, () => {
13 new AppHistoryCurrentChangeEvent("currententrychange", {
14 navigationType: "push"
15 });
16 });
17 }, "from is required");
19 test(() => {
20 const event = new AppHistoryCurrentChangeEvent("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");
28 test(t => {
29 const event = new AppHistoryCurrentChangeEvent("currententrychange", { from: navigation.currentEntry });
30 assert_equals(event.navigationType, null);
31 }, "defaults are as expected");
32 </script>