Skip to content

Commit

Permalink
Update nwsapi and add a test for getComputedStyle
Browse files Browse the repository at this point in the history
pin nwsapi to bugfix commit
  • Loading branch information
alonidiom committed Dec 10, 2023
1 parent 0656631 commit 0938de3
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 5 deletions.
10 changes: 6 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"http-proxy-agent": "^7.0.0",
"https-proxy-agent": "^7.0.2",
"is-potential-custom-element-name": "^1.0.1",
"nwsapi": "^2.2.7",
"nwsapi": "dperini/nwsapi#cd912dcce4dcb407f694e46eeb93dfc3fab6281e",
"parse5": "^7.1.2",
"rrweb-cssom": "^0.6.0",
"saxes": "^6.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!DOCTYPE html>
<meta charset="utf-8" />
<title>Computed color is inherited correctly</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<!-- Test for https://github.com/jsdom/jsdom/issues/3607 -->

<style>
.test-1, .test-2 {
color: rgb(255, 0, 0);
}

.test-1:hover,
.test-2:hover {
color: rgb(0, 0, 255);
}

.test-2:has(span) {
color: rgb(0, 255, 0);
}
</style>

<body>
<div class="test-1">
<p id="p1">test</p>
</div>
<div class="test-2">
<p id="p2">test</p>
</div>
</body>

<script>
"use strict";

test(() => {
const element = document.getElementById("p1");

assert_equals(getComputedStyle(element).color, "rgb(255, 0, 0)");
}, "Initial text color should be red");

test(() => {
const element = document.getElementById("p2");
assert_equals(getComputedStyle(element).color, "rgb(255, 0, 0)");

element.appendChild(document.createElement("span"));

assert_equals(getComputedStyle(element).color, "rgb(0, 255, 0)");
}, "Adding a span should change the text color to green");
</script>

0 comments on commit 0938de3

Please sign in to comment.