-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Expand file tree
/
Copy pathtoplayer-transition-001.html
More file actions
67 lines (57 loc) · 3.29 KB
/
toplayer-transition-001.html
File metadata and controls
67 lines (57 loc) · 3.29 KB
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
<!DOCTYPE html>
<meta charset="utf-8">
<title>Selectors: top layer transitions should adjust pseudo-classes on ancestors</title>
<link rel="help" href="https://drafts.csswg.org/selectors/#the-hover-pseudo">
<link rel="help" href="https://drafts.csswg.org/selectors/#the-focus-within-pseudo">
<link rel="help" href="https://drafts.csswg.org/css-position-4/#top-layer">
<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>
<style>
[popover] { display: block; }
</style>
<div id="container">
<div id="popover" popover="manual">
<input id="input">
<div id="hoverTarget">hover here</div>
</div>
</div>
<script>
promise_test(async t => {
t.add_cleanup(() => { if (popover.matches(':popover-open')) popover.hidePopover(); });
input.focus();
assert_true(input.matches(':focus'), 'input should be focused');
assert_true(container.matches(':focus-within'), 'container should match :focus-within before showPopover');
popover.showPopover();
assert_true(input.matches(':focus'), 'input should still be focused after showPopover');
assert_true(popover.matches(':focus-within'), 'popover should match :focus-within after showPopover');
assert_false(container.matches(':focus-within'), 'container should not match :focus-within after showPopover');
assert_false(document.body.matches(':focus-within'), 'body should not match :focus-within after showPopover');
popover.hidePopover();
await new Promise(requestAnimationFrame);
assert_true(input.matches(':focus'), 'input should still be focused after hidePopover');
assert_true(container.matches(':focus-within'), 'container should match :focus-within after hidePopover');
assert_true(document.body.matches(':focus-within'), 'body should match :focus-within after hidePopover');
}, ':focus-within should be adjusted on ancestors when popover enters/exits top layer.');
promise_test(async t => {
t.add_cleanup(() => { if (popover.matches(':popover-open')) popover.hidePopover(); });
await new test_driver.Actions()
.pointerMove(1, 1, {origin: hoverTarget})
.send();
await new Promise(requestAnimationFrame);
assert_true(hoverTarget.matches(':hover'), 'hoverTarget should match :hover');
assert_true(container.matches(':hover'), 'container should match :hover before showPopover');
popover.showPopover();
assert_true(hoverTarget.matches(':hover'), 'hoverTarget should still match :hover after showPopover');
assert_true(popover.matches(':hover'), 'popover should match :hover after showPopover');
assert_false(container.matches(':hover'), 'container should not match :hover after showPopover');
assert_false(document.body.matches(':hover'), 'body should not match :hover after showPopover');
popover.hidePopover();
await new Promise(requestAnimationFrame);
assert_true(hoverTarget.matches(':hover'), 'hoverTarget should still match :hover after hidePopover');
assert_true(container.matches(':hover'), 'container should match :hover after hidePopover');
assert_true(document.body.matches(':hover'), 'body should match :hover after hidePopover');
}, ':hover should be adjusted on ancestors when popover enters/exits top layer.');
</script>