summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/popovers/popover-animated-hide-display.tentative.html
blob: 5a59a9556daa8a1fd31cf53868fa83effc9a63e4 (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
<!DOCTYPE html>
<html class="reftest-wait">
<meta charset="utf-8">
<link rel=author href="mailto:masonf@chromium.org">
<link rel=help href="https://open-ui.org/components/popup.research.explainer">
<link rel=match href="popover-animated-display-ref.tentative.html">

<div popover>This is a popover</div>
<div class=topmost></div>

<style>
  [popover] {
    width: 100px;
    height: 100px;
    margin: 1em;
    left: 0;
    transition: left 20s steps(2, jump-end) -10s;
  }
  [popover]:open {
    left: 200px;
  }
  .topmost {
    position:fixed;
    z-index: 999999;
    top:0;
    left:0;
    width:1000px;
    height:1000px;
    background:green;
    margin:0;
    padding:0;
  }
</style>

<script>
window.onload = () => {
  requestAnimationFrame(() => {
    requestAnimationFrame(() => {
      // This will show the popover, hide the popover, and start the transition.
      const popover = document.querySelector('[popover]');
      popover.showPopover();
      popover.getAnimations()[0].finish();
      if (getComputedStyle(popover).left != "200px")
        popover.remove();
      popover.hidePopover();
      document.getAnimations()[0].ready.then(() => {
        requestAnimationFrame(() => {
          requestAnimationFrame(() => {
            // Take a screenshot now.
            document.documentElement.classList.remove('reftest-wait');
          });
        });
      });
    });
  });
}
</script>