wpt / svg / animations / animate-display-to-none-001.html

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

/svg/animations/animate-display-to-none-001.html

<!doctype html>
<meta charset="utf-8">
<title>Test that underlying style gets restored when seeking away from the
  'to' portion of a SVG/SMIL animation to 'display:none'</title>
<link rel="help" href="https://www.w3.org/TR/smil-animation/#ToAttribute">
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
<link rel="match" href="../struct/reftests/reference/green-100x100.html">
<script>
  function go() {
    svgElem.pauseAnimations();

    /* Seek to 75% of the way through duration, when the animation should be
     * imposing the "to" value. (This is necessary to trigger the bug
     * that we're regression-testing for here.) */
    svgElem.setCurrentTime(3);

    /* Now, seek back to 25% of the way through duration, when the underlying
     * value should be restored. This should make the green rect show up
     * in our reftest screenshot. */
    svgElem.setCurrentTime(1);
  }
</script>
<body onload="go()">
<svg id="svgElem">
  <rect width="100" height="100" fill="red"/>
  <rect width="100" height="100" fill="green">
    <animate attributeName="display" to="none"
             begin="0s" dur="4s"/>
  </rect>
</svg>

/svg/struct/reftests/reference/green-100x100.html

<!DOCTYPE html>
<div style="width: 100px; height: 100px; background-color: green"></div>