summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-backgrounds/animations/background-color-animation-pseudo-element.html
blob: e5066281d9b9ca82cea0bc3edfa01d8e3bc18ccd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<!DOCTYPE html>
<html class="reftest-wait">
<link rel="help" href="https://drafts.csswg.org/css-backgrounds-3/#background-color">
<link rel="match" href="background-color-animation-pseudo-element-ref.html">
<style>
  body {
    padding:  0;
    margin:  0;
  }
  .block, .block:after, .block:before {
    width:  100px;
    height:  100px;
    padding:  0;
    display:  inline-block;
    /* Use a long transition that can be stalled at the midpoint. */
    transition:  background 100000s cubic-bezier(0,1,1,0);
  }

  .block {
    background:  rgb(0, 254, 0);
    margin-left:  120px;
    margin-top:  10px;
    position: relative;
  }

  .block:after {
    background:  rgb(0, 0, 254);
    content:  "";
    position:  absolute;
    left:  110px;
  }

  .block:before {
    background: rgb(254, 0, 0);
    content: "";
    position:  absolute;
    left:  -110px;
  }

  .block.tweak, .block.tweak:before, .block.tweak:after {
    background:  black;
  }
</style>
<body>
  <div class="block"></div>
</body>
<script src="/common/reftest-wait.js"></script>
<script src="../../../web-animations/testcommon.js"></script>
<script>
  window.onload = async () => {
    await waitForAnimationFrames(2);

    const promises = [];
    document.querySelector('.block').classList.add('tweak');
    document.getAnimations().forEach(anim => {
      anim.currentTime = anim.effect.getTiming().duration/2;
      promises.push(anim.ready);
    });

    Promise.all(promises).then(() => {
      waitForAnimationFrames(2).then(() => {
        takeScreenshot();
      });
    });
  };
</script>
</html>