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:
adilalloandCursor committed 2026-09-29 15:59:00 -06:00
1 parent fd9f82ea19
commit 20ea4a2f30
35 files changed
+498 -156

No files matched your search

@@ -41,6 +41,26 @@ describe("CoreValuesSelectScreen", () => {
).not.toBeInTheDocument();
});
it("gives value chips Select/Deselect accessible names", () => {
renderWithProviders(<CoreValuesSelectScreen />);
expect(
screen.getByRole("button", { name: "Select Accessibility" }),
).toBeInTheDocument();
});
it("starts the value modal empty and Generate draft inserts catalog copy", async () => {
renderWithProviders(<CoreValuesSelectScreen />);
fireEvent.click(screen.getByRole("button", { name: "Select Accessibility" }));
const dialog = await screen.findByRole("dialog");
const fields = within(dialog).getAllByRole("textbox") as HTMLTextAreaElement[];
expect(fields[0].value).toBe("");
expect(fields[1].value).toBe("");
fireEvent.click(
within(dialog).getAllByRole("button", { name: "Generate draft" })[0],
);
expect(fields[0].value).toMatch(/everyone can use/i);
});
it("closes a pending value without confirm when fields are unchanged", async () => {
renderWithProviders(<CoreValuesSelectScreen />);
fireEvent.click(screen.getByText("Accessibility"));
@@ -289,12 +309,10 @@ describe("CoreValuesSelectScreen", () => {
*/
function countCustomChips(label: string) {
return screen
.queryAllByRole("button", { name: label })
.filter(
(el) =>
!el.closest('[role="dialog"]') &&
(el.getAttribute("aria-label") ?? "") !== `Remove ${label}`,
).length;
.queryAllByRole("button", {
name: new RegExp(`^(Select|Deselect) ${label}$`),
})
.filter((el) => !el.closest('[role="dialog"]')).length;
}
async function completeAddValueWizard(label: string) {
@@ -417,7 +435,7 @@ describe("CoreValuesSelectScreen", () => {
),
).toBeInTheDocument();
expect(
screen.getByRole("button", { name: "Anti-oppression" }),
screen.getByRole("button", { name: "Select Anti-oppression" }),
).toBeDisabled();
expect(screen.getByRole("button", { name: "Add value" })).toBeDisabled();
expect(screen.getByRole("button", { name: /^add$/i })).toBeDisabled();