[#206] removed no option from display when no input + test
This commit is contained in:
committed by
Benoit TELLIER
parent
ddc651f8ca
commit
c05dac3f08
@@ -106,4 +106,25 @@ describe("PeopleSearch", () => {
|
|||||||
setup([], { disabled: true });
|
setup([], { disabled: true });
|
||||||
expect(screen.getByRole("combobox")).toBeDisabled();
|
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();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -64,6 +64,7 @@ export function PeopleSearch({
|
|||||||
freeSolo={freeSolo}
|
freeSolo={freeSolo}
|
||||||
multiple
|
multiple
|
||||||
options={options}
|
options={options}
|
||||||
|
open={!!query}
|
||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
loading={loading}
|
loading={loading}
|
||||||
filterOptions={(x) => x}
|
filterOptions={(x) => x}
|
||||||
|
|||||||
Reference in New Issue
Block a user