Files
kandev/apps/web/lib/state/layout-manager/presets.test.ts
T
José Almeida b4ce4d6eef refactor(web): improve compact desktop layouts (#937)
* refactor(web): improve compact desktop layouts

* fix(web): address compact desktop review feedback

* fix(web): address responsive review followups

* fix(web): preserve compact sidebar restore sizing

* fix(web): harden compact preset sidebar test

* refactor(web): extract dockview layout hooks
2026-05-18 23:08:14 +01:00

30 lines
1.4 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { compactLayout, defaultLayout, getPresetSidebarColumn } from "./presets";
describe("layout presets", () => {
it("keeps the compact workbench on Dockview while prioritizing the center panel", () => {
const compact = compactLayout();
const compactSidebar = compact.columns.find((column) => column.id === "sidebar");
const defaultSidebarMaxWidth =
defaultLayout().columns.find((column) => column.id === "sidebar")?.maxWidth ??
Number.POSITIVE_INFINITY;
expect(compact.columns.map((column) => column.id)).toEqual(["sidebar", "center"]);
const compactSidebarWidth = compactSidebar?.width ?? Number.POSITIVE_INFINITY;
const compactSidebarMaxWidth = compactSidebar?.maxWidth ?? Number.POSITIVE_INFINITY;
expect(compactSidebarWidth).toBeLessThan(defaultSidebarMaxWidth);
expect(compactSidebarMaxWidth).toBeLessThan(defaultSidebarMaxWidth);
expect(compact.columns.find((column) => column.id === "center")?.groups[0].panels[0].id).toBe(
"chat",
);
});
it("returns compact sidebar sizing for compact preset restoration", () => {
const compactSidebar = compactLayout().columns.find((column) => column.id === "sidebar");
expect(getPresetSidebarColumn("compact")).toEqual(compactSidebar);
expect(getPresetSidebarColumn("compact").width).toBe(220);
expect(getPresetSidebarColumn("compact").maxWidth).toBe(260);
});
});