mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-05 10:14:30 +00:00
Panel sizes are reconciled against the window on every resize, with the preview holding a 360x200 floor that panels yield to before it gives. Measured preview pane: 760px window 192 -> 433, 560px window 2 -> 516. Windows at or above 1280px are unchanged. - fitPanels owns the who-yields decision for both axes - panel caps are window-relative, replacing a flat 600px inspector cap - below 860 the sidebar rails, below 700 the inspector collapses too - auto-collapse is derived render state and never writes leftCollapsed (localStorage) or rightCollapsed (synced into the shareable URL) - the rail and header toggles act on the effective state, so neither is a dead click that silently persists a collapse the user never asked for
29 lines
1.1 KiB
TypeScript
29 lines
1.1 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { shouldOpenInspector } from "./StudioHeader";
|
|
|
|
describe("shouldOpenInspector", () => {
|
|
it("opens when the panel is hidden", () => {
|
|
expect(shouldOpenInspector(true, false)).toBe(true);
|
|
});
|
|
|
|
it("opens when a non-inspector tab is showing", () => {
|
|
expect(shouldOpenInspector(false, false)).toBe(true);
|
|
});
|
|
|
|
it("closes when the inspector is genuinely on screen", () => {
|
|
expect(shouldOpenInspector(false, true)).toBe(false);
|
|
});
|
|
|
|
it("opens when the window railed the panel away", () => {
|
|
// The regression this guards: the button used to branch on the raw
|
|
// rightCollapsed intent, which is still `false` while the window has the
|
|
// panel railed. That took the close branch, wrote rightCollapsed=true, and
|
|
// since that value is synced into the shareable Studio URL, a click that
|
|
// did nothing visible rewrote the link.
|
|
const userIntentIsOpen = false;
|
|
const windowRailedItAway = true;
|
|
expect(shouldOpenInspector(windowRailedItAway, true)).toBe(true);
|
|
expect(shouldOpenInspector(userIntentIsOpen, true)).toBe(false);
|
|
});
|
|
});
|