Give MultiSelect chips accessible names and start creation fields empty.
Catalog chips now announce Select or Deselect so they are named for assistive tech. Method and value modals open blank; Generate draft inserts the catalog copy that used to be prefilled, and Customize still keeps the section headings. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
fd9f82ea19
commit
20ea4a2f30
35 files changed
+498
-156
No files matched your search
@@ -62,6 +62,16 @@ describe("MultiSelect – behaviour specifics", () => {
|
||||
expect(screen.getByText("Option 2")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("names toggle chips Select/Deselect so they are not unnamed buttons", () => {
|
||||
render(<MultiSelect options={defaultChipOptions} />);
|
||||
expect(
|
||||
screen.getByRole("button", { name: "Select Option 1" }),
|
||||
).toHaveAttribute("aria-pressed", "false");
|
||||
expect(
|
||||
screen.getByRole("button", { name: "Deselect Option 2" }),
|
||||
).toHaveAttribute("aria-pressed", "true");
|
||||
});
|
||||
|
||||
it("calls onChipClick when a chip is clicked", async () => {
|
||||
const handleChipClick = vi.fn();
|
||||
render(
|
||||
@@ -151,11 +161,11 @@ describe("MultiSelect – behaviour specifics", () => {
|
||||
|
||||
expect(screen.getByText("2 of 2")).toBeInTheDocument();
|
||||
expect(screen.getByText("Limit reached")).toBeInTheDocument();
|
||||
expect(screen.getByRole("button", { name: "One" })).toBeEnabled();
|
||||
expect(screen.getByRole("button", { name: "Three" })).toBeDisabled();
|
||||
expect(screen.getByRole("button", { name: "Deselect One" })).toBeEnabled();
|
||||
expect(screen.getByRole("button", { name: "Select Three" })).toBeDisabled();
|
||||
expect(screen.getByRole("button", { name: "Add option" })).toBeDisabled();
|
||||
|
||||
await userEvent.click(screen.getByRole("button", { name: "Three" }));
|
||||
await userEvent.click(screen.getByRole("button", { name: "Select Three" }));
|
||||
await userEvent.click(screen.getByRole("button", { name: "Add option" }));
|
||||
expect(handleChipClick).not.toHaveBeenCalled();
|
||||
expect(handleAddClick).not.toHaveBeenCalled();
|
||||
|
||||
Reference in new issue
Block a user