Skip to content

Commit

Permalink
add default validity test
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik-Petrik committed Oct 14, 2022
1 parent 3cf0368 commit 2d7c2ce
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ const props = {
value: 'test textarea'
};

test('textarea input passes value and event to onChange handler', async () => {
test('Textarea input passes value and event to onChange handler', async () => {
const user = userEvent.setup();
render(<TextArea {...props} value="" aria-label="test textarea" />);

const user = userEvent.setup();
await user.type(screen.getByRole('textbox'), 'a');

expect(props.onChange).toHaveBeenCalledWith('a', expect.any(Object));
Expand Down Expand Up @@ -87,6 +87,11 @@ test('Renders invalid text area', () => {
expect(screen.getByRole('textbox')).toBeInvalid();
});

test('Text area is not invalid by default', () => {
render(<TextArea aria-label="validated textarea" />);
expect(screen.getByRole('textbox')).not.toBeInvalid();
});

test('Renders vertically resizable text area', () => {
render(<TextArea aria-label="vertical resize textarea" resizeOrientation="vertical" />);
expect(screen.getByRole('textbox')).toHaveClass('pf-m-resize-vertical');
Expand Down

0 comments on commit 2d7c2ce

Please sign in to comment.