Skip to content

Commit c423277

Browse files
Guard the condition-object tokens in both presets
Assert @microbit/ui's droppedConditionTokens alongside the existing key check, for the app preset and (when linked) the brand preset: a flat override of a { base, _onDark } token merges wholesale and silently drops the dark-surface flip.
1 parent c5ca9e2 commit c423277

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

src/deployment/default/panda-preset.test.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33
*
44
* SPDX-License-Identifier: MIT
55
*/
6-
import { unknownSemanticTokens } from "@microbit/ui/preset-lint";
6+
import {
7+
droppedConditionTokens,
8+
unknownSemanticTokens,
9+
} from "@microbit/ui/preset-lint";
710
import { createRequire } from "node:module";
811
import { describe, expect, it } from "vitest";
912
import { appPreset } from "./panda-preset";
@@ -25,6 +28,12 @@ it("app preset overrides only semantic tokens @microbit/ui defines", () => {
2528
expect(unknownSemanticTokens(appPreset, { introduces })).toEqual([]);
2629
});
2730

31+
// A flat override of a { base, _onDark } token merges wholesale and
32+
// silently drops the dark-surface flip — the same failure, one door over.
33+
it("app preset keeps every condition the base preset's tokens carry", () => {
34+
expect(droppedConditionTokens(appPreset)).toEqual([]);
35+
});
36+
2837
// The private brand preset is optional — present only when linked
2938
// (`npm run dev:link-theme`) or installed in a brand build, exactly as
3039
// panda.config.ts treats it. Checked here rather than in its own repo so
@@ -46,4 +55,8 @@ describe.skipIf(!brandPreset)("private brand preset", () => {
4655
it("overrides only semantic tokens @microbit/ui defines", () => {
4756
expect(unknownSemanticTokens(brandPreset, { introduces })).toEqual([]);
4857
});
58+
59+
it("keeps every condition the base preset's tokens carry", () => {
60+
expect(droppedConditionTokens(brandPreset)).toEqual([]);
61+
});
4962
});

0 commit comments

Comments
 (0)