feat(FN-3086): enhance graph navigation with toolbar and keyboard controls
The merge introduces a new Cursor CLI plugin provider with dashboard authentication (FN-3396), enabling Fusion to bundle Cursor's CLI as a native AI model source alongside native shell guide and bridge contract documentation (FN-3577). It also completes the dependency graph plugin's navigation contr Fusion-Task-Id: FN-3086
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { cleanup, fireEvent, render, screen } from "@testing-library/react";
|
||||
import { GraphToolbar } from "../GraphToolbar";
|
||||
|
||||
describe("GraphToolbar", () => {
|
||||
afterEach(() => {
|
||||
cleanup();
|
||||
});
|
||||
it("renders controls and zoom percent", () => {
|
||||
render(
|
||||
<GraphToolbar
|
||||
zoom={1.25}
|
||||
onZoomIn={vi.fn()}
|
||||
onZoomOut={vi.fn()}
|
||||
onFitToGraph={vi.fn()}
|
||||
onResetView={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(screen.getByRole("button", { name: "Zoom in" })).toBeTruthy();
|
||||
expect(screen.getByRole("button", { name: "Zoom out" })).toBeTruthy();
|
||||
expect(screen.getByRole("button", { name: "Fit to graph" })).toBeTruthy();
|
||||
expect(screen.getByRole("button", { name: "Reset view" })).toBeTruthy();
|
||||
expect(screen.getByText("125%")).toBeTruthy();
|
||||
});
|
||||
|
||||
it("fires callbacks", () => {
|
||||
const onZoomIn = vi.fn();
|
||||
const onZoomOut = vi.fn();
|
||||
const onFitToGraph = vi.fn();
|
||||
const onResetView = vi.fn();
|
||||
|
||||
render(
|
||||
<GraphToolbar
|
||||
zoom={1}
|
||||
onZoomIn={onZoomIn}
|
||||
onZoomOut={onZoomOut}
|
||||
onFitToGraph={onFitToGraph}
|
||||
onResetView={onResetView}
|
||||
/>,
|
||||
);
|
||||
|
||||
fireEvent.click(screen.getByRole("button", { name: "Zoom in" }));
|
||||
fireEvent.click(screen.getByRole("button", { name: "Zoom out" }));
|
||||
fireEvent.click(screen.getByRole("button", { name: "Fit to graph" }));
|
||||
fireEvent.click(screen.getByRole("button", { name: "Reset view" }));
|
||||
|
||||
expect(onZoomIn).toHaveBeenCalledOnce();
|
||||
expect(onZoomOut).toHaveBeenCalledOnce();
|
||||
expect(onFitToGraph).toHaveBeenCalledOnce();
|
||||
expect(onResetView).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("applies toolbar class", () => {
|
||||
render(
|
||||
<GraphToolbar zoom={1} onZoomIn={vi.fn()} onZoomOut={vi.fn()} onFitToGraph={vi.fn()} onResetView={vi.fn()} />,
|
||||
);
|
||||
expect(screen.getByTestId("graph-toolbar").className).toContain("graph-toolbar");
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user