summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/navigation-api/navigation-methods/return-value/navigate-intercept-rejected.html
blob: 79c8bd803e3461a40cdc794a9c7f0fcb36878fed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="resources/helpers.js"></script>

<script>
promise_test(async t => {
  const err = new Error("boo!");
  const promise = Promise.reject(err);
  promise.catch(() => {}); // prevent unhandled rejection testharness.js errors
  navigation.onnavigate = e => e.intercept({ handler: () => promise });

  const result = navigation.navigate("#1");

  await assertCommittedFulfillsFinishedRejectsExactly(t, result, navigation.currentEntry, err);
}, "navigate() and intercept() with a rejected promise");
</script>