Files
Reactive-Resume/packages/ui/src/components/switch-row.test.tsx
T
Amruth Pillai 0f934bd849 feat(ui): adopt Desk & Paper tokens, fonts, System theme and restyled primitives
Replace the achromatic shadcn palette with the Desk & Paper tokens (warm
neutrals, one moss accent, danger, warn and info), exposed to Tailwind
under their spec names; the previous names resolve to the new tokens
until every screen is rebuilt. Hard-coded palette classes become semantic
tokens and stage colors follow the spec.

Fonts move to Newsreader, Hanken Grotesk and JetBrains Mono. The theme
gains a System option that follows the operating system live, applied
before first paint, and Base UI now receives the locale's direction.

Primitives follow the component spec: button variants primary,
secondary, ghost, danger and link with a loading state, accent focus
rings on inputs, SwitchRow, semantic badges, segmented and underline
tabs, restyled menus, dialogs, sheets, tooltips and command bar, and a
single bottom-center toast with an Undo action. New: IconButton,
SegmentedControl, RadioGroup and NativeSelect.
2026-09-28 16:29:30 +02:00

24 lines
869 B
TypeScript

import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import { describe, expect, it, vi } from "vitest";
import { SwitchRow } from "./switch";
describe("SwitchRow", () => {
it("makes the whole row the switch, named by its label and described by its description", async () => {
const onCheckedChange = vi.fn();
render(
<SwitchRow
label="Visitors can download the PDF"
description="Download is hidden when this is off."
onCheckedChange={onCheckedChange}
/>,
);
const row = screen.getByRole("switch", { name: "Visitors can download the PDF" });
expect(row).toHaveAccessibleDescription("Download is hidden when this is off.");
await userEvent.click(screen.getByText("Visitors can download the PDF"));
expect(onCheckedChange).toHaveBeenCalledWith(true, expect.anything());
});
});