Skip to content

Commit b33b616

Browse files
authored
Add test that getComputedStyle() works with !important
Closes #3532.
1 parent 6bf559c commit b33b616

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

test/web-platform-tests/to-upstream/css/cssom/getComputedStyle-important.html

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,19 @@
55
<script src="/resources/testharness.js"></script>
66
<script src="/resources/testharnessreport.js"></script>
77
<!-- Regression test for https://github.com/jsdom/jsdom/issues/2485 -->
8+
<!-- Regression test for https://github.com/jsdom/jsdom/issues/3532 -->
89

910
<style>
1011
#testElement { display: none !important; }
1112
</style>
12-
13+
<style>
14+
#testElement2 { display: none !important; }
15+
</style>
16+
<style>
17+
#testElement2 { display: inline-block; }
18+
</style>
1319
<div id="testElement" style="display: block;"></div>
20+
<div id="testElement2"></div>
1421

1522
<script>
1623
"use strict";
@@ -20,4 +27,10 @@
2027
const style = window.getComputedStyle(element);
2128
assert_equals(style.display, "none");
2229
}, "getComputedStyle should return !important stylesheet value over inline style");
30+
31+
test(() => {
32+
const element = document.getElementById("testElement2");
33+
const style = window.getComputedStyle(element);
34+
assert_equals(style.display, "none");
35+
}, "getComputedStyle should return !important stylesheet value rather than the subsequent stylesheet value");
2336
</script>

0 commit comments

Comments
 (0)