77 lines
2.1 KiB
TypeScript
77 lines
2.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import {
|
|
clampAgentPanelWidth,
|
|
getAgentPanelMaxWidth,
|
|
getWorkbenchBasemapTone,
|
|
getWorkbenchCameraPadding,
|
|
getWorkbenchViewportLayout
|
|
} from "./workbench-layout";
|
|
|
|
describe("workbench basemap surface tone", () => {
|
|
it.each([
|
|
["mapbox-light", "light"],
|
|
["mapbox-satellite", "satellite"],
|
|
["none", "none"],
|
|
["unknown", "none"]
|
|
])("maps %s to %s", (baseLayerId, expectedTone) => {
|
|
expect(getWorkbenchBasemapTone(baseLayerId)).toBe(expectedTone);
|
|
});
|
|
});
|
|
|
|
describe("workbench floating panels", () => {
|
|
it("uses bounded desktop and wide panel widths", () => {
|
|
expect(getWorkbenchViewportLayout(1440)).toMatchObject({
|
|
agentWidth: 460,
|
|
conditionWidth: 432,
|
|
conditionExpandedWidth: 880,
|
|
toolbarWidth: 48
|
|
});
|
|
expect(getWorkbenchViewportLayout(1536)).toMatchObject({
|
|
agentWidth: 500,
|
|
conditionExpandedWidth: 960
|
|
});
|
|
});
|
|
|
|
it("tracks the expanded condition panel in camera padding", () => {
|
|
expect(
|
|
getWorkbenchCameraPadding(1440, {
|
|
agentOpen: true,
|
|
conditionOpen: true,
|
|
conditionExpanded: false
|
|
})
|
|
).toEqual({ top: 72, right: 504, bottom: 32, left: 484 });
|
|
|
|
expect(
|
|
getWorkbenchCameraPadding(1440, {
|
|
agentOpen: true,
|
|
conditionOpen: true,
|
|
conditionExpanded: true
|
|
})
|
|
).toEqual({ top: 72, right: 952, bottom: 32, left: 484 });
|
|
});
|
|
|
|
it("uses the committed Agent width without exceeding the hard limit", () => {
|
|
expect(
|
|
getWorkbenchCameraPadding(1920, {
|
|
agentOpen: true,
|
|
agentWidth: 620,
|
|
conditionOpen: true
|
|
})
|
|
).toEqual({ top: 72, right: 504, bottom: 32, left: 644 });
|
|
|
|
expect(
|
|
getWorkbenchCameraPadding(1920, {
|
|
agentOpen: true,
|
|
agentWidth: 900,
|
|
conditionOpen: false
|
|
}).left
|
|
).toBe(644);
|
|
});
|
|
|
|
it("reserves room for the compact condition panel on narrow desktops", () => {
|
|
expect(getAgentPanelMaxWidth(1024)).toBe(484);
|
|
expect(clampAgentPanelWidth(620, 1024)).toBe(484);
|
|
expect(getAgentPanelMaxWidth(1440)).toBe(620);
|
|
});
|
|
});
|