blob: 830a40e0608accfdcd4ff07890d78734593de0f7 (
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
|
<!DOCTYPE html>
<meta charset="utf-8">
<title>Popover close request behavior</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/testdriver.js"></script>
<script src="/resources/testdriver-actions.js"></script>
<script src="/resources/testdriver-vendor.js"></script>
<script src="/common/top-layer.js"></script>
<script src="/close-watcher/resources/helpers.js"></script>
<div popover id=p1>
Inside popover 1
<div popover id=p2>Inside popover 2</div>
</div>
<script>
promise_test(async () => {
const popover1 = document.querySelector('#p1');
const popover2 = document.querySelector('#p2');
popover1.showPopover();
// Bless the opening of popover2, so it doesn't get grouped with popover1 by
// the close watcher infrastructure.
await blessTopLayer(popover1);
popover2.showPopover();
assert_true(popover1.matches(':popover-open'), "Starting: popover1 must be open");
assert_true(popover2.matches(':popover-open'), "Starting: popover2 must be open");
await sendCloseRequest();
assert_true(popover1.matches(':popover-open'), "After one close request, popover1 must be open");
assert_false(popover2.matches(':popover-open'), "After one close request, popover2 must be closed");
await sendCloseRequest();
assert_false(popover1.matches(':popover-open'), "After two close requests, popover1 must be closed");
assert_false(popover2.matches(':popover-open'), "After two close requests, popover2 must be closed");
});
</script>
|