mirror of
https://github.com/carbon-design-system/carbon-components-svelte.git
synced 2025-09-14 18:01:06 +00:00
parent
95c06a83b3
commit
632320ae3b
2 changed files with 27 additions and 1 deletions
|
@ -305,6 +305,8 @@ describe("ComboBox", () => {
|
|||
it("should close menu on Escape key", async () => {
|
||||
render(ComboBox);
|
||||
|
||||
expect(screen.getByRole("textbox")).toHaveValue("");
|
||||
|
||||
const input = screen.getByRole("textbox");
|
||||
await user.click(input);
|
||||
|
||||
|
@ -313,6 +315,30 @@ describe("ComboBox", () => {
|
|||
|
||||
await user.keyboard("{Escape}");
|
||||
expect(dropdown).not.toBeVisible();
|
||||
expect(screen.getByRole("textbox")).toHaveValue("");
|
||||
expect(screen.getByRole("textbox")).toHaveFocus();
|
||||
});
|
||||
|
||||
it("should close menu and clear selection on Escape key", async () => {
|
||||
render(ComboBox, {
|
||||
props: {
|
||||
selectedId: "1",
|
||||
value: "Email",
|
||||
},
|
||||
});
|
||||
|
||||
expect(screen.getByRole("textbox")).toHaveValue("Email");
|
||||
|
||||
const input = screen.getByRole("textbox");
|
||||
await user.click(input);
|
||||
|
||||
const dropdown = screen.getAllByRole("listbox")[1];
|
||||
expect(dropdown).toBeVisible();
|
||||
|
||||
await user.keyboard("{Escape}");
|
||||
expect(dropdown).not.toBeVisible();
|
||||
expect(screen.getByRole("textbox")).toHaveValue("");
|
||||
expect(screen.getByRole("textbox")).toHaveFocus();
|
||||
});
|
||||
|
||||
it("should use custom shouldFilterItem function", async () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue