fix: clarify memory selection semantics

This commit is contained in:
User
2026-07-14 13:13:59 +02:00
parent 1e3c5a1e99
commit c7d586aaf7
10 changed files with 205 additions and 24 deletions
@@ -22,6 +22,30 @@ test("confirms the checked ids including initially selected", async () => {
expect(onRespond).toHaveBeenCalledWith({ id: "u1", kind: "multiselect", choices: ["t1", "t2"] });
});
test("uses memory-specific selection copy without changing selected ids", async () => {
const onRespond = vi.fn();
render(
<MultiselectWidget
descriptor={{
id: "u-memory",
widget: "multiselect",
selection_label: "memory da applicare",
confirm_label: "Applica le memory selezionate",
options: [
{ id: "recommended", label: "Memory raccomandata", selected: true },
{ id: "optional", label: "Memory opzionale", selected: false },
],
}}
onRespond={onRespond}
/>
);
expect(screen.getByRole("checkbox", { name: /memory raccomandata/i })).toBeChecked();
expect(screen.getByText("1 / 2 memory da applicare")).toBeInTheDocument();
await userEvent.click(screen.getByRole("button", { name: "Applica le memory selezionate" }));
expect(onRespond).toHaveBeenCalledWith({ id: "u-memory", kind: "multiselect", choices: ["recommended"] });
});
test("select-all checks all options", async () => {
const onRespond = vi.fn();
render(