✨(react) add select menu empty placeholder
Previously if the menu was opened and no there were no options to be displayed it was just showing a tiny empty menu, this commit adds an empty placeholder in order to make it clearer that the list is empty.
This commit is contained in:
@@ -1138,5 +1138,19 @@ describe("<Select/>", () => {
|
||||
const label = screen.getByText("City");
|
||||
expect(Array.from(label.classList)).toContain("offscreen");
|
||||
});
|
||||
|
||||
it("renders menu empty placeholder when there are no options to display", async () => {
|
||||
render(
|
||||
<CunninghamProvider>
|
||||
<Select label="City" options={[]} hideLabel={true} />
|
||||
</CunninghamProvider>,
|
||||
);
|
||||
const input = screen.getByRole("combobox", {
|
||||
name: "City",
|
||||
});
|
||||
const user = userEvent.setup();
|
||||
await user.click(input);
|
||||
screen.getByText("No options available");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user