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
@@ -110,4 +110,44 @@ describe("ModalTextAreaField behavior", () => {
|
||||
|
||||
expect(screen.getByAltText("Help")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("starts empty and Generate draft inserts the provided catalog copy", async () => {
|
||||
const user = userEvent.setup();
|
||||
const onChange = vi.fn();
|
||||
renderWithProviders(
|
||||
<ModalTextAreaField
|
||||
label="Core principle"
|
||||
value=""
|
||||
onChange={onChange}
|
||||
generateDraftText="Catalog first draft"
|
||||
generateDraftLabel="Generate draft"
|
||||
generateDraftHint="Get a first draft for this section"
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(screen.getByRole("textbox", { name: /Core principle/i })).toHaveValue(
|
||||
"",
|
||||
);
|
||||
expect(
|
||||
screen.getByText("Get a first draft for this section"),
|
||||
).toBeInTheDocument();
|
||||
await user.click(screen.getByRole("button", { name: "Generate draft" }));
|
||||
expect(onChange).toHaveBeenCalledWith("Catalog first draft");
|
||||
});
|
||||
|
||||
it("hides Generate draft when there is no catalog copy", () => {
|
||||
renderWithProviders(
|
||||
<ModalTextAreaField
|
||||
label="Core principle"
|
||||
value=""
|
||||
onChange={() => {}}
|
||||
generateDraftText=""
|
||||
generateDraftLabel="Generate draft"
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(
|
||||
screen.queryByRole("button", { name: "Generate draft" }),
|
||||
).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user