mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
test(multi-select): reuse openMenu/closeMenu utilities
This commit is contained in:
parent
1f0e9a91f9
commit
be4f2f13a2
1 changed files with 5 additions and 5 deletions
|
@ -465,7 +465,7 @@ describe("MultiSelect", () => {
|
||||||
selectedIds: ["0", "1"],
|
selectedIds: ["0", "1"],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
await user.click(screen.getAllByRole("button")[0]);
|
await openMenu();
|
||||||
|
|
||||||
const options = screen.getAllByRole("option");
|
const options = screen.getAllByRole("option");
|
||||||
expect(options[0]).toHaveAttribute("aria-selected", "true");
|
expect(options[0]).toHaveAttribute("aria-selected", "true");
|
||||||
|
@ -474,7 +474,7 @@ describe("MultiSelect", () => {
|
||||||
|
|
||||||
const clearButton = screen.getByRole("button", { name: /clear/i });
|
const clearButton = screen.getByRole("button", { name: /clear/i });
|
||||||
await user.click(clearButton);
|
await user.click(clearButton);
|
||||||
await user.click(screen.getByRole("button"));
|
await closeMenu();
|
||||||
|
|
||||||
expect(options[0]).toHaveAttribute("aria-selected", "false");
|
expect(options[0]).toHaveAttribute("aria-selected", "false");
|
||||||
expect(options[1]).toHaveAttribute("aria-selected", "false");
|
expect(options[1]).toHaveAttribute("aria-selected", "false");
|
||||||
|
@ -493,7 +493,7 @@ describe("MultiSelect", () => {
|
||||||
placeholder: "Filter...",
|
placeholder: "Filter...",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
await user.click(screen.getByRole("button"));
|
await openMenu();
|
||||||
const input = screen.getByPlaceholderText("Filter...");
|
const input = screen.getByPlaceholderText("Filter...");
|
||||||
|
|
||||||
await user.type(input, "a");
|
await user.type(input, "a");
|
||||||
|
@ -513,7 +513,7 @@ describe("MultiSelect", () => {
|
||||||
placeholder: "Filter...",
|
placeholder: "Filter...",
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
await user.click(screen.getByRole("button"));
|
await openMenu();
|
||||||
const input = screen.getByPlaceholderText("Filter...");
|
const input = screen.getByPlaceholderText("Filter...");
|
||||||
expect(input).toHaveFocus();
|
expect(input).toHaveFocus();
|
||||||
});
|
});
|
||||||
|
@ -528,7 +528,7 @@ describe("MultiSelect", () => {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
await user.click(screen.getByRole("button"));
|
await openMenu();
|
||||||
const disabledOption = screen.getByText("B").closest("[role='option']");
|
const disabledOption = screen.getByText("B").closest("[role='option']");
|
||||||
|
|
||||||
await user.click(disabledOption!);
|
await user.click(disabledOption!);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue