Skip to content

Commit

Permalink
fixup! Feat: Add alert role for ValidationText #DS-1175
Browse files Browse the repository at this point in the history
  • Loading branch information
curdaj committed May 9, 2024
1 parent 415b5bf commit e9d31ed
Showing 1 changed file with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,27 @@ describe('ValidationText', () => {
expect(container.firstElementChild).toHaveAttribute('role', 'alert');
});

it('should render multiple validation texts', () => {
render(
<ValidationText
className="ValidationText__validationText"
validationText={['validation text', 'another validation text']}
/>,
);
describe('should render multiple validation texts', () => {
beforeEach(() => {
render(
<ValidationText
className="ValidationText__validationText"
validationText={['validation text', 'another validation text']}
/>,
);
});

it('should render list wrapper with alert role', () => {
const list = screen.getByRole('list');

const list = screen.getByRole('list');
const listItems = screen.getAllByRole('listitem');
expect(list.parentElement).toHaveAttribute('role', 'alert');
});

expect(listItems[0].textContent).toBe('validation text');
expect(listItems[1].textContent).toBe('another validation text');
it('should render correct validation texts for list items', () => {
const listItems = screen.getAllByRole('listitem');

expect(list.parentElement).toHaveAttribute('role', 'alert');
expect(listItems[0]).toHaveTextContent('validation text');
expect(listItems[1]).toHaveTextContent('another validation text');
});
});
});

0 comments on commit e9d31ed

Please sign in to comment.