Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
beaesguerra committed Nov 6, 2024
1 parent 39c088e commit 98f6231
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1579,6 +1579,7 @@ describe("TextArea", () => {
value="test"
validate={validate}
disabled={true}
instantValidation={false}
/>,
defaultOptions,
);
Expand Down Expand Up @@ -1615,6 +1616,29 @@ describe("TextArea", () => {
);
});

it("shound not be in error state if it is required, the value changes to an empty string, and the user has not tabbed away", async () => {
// Arrange
render(
<ControlledTextArea
value="T"
required="Required"
instantValidation={false}
/>,
defaultOptions,
);

// Act
const field = await screen.findByRole("textbox");
await userEvent.type(field, "{backspace}");

// Assert
const textArea = await screen.findByRole("textbox");
expect(textArea).toHaveAttribute(
"aria-invalid",
"false",
);
});

it("shound call onValidate with the required message if it is required, the value changes to an empty string, and the user tabs away", async () => {
// Arrange
const onValidate = jest.fn();
Expand Down

0 comments on commit 98f6231

Please sign in to comment.