Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/css-view-transitions/navigation/pageswap-skip-transition.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>View transitions: skipTransition() in pageswap aborts the transition</title>
<link rel="author" href="mailto:khushalsagar@chromium.org">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
@view-transition {
navigation: auto;
}
</style>
<script>
const params = new URLSearchParams(location.search);
const is_initial_page = !params.has('new');
// This test navigates to itself with a changed query parameter. The test
// checks are performed on the navigated-to document.
if (is_initial_page) {
onload = () => {
requestAnimationFrame(() => requestAnimationFrame(() => {
location.replace(location.href + '?new');
}));
};
onpageswap = (e) => {
assert_not_equals(e.viewTransition, null);
e.viewTransition.skipTransition();
};
} else {
promise_test(async () => {
const ev = await new Promise(
resolve => addEventListener('pagereveal', e => resolve(e)));
assert_equals(ev.viewTransition, null,
'viewTransition must have been skipped.');
});
}
</script>