Files
fusion/packages/dashboard/app/components/__tests__/TerminalLauncher.test.tsx
gsxdsm 7034b55288 FN-6887: add footer terminal launcher
Move terminal access from the header into a footer launcher and resizable bottom panel.

- Add a TerminalLauncher footer control with dock, resize, collapse, and pop-out affordances.
- Extend TerminalModal to support bottom-panel layout, drag resizing, and persistent panel state.
- Remove terminal/script controls from header overflow while preserving compact Mailbox and tool ordering.
- Update executor footer spacing, dashboard docs, changeset, and focused terminal/header tests.

Files changed:
 .changeset/fn-6887-terminal-footer-panel.md        |   5 +
 docs/dashboard-guide.md                            |   2 +
 packages/dashboard/app/App.tsx                     |   6 +-
 .../app/__tests__/tablet-header-controls.test.tsx  |  95 +---
 .../dashboard/app/components/ExecutorStatusBar.css |   8 +
 .../dashboard/app/components/ExecutorStatusBar.tsx |  27 +-
 packages/dashboard/app/components/Header.css       |  27 -
 packages/dashboard/app/components/Header.tsx       | 549 +--------------------
 .../dashboard/app/components/TerminalLauncher.css  | 180 +++++++
 .../dashboard/app/components/TerminalLauncher.tsx  | 306 ++++++++++++
 .../dashboard/app/components/TerminalModal.css     | 117 +++++
 .../dashboard/app/components/TerminalModal.tsx     | 360 +++++++++++++-
 .../__tests__/ExecutorStatusBar.test.tsx           |  52 +-
 .../app/components/__tests__/Header.test.tsx       | 304 ++----------
 .../components/__tests__/TerminalLauncher.test.tsx |  57 +++
 .../components/__tests__/TerminalModal.test.tsx    | 111 +++++
 16 files changed, 1282 insertions(+), 924 deletions(-)

Fusion-Task-Id: FN-6887

Fusion-Task-Lineage: 755f28b1-1ba5-43f8-b13c-264e31507658
2026-06-21 22:43:34 -07:00

58 lines
2.2 KiB
TypeScript

import { describe, it, expect, vi, beforeEach } from "vitest";
import { render, screen, fireEvent, waitFor } from "@testing-library/react";
import { TerminalLauncher } from "../TerminalLauncher";
const mockFetchScripts = vi.fn();
vi.mock("../../api", () => ({
fetchScripts: (...args: unknown[]) => mockFetchScripts(...args),
}));
describe("TerminalLauncher", () => {
beforeEach(() => {
vi.clearAllMocks();
mockFetchScripts.mockResolvedValue({ build: "pnpm build" });
});
it("renders the terminal button and toggles terminal", () => {
const onToggleTerminal = vi.fn();
render(<TerminalLauncher projectId="proj-1" onToggleTerminal={onToggleTerminal} onOpenScripts={vi.fn()} onRunScript={vi.fn()} />);
fireEvent.click(screen.getByTestId("terminal-toggle-btn"));
expect(onToggleTerminal).toHaveBeenCalledTimes(1);
expect(screen.getByText("Terminal")).toBeInTheDocument();
});
it("opens scripts dropdown from chevron without toggling terminal", async () => {
const onToggleTerminal = vi.fn();
render(<TerminalLauncher projectId="proj-1" onToggleTerminal={onToggleTerminal} onOpenScripts={vi.fn()} onRunScript={vi.fn()} />);
fireEvent.click(screen.getByTestId("scripts-btn"));
expect(onToggleTerminal).not.toHaveBeenCalled();
expect(await screen.findByTestId("quick-scripts-dropdown")).toBeInTheDocument();
await waitFor(() => expect(mockFetchScripts).toHaveBeenCalledWith("proj-1"));
});
it("runs a quick script", async () => {
const onRunScript = vi.fn();
render(<TerminalLauncher projectId="proj-1" onToggleTerminal={vi.fn()} onOpenScripts={vi.fn()} onRunScript={onRunScript} />);
fireEvent.click(screen.getByTestId("scripts-btn"));
fireEvent.click(await screen.findByTestId("quick-script-item-build"));
expect(onRunScript).toHaveBeenCalledWith("build", "pnpm build");
});
it("opens manage scripts from the dropdown footer", async () => {
const onOpenScripts = vi.fn();
render(<TerminalLauncher projectId="proj-1" onToggleTerminal={vi.fn()} onOpenScripts={onOpenScripts} onRunScript={vi.fn()} />);
fireEvent.click(screen.getByTestId("scripts-btn"));
fireEvent.click(await screen.findByTestId("quick-scripts-manage"));
expect(onOpenScripts).toHaveBeenCalledTimes(1);
});
});