import { describe, expect, it } from "vitest"; import { createBackgroundSchema } from "../react/canvas/canvas-shell-test-utils"; import { getToolcraftCanvasBackgroundState } from "./canvas-background-state"; describe("Toolcraft canvas background state", () => { it("derives the standard Background pair from explicit evaluated values", () => { const schema = createBackgroundSchema(); expect( getToolcraftCanvasBackgroundState({ schema, values: { "appearance.background": "#14B8A6", "export.includeBackground": true, }, }), ).toEqual({ color: "#14B8A6", enabled: true }); expect( getToolcraftCanvasBackgroundState({ schema, values: { "appearance.background": "#14B8A6", "export.includeBackground": false, }, }), ).toEqual({ color: "#14B8A6", enabled: false }); }); it("uses the canonical color default for invalid evaluated ingress", () => { expect( getToolcraftCanvasBackgroundState({ schema: createBackgroundSchema(), values: { "appearance.background": { hex: "#14B8A6" }, "export.includeBackground": true, }, }), ).toEqual({ color: "#D4CECA", enabled: true }); }); });