1
0
Fork 0
firefox/testing/web-platform/tests/navigation-api/currententrychange-event/navigation-updateCurrentEntry.html
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

20 lines
834 B
HTML

<!doctype html>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(t => {
let oncurrententrychange_count = 0;
navigation.oncurrententrychange = t.step_func(e => {
oncurrententrychange_count++;
assert_equals(e.from, navigation.currentEntry);
assert_equals(e.navigationType, null);
assert_equals(navigation.currentEntry.getState(), "newState");
});
navigation.updateCurrentEntry({ state: "newState" });
assert_equals(oncurrententrychange_count, 1);
// "Updating" the state to the current state should still fire currententrychange.
navigation.updateCurrentEntry({ state: navigation.currentEntry.getState() });
assert_equals(oncurrententrychange_count, 2);
}, "currententrychange fires for navigation.updateCurrentEntry()");
</script>