-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Expand file tree
/
Copy pathscroll-state-scrollable-container-type-change.html
More file actions
59 lines (55 loc) · 2.15 KB
/
Copy pathscroll-state-scrollable-container-type-change.html
File metadata and controls
59 lines (55 loc) · 2.15 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
<!DOCTYPE html>
<title>@container: scroll-state(scrollable) property changes</title>
<link rel="help" href="https://drafts.csswg.org/css-conditional-5/#scrollable">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/css-conditional/container-queries/support/cq-testcommon.js"></script>
<script src="/css/css-transitions/support/helper.js"></script>
<style>
#scroller {
container-type: scroll-state;
overflow: auto;
width: 100px;
height: 100px;
}
#target {
width: 200px;
height: 200px;
--scrollable: no;
@container scroll-state(scrollable) {
--scrollable: yes;
}
}
</style>
<div id="scroller">
<div id="target"></div>
</div>
<script>
setup(() => assert_implements_scroll_state_container_queries());
promise_test(async t => {
await waitForAnimationFrames(2);
assert_equals(getComputedStyle(target).getPropertyValue("--scrollable"), "yes");
}, "Check scroll-state(scrollable) initially matching");
promise_test(async t => {
t.add_cleanup(async () => scroller.style.overflow = "");
scroller.style.overflow = "initial";
await waitForAnimationFrames(2);
assert_equals(getComputedStyle(target).getPropertyValue("--scrollable"), "no",
"overflow removed");
scroller.style.overflow = "";
await waitForAnimationFrames(2);
assert_equals(getComputedStyle(target).getPropertyValue("--scrollable"), "yes",
"overflow re-added");
}, "Check scroll-state(scrollable) not matching when overflow is removed");
promise_test(async t => {
t.add_cleanup(async () => scroller.style.containerType = "");
scroller.style.containerType = "initial";
await waitForAnimationFrames(2);
assert_equals(getComputedStyle(target).getPropertyValue("--scrollable"), "no",
"container-type removed");
scroller.style.containerType = "";
await waitForAnimationFrames(2);
assert_equals(getComputedStyle(target).getPropertyValue("--scrollable"), "yes",
"container-type re-added");
}, "Check scroll-state(scrollable) not matching when container-type is removed");
</script>