File: get-animations-inactive-timeline.html

package info (click to toggle)
thunderbird 1%3A143.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 4,703,968 kB
  • sloc: cpp: 7,770,492; javascript: 5,943,842; ansic: 3,918,754; python: 1,418,263; xml: 653,354; asm: 474,045; java: 183,079; sh: 111,238; makefile: 20,410; perl: 14,359; objc: 13,059; yacc: 4,583; pascal: 3,405; lex: 1,720; ruby: 999; exp: 762; sql: 715; awk: 580; php: 436; lisp: 430; sed: 69; csh: 10
file content (84 lines) | stat: -rw-r--r-- 2,615 bytes parent folder | download | duplicates (12)
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>getAnimations for scroll-linked animations</title>
<link rel="help"
 href="https://www.w3.org/TR/web-animations-1/#animation-effect-phases-and-states">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/testcommon.js"></script>
<style>
  @keyframes slide {
    from { transform: translateX(100px);  }
    to   { transform: translateX(100px); }
  }

  #container {
    border:  10px solid lightgray;
    overflow-x: scroll;
    height:  200px;
    width: 200px;
    scroll-timeline-name:  --timeline;
  }
  #spacer {
    height:  200vh;
  }
  #target {
    background-color:  green;
    height:  100px;
    width:  100px;
    animation:  slide 1s linear;
    animation-timeline: --timeline;
  }
</style>
<body>
  <div id="container">
    <div id="spacer"></div>
    <div id="target"></div>
  </div>
</body>
<script type="text/javascript">
  setup(assert_implements_animation_timeline);

  promise_test(async t => {
    let animations = document.getAnimations();
    assert_equals(animations.length, 1,
                  'Single running animation');
    assert_true(animations[0].timeline instanceof ScrollTimeline,
                'Animation associated with a scroll timeline');

    // Canceled animation is no longer current.
    const anim = animations[0];
    animations[0].cancel();

    assert_equals(
        document.getAnimations().length, 0,
        'A canceled animation is no longer returned by getAnimations');

    // Replaying an animation makes it current.
    anim.play();
    assert_equals(
        document.getAnimations().length, 1,
        'A play-pending animation is return by getAnimations');

    // Animation effect is still current even if the timeline's source element
    // cannot be scrolled.
    spacer.style = 'display: none';
    t.add_cleanup(() => {
      spacer.style = '';
    });

    animations = document.getAnimations();
    assert_equals(
        animations.length, 1,
        'Running animation is included in getAnimations list even if ' +
        'currentTime is null');
    assert_true(animations[0].timeline  instanceof ScrollTimeline,
                'Animation has timeline associated with an element that ' +
                'cannot be scrolled');
    assert_equals(animations[0].timeline.currentTime, null,
                  'Inactive timeline when timeline\'s source element cannot ' +
                  'be scrolled');
  }, 'getAnimations includes inactive scroll-linked animations that have not ' +
     'been canceled');
</script>