fix(css): scope the subject compound so theme-dark rules keep matching

This commit is contained in:
hh
2026-08-29 19:50:03 +02:00
parent b619c75119
commit 126e8b0451
2 changed files with 32 additions and 3 deletions
+12
View File
@@ -48,6 +48,18 @@ describe("scoping the built stylesheet", () => {
);
});
it("scopes the subject, so an ancestor outside the root still matches", () => {
expect(one(".theme-dark .hue-chip{c:1}")).toBe(
".theme-dark :is(.beaver-root, .beaver-root *).hue-chip { c: 1; }"
);
expect(one(".a > button{c:2}")).toBe(
".a > button:is(.beaver-root, .beaver-root *) { c: 2; }"
);
expect(one(".a *{c:3}")).toBe(
".a :is(.beaver-root, .beaver-root *) { c: 3; }"
);
});
it("leaves rules that already name the root alone", () => {
const reset = ".beaver-root.beaver-root button{cursor:pointer}";
expect(one(reset)).toBe(