summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/html/semantics/popovers/popover-animated-hide-finishes.tentative.html
blob: 79e0b4dcbf67400bdfdb3c93a557dc165ed68e58 (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
<!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-hide-finishes-ref.tentative.html">

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

<style>
  [popover] {
    width: 100px;
    height: 100px;
    margin: 1em;
    left: 0;
    /* Immediate transition: */
    transition: left 1s -1s;
  }
  [popover]:open {
    left: 200px;
  }
  [popover]::backdrop {
    background-color: red;
  }
  .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 hide transition,
      // which should immediately finish.
      document.querySelector('[popover]').showPopover();
      document.querySelector('[popover]').hidePopover();
      requestAnimationFrame(() => {
        requestAnimationFrame(() => {
          // Take a screenshot now.
          document.documentElement.classList.remove('reftest-wait');
        });
      });
    });
  });
}
</script>