mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-02 20:42:11 +02:00
Tests: Import some ::part() tests
This commit is contained in:
Notes:
github-actions[bot]
2025-12-15 14:14:19 +00:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/LadybirdBrowser/ladybird/commit/53609c49cec Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/7077
@@ -0,0 +1,31 @@
|
||||
<!doctype html>
|
||||
<title>CSS Shadow Parts - :host::part() in nesting</title>
|
||||
<link rel="help" href="https://drafts.csswg.org/css-shadow-parts/#part">
|
||||
<link rel="help" href="https://drafts.csswg.org/css-scoping/#host-selector">
|
||||
<link rel="help" href="https://crbug.com/326526716">
|
||||
<script src="../../resources/testharness.js"></script>
|
||||
<script src="../../resources/testharnessreport.js"></script>
|
||||
<div id="host"></div>
|
||||
<script>
|
||||
test(function() {
|
||||
let host = document.getElementById("host");
|
||||
host.attachShadow({ mode: "open" }).innerHTML = `
|
||||
<style>
|
||||
:host {
|
||||
&::part(mypart) {
|
||||
color: lime;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<div part="mypart">This text should be green.</div>
|
||||
`;
|
||||
|
||||
let part = host.shadowRoot.querySelector("[part]");
|
||||
|
||||
assert_equals(
|
||||
window.getComputedStyle(part).color,
|
||||
"rgb(0, 255, 0)",
|
||||
":host::part() works in nesting",
|
||||
);
|
||||
}, ":host::part works in nesting");
|
||||
</script>
|
||||
Reference in New Issue
Block a user