Skip to content

Commit b667fc8

Browse files
committed
add input and select event tests
1 parent 0dd1c79 commit b667fc8

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

js/radio/Radio.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,21 @@ describe("Events", () => {
270270
expect(change).toHaveBeenCalledTimes(1);
271271
});
272272

273+
test("input and select emitted on user click", async () => {
274+
const { listen, getAllByRole } = await render(Radio, default_props);
275+
276+
const input = listen("input");
277+
const select = listen("select");
278+
const radios = getAllByRole("radio") as HTMLInputElement[];
279+
280+
await event.click(radios[2]);
281+
282+
await waitFor(() => {
283+
expect(input).toHaveBeenCalledTimes(1);
284+
expect(select).toHaveBeenCalledTimes(1);
285+
expect(select).toHaveBeenCalledWith({ value: "turtle", index: 2 });
286+
});
287+
});
273288
test("custom_button_click emitted when custom button is clicked", async () => {
274289
const { listen, getByLabelText } = await render(Radio, {
275290
...default_props,

0 commit comments

Comments
 (0)