Files
HiveGrid-Wireframes/03 Quellen und Referenzen/hivegrid-cloud/apps/web/app/ui/components/NumberInput/NumberInput.a11y.test.tsx
T

28 lines
851 B
TypeScript

// @vitest-environment jsdom
import "@testing-library/jest-dom/vitest";
import { render, screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import { NumberInput } from "./NumberInput";
describe("NumberInput accessibility", () => {
it("associates its visible label with the spinbutton", () => {
render(
<NumberInput showLabel label="Seats">
<NumberInput.Input name="seats" />
</NumberInput>
);
expect(screen.getByRole("spinbutton", { name: "Seats" })).toBeVisible();
});
it("preserves an explicit accessible name", () => {
render(
<NumberInput showLabel label="Seats">
<NumberInput.Input name="seats" aria-label="Licensed seats" />
</NumberInput>
);
expect(screen.getByRole("spinbutton", { name: "Licensed seats" })).toBeVisible();
});
});