Skip to content

Commit 5d46f79

Browse files
test(compiler): cover the prefers-color-scheme media feature
Only light-dark() reached prefers-color-scheme in a test, and the compiler synthesises that condition itself, so the parse of an authored (prefers-color-scheme: dark) was untested.
1 parent 801be0a commit 5d46f79

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎src/__tests__/compiler/media-query.test.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,11 @@ test("@media (hover: hover)", () => {
4343
],
4444
});
4545
});
46+
47+
test.each(["dark", "light"])("@media (prefers-color-scheme: %s)", (scheme) => {
48+
const rule = compile(
49+
`@media (prefers-color-scheme: ${scheme}) { .my-class { color: red; } }`,
50+
).stylesheet().s?.[0]?.[1][0];
51+
52+
expect(rule?.m).toStrictEqual([["=", "prefers-color-scheme", scheme]]);
53+
});

0 commit comments

Comments
 (0)