summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/scroll-animations/view-timelines/view-timeline-on-display-none-element.html
blob: 1cc23fe626ab7ee01f2a36331bb983ba12fe2a93 (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
<!DOCTYPE html>
<meta charset="utf-8">
<title>View timeline on element with display:none</title>
<link rel="help" href="https://drafts.csswg.org/scroll-animations-1/#scroll-timelines">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/web-animations/testcommon.js"></script>
<script src="/scroll-animations/scroll-timelines/testcommon.js"></script>
<script src="/scroll-animations/view-timelines/testcommon.js"></script>
<script src="/css/css-typed-om/resources/testhelper.js"></script>

<style>
  #container {
    border: 10px solid lightgray;
    overflow-x: scroll;
    height: 200px;
    width: 200px;
  }
  #content {
    display: flex;
    flex-flow: row nowrap;
    justify-content: flex-start;
    width: 1800px;
    margin: 0;
  }
  .spacer {
    width: 800px;
    display: inline-block;
  }
  #target {
    background-color: green;
    height: 100px;
    width: 100px;
    display: none;
  }
</style>

<div id="container">
  <div id="content">
    <div class="spacer"></div>
    <div id="target"></div>
    <div class="spacer"></div>
  </div>
</div>

<script>
promise_test(async t => {
  const timeline = new ViewTimeline({ subject: target });
  const anim = target.animate({ opacity: [0, 0.5] }, { timeline: timeline });
  t.add_cleanup(() => {
    anim.cancel();
  });
  anim.rangeStart = "1em";
  container.scrollLeft = 750;
  await waitForNextFrame();
  assert_equals(getComputedStyle(target).opacity, "1",
                  "Opacity with inactive timeline");
}, "element with display: none should have inactive viewtimeline");
</script>