(react) add textItems to Field

This allow to add bullet points lists below inputs, the best example
is when we want to list multiple errors from form validation.

Fixes #147
This commit is contained in:
Nathan Vasse
2023-08-29 17:37:06 +02:00
committed by NathanVss
parent 468c8161eb
commit b530e966ae
11 changed files with 98 additions and 9 deletions

View File

@@ -119,6 +119,26 @@ describe("<Input/>", () => {
);
screen.getByText("Some text");
});
it("renders with text items", async () => {
render(
<Input
label="First name"
rightIcon={<span className="material-icons">apartment</span>}
textItems={[
"Text too long",
"Wrong choice",
"Must contain at least 9 characters, uppercase and digits",
]}
/>,
);
expect(
screen.getAllByRole("listitem").map((item) => item.textContent),
).toEqual([
"Text too long",
"Wrong choice",
"Must contain at least 9 characters, uppercase and digits",
]);
});
it("renders with text and text right", async () => {
render(
<Input