109e74db41
Web UI rework. Shared-components slice (drift prevention): - Migrate SectionCard, SelectionRailCard, TabbedCard, MetricCard, DiskSpaceCard, HoverEditButton, DialogFooter, ConfirmDialog, LibraryOverview, NowPlaying, SessionActivityPanel off @mui - HoverEditButton: MUI IconButton + EditOutlined -> Button + lucide Pencil - Status mapping uses the success Badge variant (chart-2) for healthy - Exported APIs preserved so consuming pages still compile (no page edits) - 11 behavioral Vitest component tests added Gate: build + lint + test green.
33 lines
948 B
TypeScript
33 lines
948 B
TypeScript
import { describe, it, expect, vi } from "vitest";
|
|
import { render, screen } from "@testing-library/react";
|
|
import userEvent from "@testing-library/user-event";
|
|
import { TabbedCard } from "../TabbedCard";
|
|
import { TabsTrigger } from "@/components/ui/tabs";
|
|
|
|
describe("TabbedCard", () => {
|
|
it("renders the provided tab triggers and reports selection changes", async () => {
|
|
const onChange = vi.fn();
|
|
render(
|
|
<TabbedCard
|
|
value="jellyfin"
|
|
onChange={onChange}
|
|
tabs={[
|
|
<TabsTrigger key="jellyfin" value="jellyfin">
|
|
Jellyfin
|
|
</TabsTrigger>,
|
|
<TabsTrigger key="nextcloud" value="nextcloud">
|
|
Nextcloud
|
|
</TabsTrigger>,
|
|
]}
|
|
>
|
|
<p>Body</p>
|
|
</TabbedCard>,
|
|
);
|
|
expect(screen.getByText("Jellyfin")).toBeInTheDocument();
|
|
expect(screen.getByText("Body")).toBeInTheDocument();
|
|
|
|
await userEvent.click(screen.getByText("Nextcloud"));
|
|
expect(onChange).toHaveBeenCalledWith("nextcloud");
|
|
});
|
|
});
|