fix(list-box-selection): fix aria-label for clear button (#2134)

`ListBoxSelection`, used by `MultiSelect` and `ComboBox`, currently  
applies the wrong `aria-label` for the clear selection button. It uses
the `translateId` (e.g., `"clearAll"`) instead of the user-friendly copy.
This commit is contained in:
Eric Liu 2025-03-22 12:59:16 -07:00 committed by GitHub
commit dd1338ffc4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 5 deletions

View file

@ -193,6 +193,16 @@ describe("ComboBox", () => {
expect(screen.getByRole("listbox")).toHaveClass("bx--list-box--up");
});
it("should clear filter on selection clear", async () => {
render(ComboBoxCustom, { props: { selectedId: "1" } });
const clearButton = screen.getByLabelText("Clear selected item");
await user.click(clearButton);
const input = screen.getByRole("textbox");
expect(input).toHaveValue("");
});
it("should programmatically clear selection", async () => {
render(ComboBoxCustom, { props: { selectedId: "1" } });