import { render, screen } from "@testing-library/react"; import userEvent from "@testing-library/user-event"; import { SelectWidget } from "./SelectWidget"; test("picking an option responds with its id", async () => { const onRespond = vi.fn(); render(); expect(screen.getByText(/consigliato/i)).toBeInTheDocument(); await userEvent.click(screen.getByRole("button", { name: /A/ })); expect(onRespond).toHaveBeenCalledWith({ id: "u1", kind: "select", choices: ["a"] }); }); test("intro bullets render as a list with the lead term bolded", () => { render( ); const items = screen.getAllByRole("listitem"); expect(items).toHaveLength(2); // Lead term is emphasised via , remainder stays normal weight. const lead = screen.getByText("fact_impianto"); expect(lead.tagName).toBe("STRONG"); // The "•" is now a CSS marker, not literal text in the content. expect(screen.queryByText(/•/)).toBeNull(); }); test("a reserved control responds with control, not a choice", async () => { const onRespond = vi.fn(); render(); await userEvent.click(screen.getByRole("button", { name: /back/i })); expect(onRespond).toHaveBeenCalledWith({ id: "u1", control: "back" }); });