30 lines
914 B
TypeScript
30 lines
914 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 { Select } from ".";
|
|
|
|
describe("Select accessibility wrapper", () => {
|
|
it("uses its string label as the combobox accessible-name fallback", () => {
|
|
render(
|
|
<Select label="Contact type" showLabel>
|
|
<Select.Item value="person">Person</Select.Item>
|
|
</Select>
|
|
);
|
|
|
|
expect(screen.getByRole("combobox", { name: "Contact type" })).toBeInTheDocument();
|
|
});
|
|
|
|
it("preserves an explicit trigger accessible name", () => {
|
|
render(
|
|
<Select label="Contact type" showLabel triggerAriaLabel="Choose contact type">
|
|
<Select.Item value="person">Person</Select.Item>
|
|
</Select>
|
|
);
|
|
|
|
expect(screen.getByRole("combobox", { name: "Choose contact type" })).toBeInTheDocument();
|
|
});
|
|
});
|