tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

font-palette-animation-not-specified-endpoints.html (1983B)


      1 <!DOCTYPE html>
      2 <meta charset="UTF-8">
      3 <title>Font-palette animation with unspecified endpoints keyframes</title>
      4 <link rel="help" href="https://www.w3.org/TR/css-fonts-4/#propdef-font-palette">
      5 <meta name="assert" content="Font-palette should be animated if `from` and `to` keyframes are not specified.">
      6 
      7 <script src="/resources/testharness.js"></script>
      8 <script src="/resources/testharnessreport.js"></script>
      9 <style>
     10  @font-face {
     11    font-family: "COLR-test-font";
     12    src: url("../resources/COLR-palettes-test-font.ttf") format("truetype");
     13  }
     14  @font-palette-values --custom {
     15    font-family: "COLR-test-font";
     16    base-palette: 3;
     17  }
     18  @keyframes animFrom {
     19    from {
     20      font-palette: --custom;
     21    }
     22  }
     23  @keyframes animTo {
     24    to {
     25      font-palette: --custom;
     26    }
     27  }
     28  .demo {
     29    font-family: "COLR-test-font";
     30    font-size: 130px;
     31  }
     32  .animFrom {
     33    animation: animFrom 0.1s forwards;
     34  }
     35  .animTo {
     36    animation: animTo 0.1s forwards;
     37  }
     38 </style>
     39 
     40 <body>
     41  <div class="demo">
     42    <div id="a" class="animTo">A</div>
     43    <div id="b" class="animFrom" style="font-palette: --custom;">A</div>
     44  </div>
     45 </body>
     46 
     47 <script>
     48  var afterPaletteAnimationTest1 = async_test(
     49    "Verify font-palette is animated when `from` keyframe is not specified"
     50  );
     51  document.getElementById("a").addEventListener("animationend",
     52    afterPaletteAnimationTest1.step_func_done(function() {
     53        assert_equals(window.getComputedStyle(
     54                document.getElementById("a"))
     55            .getPropertyValue('font-palette'), "--custom");
     56    }));
     57 
     58  var afterPaletteAnimationTest2 = async_test(
     59    "Verify font-palette is animated when `to` keyframe is not specified"
     60  );
     61  document.getElementById("b").addEventListener("animationend",
     62    afterPaletteAnimationTest2.step_func_done(function() {
     63        assert_equals(window.getComputedStyle(
     64                document.getElementById("b"))
     65            .getPropertyValue('font-palette'), "normal");
     66    }));
     67 </script>