basic.html (991B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 5 <script> 6 async_test(t => { 7 navigation.onnavigate = t.unreached_func("navigate must not fire"); 8 navigation.onnavigatesuccess = t.unreached_func("navigatesuccess must not fire"); 9 navigation.onnavigateerror = t.unreached_func("navigateerror must not fire"); 10 11 assert_equals(navigation.currentEntry.getState(), undefined, "Navigation API state starts out as undefined"); 12 assert_equals(history.state, null, "history.state starts out as null"); 13 14 const newState = { key: "value" }; 15 16 navigation.updateCurrentEntry({ state: newState }); 17 18 assert_equals(navigation.currentEntry.getState().key, "value"); 19 assert_not_equals(navigation.currentEntry.getState(), newState); 20 assert_equals(history.state, null); 21 22 // Wait a tick to make sure no events fire asynchronously. 23 t.step_timeout(() => t.done(), 0); 24 }, "updateCurrentEntry() works as expected"); 25 </script>