Skip to content

The open-source full-stack studio for Opus 5.5 motion video. Reverse engineering for any video. Code video with HTML: recreate, edit and render. BYOA + BYOK · Motion.md · Images, Video, Music & Voice.

1.1 KB
Raw Blame
import { beforeEach, describe, expect, it } from "vitest";
import { useDockLayoutStore } from "./dockLayoutStore";
import type { PanelId } from "./panelRegistry";

const snapshot = (groupActivePanels: PanelId[], activePanel: PanelId | null = null) => ({
  openPanels: new Set<PanelId>(["design", "renders", "compositions"]),
  visiblePanels: new Set<PanelId>(groupActivePanels),
  activePanel,
  groupActivePanels,
});

describe("dock store sync", () => {
  beforeEach(() => useDockLayoutStore.setState({ lastActive: {} }));

  it("records what every side group shows, not only the globally active panel", () => {
    useDockLayoutStore.getState().sync(snapshot(["compositions", "renders"], "compositions"));
    expect(useDockLayoutStore.getState().lastActive).toEqual({
      left: "compositions",
      right: "renders",
    });
  });

  it("forgets the previous dock's memory on detach", () => {
    useDockLayoutStore.getState().sync(snapshot(["renders"], "renders"));
    useDockLayoutStore.getState().detach();
    expect(useDockLayoutStore.getState().lastActive).toEqual({});
  });
});