mirror of
https://gh-proxy.org/https://github.com/klinsmaya/multica.git
synced 2026-11-10 10:26:46 +08:00
* feat(ui-lab): add shared component design workbench * feat(ui-lab): support English and Chinese * feat(ui-lab): scaffold design system catalog * fix(ui-lab): cover narrow headers and CI path filtering * feat(ui-lab): add dialog motion and component usage rules * feat(ui-lab): add semantic color workbench * fix(ui): update brand color to #0070E3 * feat(ui-lab): add color usage and live contrast checks * feat(ui-lab): support collapsible sidebars * fix(ui-lab): place collapse controls in sidebar headers * fix(ui-lab): avoid repeating page titles in breadcrumbs * test(agent): synchronize Cursor background finalization fixture * fix(ui-lab): preserve contrast and list scroll restoration (MUL-7425) Co-authored-by: multica-agent <[email protected]> --------- Co-authored-by: Lambda <[email protected]> Co-authored-by: multica-agent <[email protected]>
39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
// @vitest-environment node
|
|
import { describe, expect, it } from "vitest";
|
|
import { emptyDraft, numericTokenValue } from "./tokens";
|
|
import { isDialogCommand, isPreviewSettings } from "./protocol";
|
|
|
|
describe("motion preview boundary", () => {
|
|
it("accepts only supported playback speeds and commands", () => {
|
|
const message = {
|
|
type: "multica-ui-lab:preview",
|
|
selectedColor: "--brand",
|
|
draft: emptyDraft(),
|
|
theme: "light",
|
|
scene: "motion",
|
|
buttonScale: "default",
|
|
locale: "en",
|
|
};
|
|
for (const playbackSpeed of [1, 0.5, 0.25])
|
|
expect(isPreviewSettings({ ...message, playbackSpeed })).toBe(true);
|
|
for (const playbackSpeed of [0, -1, 2, Infinity, "1", null, undefined])
|
|
expect(isPreviewSettings({ ...message, playbackSpeed })).toBe(false);
|
|
for (const action of ["open", "close", "replay"])
|
|
expect(isDialogCommand({ type: "multica-ui-lab:dialog", action })).toBe(
|
|
true,
|
|
);
|
|
for (const value of [
|
|
null,
|
|
{},
|
|
{ type: "multica-ui-lab:dialog", action: "execute" },
|
|
{ type: "other", action: "open" },
|
|
])
|
|
expect(isDialogCommand(value)).toBe(false);
|
|
});
|
|
it("formats scrubbed numeric values with their declared units", () => {
|
|
expect(numericTokenValue("--dialog-enter-duration", 320)).toBe("320ms");
|
|
expect(numericTokenValue("--button-height-default", 32)).toBe("32px");
|
|
expect(() => numericTokenValue("--unknown", 32)).toThrow();
|
|
});
|
|
});
|