import { expect, test } from "@playwright/test"; import { clampWorkspacePanelWidth, getInitialWorkspacePanelWidth, WORKSPACE_PANEL_MAX_WIDTH, WORKSPACE_PANEL_MIN_WIDTH, WORKSPACE_PANEL_WIDTH_STORAGE_KEY, } from "../../lib/canvas/asset-manager"; test.describe("video canvas asset manager", () => { test("uses the official storage key and limits", () => { expect(WORKSPACE_PANEL_WIDTH_STORAGE_KEY).toBe( "libtv:workspacePanelDrawer:width", ); expect(WORKSPACE_PANEL_MIN_WIDTH).toBe(240); expect(WORKSPACE_PANEL_MAX_WIDTH).toBe(380); }); test("clamps and rounds the panel width like the competitor", () => { expect(clampWorkspacePanelWidth(359.5, 1512)).toBe(360); expect(clampWorkspacePanelWidth(120, 1512)).toBe(240); expect(clampWorkspacePanelWidth(999, 1512)).toBe(380); expect(clampWorkspacePanelWidth(999, 300)).toBe(252); expect(clampWorkspacePanelWidth(999, 40)).toBe(0); }); test("restores a saved width and otherwise uses the responsive default", () => { expect(getInitialWorkspacePanelWidth(1512, "360")).toBe(360); expect(getInitialWorkspacePanelWidth(1512, "bad-value")).toBe(240); expect(getInitialWorkspacePanelWidth(1520)).toBe(240); expect(getInitialWorkspacePanelWidth(1521)).toBe(280); }); });