fix(ui): restore search tool clear action

This commit is contained in:
Yuneng Jiang 2026-08-12 14:11:21 -07:00
parent ea9d80ef50
commit 4a2ed16102
No known key found for this signature in database
3 changed files with 13 additions and 0 deletions

View file

@ -31,4 +31,14 @@ describe("SearchToolSelector", () => {
expect(await screen.findByRole("option", { name: "search-one" })).toBeInTheDocument();
expect(screen.getByRole("option", { name: "search-two" })).toBeInTheDocument();
});
it("should clear all selected search tools", async () => {
const user = userEvent.setup();
const onChange = vi.fn();
renderWithProviders(<SearchToolSelector accessToken="" value={["search-one", "search-two"]} onChange={onChange} />);
await user.click(screen.getByRole("button", { name: "Clear all search tools" }));
expect(onChange).toHaveBeenCalledWith([]);
});
});

View file

@ -4,6 +4,7 @@ import {
ComboboxChip,
ComboboxChips,
ComboboxChipsInput,
ComboboxClear,
ComboboxContent,
ComboboxEmpty,
ComboboxItem,
@ -82,6 +83,7 @@ const SearchToolSelector: React.FC<SearchToolSelectorProps> = ({
aria-label={placeholder}
disabled={disabled}
/>
{value && value.length > 0 && <ComboboxClear aria-label="Clear all search tools" disabled={disabled} />}
</ComboboxChips>
<ComboboxContent>
<ComboboxEmpty>{loading ? "Loading search tools…" : "No search tools found"}</ComboboxEmpty>

View file

@ -260,6 +260,7 @@ export {
ComboboxChips,
ComboboxChip,
ComboboxChipsInput,
ComboboxClear,
ComboboxTrigger,
ComboboxValue,
useComboboxAnchor,