wpt / css / css-view-transitions / scoped / box-decoration-painting.html

Status: PASS | Duration: 28ms | Subtests: 1/1 | Open test on wpt.live | Open ref on wpt.live | wpt.fyi

/css/css-view-transitions/scoped/box-decoration-painting.html

<!DOCTYPE html>
<html class="reftest-wait">
<meta charset="utf-8">
<meta name="title" content="Scoped VT: border and box shadow root painting">
<meta name="author" content="mailto:vmpstr@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-2/">
<link rel="match" href="box-decoration-painting-ref.html">
<script src="/common/reftest-wait.js"></script>
<script src="/web-animations/testcommon.js"></script>
<style>
#target {
  position: relative;
  top: 30px;
  left: 30px;

  width: 200px;
  height: 300px;

  background: blue;
  border-width: 5px 10px 15px 20px;
  border-style: solid;
  border-color: yellow;

  box-shadow: 10px 5px 0px 20px black;
}

/* This is needed since we inherit from the scope and make the scope
   not visible in the VT callback
*/
::view-transition { visibility: visible; }

::view-transition-group(*) {
  animation-play-state: paused;
}
::view-transition-old(*) {
  animation: unset;
  opacity: 1;
}
::view-transition-new(*) {
  animation: unset;
  opacity: 0;
}
#target.after {
  visibility: hidden;
}
</style>

<div id=target></div>

<script>
failIfNot(target.startViewTransition, "Missing element.startViewTransition");

function runTest() {
  target.startViewTransition(() => {
    target.classList.add("after");
  }).ready.then(takeScreenshot);
}

waitForCompositorReady().then(runTest);
</script>

/css/css-view-transitions/scoped/box-decoration-painting-ref.html

<!DOCTYPE html>
<meta charset="utf-8">
<meta name="title" content="Scoped VT: border and box shadow root painting (ref)">
<meta name="author" content="mailto:vmpstr@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-view-transitions-2/">

<style>
#target {
  position: relative;
  top: 30px;
  left: 30px;

  width: 200px;
  height: 300px;

  background: blue;
  border-width: 5px 10px 15px 20px;
  border-style: solid;
  border-color: yellow;

  box-shadow: 10px 5px 0px 20px black;
}
</style>

<div id=target></div>

<script>
failIfNot(target.startViewTransition, "Missing element.startViewTransition");

function runTest() {
  target.startViewTransition(() => {
    target.classList.add("after");
  }).ready.then(takeScreenshot);
}

waitForCompositorReady().then(runTest);
</script>