Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 0 additions & 30 deletions webview-ui/src/__tests__/SearchableSelect.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,36 +142,6 @@ describe("SearchableSelect", () => {
})
})

it("clears search value when clicking the clear button", async () => {
const user = userEvent.setup()
render(<SearchableSelect {...defaultProps} />)

const trigger = screen.getByRole("combobox")
await user.click(trigger)

const searchInput = screen.getByPlaceholderText("Search options...")

// Use fireEvent for cmdk input
fireEvent.change(searchInput, { target: { value: "test" } })

// Wait for the X button to appear and options to be filtered
await waitFor(() => {
expect(screen.getByTestId("clear-search-button")).toBeInTheDocument()
expect(screen.queryByText("Option 1")).not.toBeInTheDocument()
})

// Find and click the X icon by its container
const clearButton = screen.getByTestId("clear-search-button")
await user.click(clearButton)

// All options should be visible again
await waitFor(() => {
expect(screen.getByText("Option 1")).toBeInTheDocument()
expect(screen.getByText("Option 2")).toBeInTheDocument()
expect(screen.getByText("Option 3")).toBeInTheDocument()
})
})

it("handles component unmounting without memory leaks", async () => {
vi.useFakeTimers()
const { unmount, rerender } = render(<SearchableSelect {...defaultProps} value="option1" />)
Expand Down
Loading