Skip to content

Commit d526a07

Browse files
authored
Add regression test for getComputedStyle() liveness
See #3562.
1 parent 34c7d6e commit d526a07

2 files changed

Lines changed: 23 additions & 0 deletions

File tree

test/web-platform-tests/to-upstream-expectations.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ css/css-nesting/nested-media-in-layer.html: [fail, https://github.com/jsdom/jsdo
1212
css/css-values/calc-parentheses.html: [fail, calc() values not resolved to computed values; https://github.com/jsdom/jsdom/issues/3538]
1313
css/cssom/getComputedStyle-fontFamily.html:
1414
"Child element inherits the fontFamily value from its parent": [fail, https://github.com/jsdom/jsdom/issues/3614]
15+
css/cssom/getComputedStyle-live.html: [fail, https://github.com/jsdom/jsdom/issues/3562]
1516
css/cssom/getComputedStyle-opacity.html: [fail, https://github.com/jsdom/jsdom/issues/3339]
1617
css/cssom/getComputedStyle-root-variables.html: [fail, https://github.com/jsdom/jsdom/issues/3563]
1718
css/cssom/getComputedStyle-shadow-host.html: [fail, https://github.com/jsdom/jsdom/issues/3661]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<meta charset="utf-8">
3+
<title>getComputedStyle() returns live values</title>
4+
<link rel="help" href="https://drafts.csswg.org/cssom/#dom-window-getcomputedstyle">
5+
<script src="/resources/testharness.js"></script>
6+
<script src="/resources/testharnessreport.js"></script>
7+
<!-- regression test for https://github.com/jsdom/jsdom/issues/3562 -->
8+
9+
<div id="div"></div>
10+
11+
<script>
12+
"use strict";
13+
14+
test(() => {
15+
const div = document.getElementById("div");
16+
const computedStyles = window.getComputedStyle(div);
17+
assert_equals(computedStyles.backgroundColor, "rgba(0, 0, 0, 0)", "before");
18+
19+
div.style.setProperty("background-color", "red");
20+
assert_equals(computedStyles.backgroundColor, "rgb(255, 0, 0)", "after");
21+
});
22+
</script>

0 commit comments

Comments
 (0)