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

This commit is contained in:
hh committed 2026-08-29 19:50:01 +02:00
1 parent 4f485b0bc4
commit d692dff19a
2 files changed
+36 -5

No files matched your search

+10
View File
@@ -46,6 +46,16 @@ 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(.bcal-root, .bcal-root *).hue-chip { c: 1; }",
);
expect(one(".a > button{c:2}")).toBe(
".a > button:is(.bcal-root, .bcal-root *) { c: 2; }",
);
expect(one(".a *{c:3}")).toBe(".a :is(.bcal-root, .bcal-root *) { c: 3; }");
});
it("leaves rules that already name the root alone", () => {
const reset = ".bcal-root.bcal-root button{cursor:pointer}";
expect(one(reset)).toBe(".bcal-root.bcal-root button { cursor: pointer; }");