[#206] removed no option from display when no input + test

This commit is contained in:
Camille Moussu
2025-11-06 12:18:21 +01:00
committed by Benoit TELLIER
parent ddc651f8ca
commit c05dac3f08
2 changed files with 22 additions and 0 deletions
+21
View File
@@ -106,4 +106,25 @@ describe("PeopleSearch", () => {
setup([], { disabled: true });
expect(screen.getByRole("combobox")).toBeDisabled();
});
it("no options doesn't show dropdown when input is empty", async () => {
mockedSearchUsers.mockResolvedValueOnce([baseUser]);
setup();
const input = screen.getByRole("combobox");
userEvent.type(input, "Test");
await act(async () => {
jest.advanceTimersByTime(300);
});
await waitFor(() => {
expect(screen.getByRole("listbox")).toBeInTheDocument();
});
userEvent.clear(input);
await waitFor(() => {
expect(screen.queryByRole("listbox")).not.toBeInTheDocument();
});
});
});