import "@testing-library/jest-dom"; import * as React from "react"; import { describe, expect, it } from "vitest"; import { Button } from "./button"; import { expectNoA11yViolations, findA11yViolations } from "~/utils/test/a11y"; import { render } from "@testing-library/react"; describe("Button a11y", () => { it("renders text button without a11y violations", async () => { await expectNoA11yViolations(); }); it("icon-only button passes when aria-label is supplied", async () => { await expectNoA11yViolations( ); }); it("disabled button keeps its accessible name", async () => { await expectNoA11yViolations( ); }); it("destructive variant with text passes", async () => { await expectNoA11yViolations(); }); it("icon-only button WITHOUT an accessible name is flagged (negative control)", () => { const { container } = render( ); const violations = findA11yViolations(container); expect(violations.some((v) => v.rule === "button-name")).toBe(true); }); });