Skip to content

Commit 262e8ec

Browse files
tursunovachromium-wpt-export-bot
authored andcommitted
Add wpt test for inline if() invalivation
Bug: 346977961 Change-Id: I211aa0c8abf73c8a1b0f8dbefda45cc1414a19a4 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6258714 Reviewed-by: Anders Hartvoll Ruud <[email protected]> Commit-Queue: Anders Hartvoll Ruud <[email protected]> Cr-Commit-Position: refs/heads/main@{#1419837}
1 parent 91f311f commit 262e8ec

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

css/css-values/if-invalidation.html

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!DOCTYPE html>
2+
<title>CSS Values and Units Test: if() invalidation</title>
3+
<meta name="assert" content="Test if() invalidation">
4+
<link rel="help" href="https://drafts.csswg.org/css-values-5/#if-notation">
5+
<script src="/resources/testharness.js"></script>
6+
<script src="/resources/testharnessreport.js"></script>
7+
<style>
8+
html {
9+
--x: 3;
10+
}
11+
#test {
12+
--prop: if(style(--x: 3): true_value; else: false_value;);
13+
}
14+
</style>
15+
16+
<html>
17+
<body>
18+
<div id="test"></div>
19+
</body>
20+
</html>
21+
22+
<script>
23+
setup({ single_test: true });
24+
let elem = document.getElementById('test');
25+
let old_value = window.getComputedStyle(elem).getPropertyValue('--prop');
26+
assert_equals(old_value, "true_value");
27+
28+
document.documentElement.style.setProperty('--x', '0');
29+
let new_value = window.getComputedStyle(elem).getPropertyValue('--prop');
30+
assert_equals( new_value, "false_value");
31+
assert_not_equals(new_value, old_value);
32+
done();
33+
</script>

0 commit comments

Comments
 (0)