mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-27 21:33:41 +02:00
* refactor(ui): unify collection page patterns * refactor(agents): redesign agent detail workbench (#5263) * refactor(agents): redesign agent detail workbench * refactor(agents): refine capability and settings surfaces * refactor(agents): rebuild general settings form * refactor(agents): refine overview and settings * refactor(agents): redesign custom args editor * docs(ui): record consistency audit
65 lines
1.9 KiB
TypeScript
65 lines
1.9 KiB
TypeScript
import { render, screen } from "@testing-library/react";
|
|
import { Plus, Users } from "lucide-react";
|
|
import { describe, expect, it, vi } from "vitest";
|
|
import {
|
|
CollectionPageHeader,
|
|
CollectionPageHeaderAction,
|
|
CollectionPageState,
|
|
} from "./collection-page";
|
|
|
|
describe("CollectionPageHeader", () => {
|
|
it("renders a semantic title, count, supporting link, and labelled action", () => {
|
|
render(
|
|
<CollectionPageHeader
|
|
icon={Users}
|
|
title="Teams"
|
|
count={4}
|
|
description="Manage collaborators."
|
|
learnMore={{ href: "https://example.com/docs", label: "Learn more" }}
|
|
actions={
|
|
<CollectionPageHeaderAction
|
|
icon={Plus}
|
|
label="New team"
|
|
onClick={vi.fn()}
|
|
/>
|
|
}
|
|
/>,
|
|
);
|
|
|
|
expect(screen.getByRole("banner")).toBeInTheDocument();
|
|
expect(
|
|
screen.getByRole("heading", { name: "Teams", level: 1 }),
|
|
).toBeInTheDocument();
|
|
expect(screen.getByText("4")).toBeInTheDocument();
|
|
expect(screen.getByRole("link", { name: "Learn more" })).toHaveAttribute(
|
|
"href",
|
|
"https://example.com/docs",
|
|
);
|
|
expect(screen.getByRole("button", { name: "New team" })).toBeInTheDocument();
|
|
});
|
|
|
|
it("does not render a zero count", () => {
|
|
render(<CollectionPageHeader icon={Users} title="Teams" count={0} />);
|
|
expect(screen.queryByText("0")).not.toBeInTheDocument();
|
|
});
|
|
});
|
|
|
|
describe("CollectionPageState", () => {
|
|
it("renders an alert with semantic title and description", () => {
|
|
render(
|
|
<CollectionPageState
|
|
role="alert"
|
|
icon={Users}
|
|
title="Could not load teams"
|
|
description="Try again."
|
|
/>,
|
|
);
|
|
|
|
expect(screen.getByRole("alert")).toBeInTheDocument();
|
|
expect(
|
|
screen.getByRole("heading", { name: "Could not load teams", level: 2 }),
|
|
).toBeInTheDocument();
|
|
expect(screen.getByText("Try again.").tagName).toBe("P");
|
|
});
|
|
});
|