summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/navigation-api/navigation-methods/navigate-info-and-state.html
blob: 828d7daea57bda8e00ad775f534e52a9e2ce6273 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
promise_test(async t => {
  let navInfo = { nav : "info" };
  let navState = { statevar: "state" };
  let onnavigated_called = false;
  navigation.onnavigate = t.step_func(e => {
    onnavigated_called = true;
    assert_equals(e.info, navInfo)
  });
  await navigation.navigate("#1", { info: navInfo, state: navState }).committed;
  assert_true(onnavigated_called);
  assert_not_equals(navigation.currentEntry.getState(), navState);
  assert_equals(navigation.currentEntry.getState().statevar, navState.statevar);
}, "navigate() with info and state");
</script>