wpt / css / css-view-transitions / navigation / pageswap-after-media-change.html?initial

Open test on wpt.live | wpt.fyi

Runs: Chrome 159.0.8151.0 (wpt@3a4bbe672, 2026-11-09) | Firefox 162.0a1 (wpt@3a4bbe672, 2026-11-09) | Safari 256 preview (wpt@3a4bbe672, 2026-11-09) | Ladybird 1.0-da9df (wpt@f556782c2, 2026-11-09) | Servo Servo 0.8 (wpt@fea36e49d, 2026-11-08) | Blitz b6ace6a0c (wpt@f6789b0b5, 2026-11-09)

ChromeFirefoxSafariLadybirdServoBlitz
Total1/11/11/10/10/10/1
SubtestChromeFirefoxSafariLadybirdServoBlitzBlitz error message
pageswap includes a view transition after initial media matchingPASSPASSPASSTIMEOUTTIMEOUTTIMEOUT
Test timed out

/css/css-view-transitions/navigation/pageswap-after-media-change.html

<!DOCTYPE html>
<meta name="variant" content="?initial">
<meta name="variant" content="?resize">
<title>A media query change updates the outbound view transition opt-in</title>
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-2/#view-transition-rule">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<script>
promise_test(async t => {
  const frame = document.createElement("iframe");
  frame.width = location.search === "?resize" ? "200" : "400";
  frame.src = "resources/pageswap-media-change.html";
  const loaded = new Promise(resolve => frame.onload = resolve);
  document.body.append(frame);
  t.add_cleanup(() => frame.remove());
  await loaded;
  const win = frame.contentWindow;
  const twoFrames = () => new Promise(resolve =>
    win.requestAnimationFrame(() => win.requestAnimationFrame(resolve)));
  await twoFrames();
  if (location.search === "?resize") {
    assert_false(win.matchMedia("(min-width: 300px)").matches);
    frame.width = "400";
    await twoFrames();
  }
  assert_true(win.matchMedia("(min-width: 300px)").matches);
  const swapped = new Promise(resolve => {
    win.addEventListener("pageswap", event => {
      resolve(event.viewTransition !== null);
      event.viewTransition?.skipTransition();
    }, { once: true });
  });
  frame.src = "/resources/blank.html?destination";
  assert_true(await swapped, "The matching rule enables an outbound transition");
}, "pageswap includes a view transition after " + location.search.slice(1) + " media matching");
</script>