Skip to content

Commit

Permalink
Updated tests per Austin feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
thatblindgeye committed Jan 24, 2024
1 parent a658ca3 commit d7cb7b1
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test('Renders custom className', () => {
test('Does not render screen reader text by default', () => {
render(<HelperTextItem>help test text 1</HelperTextItem>);

expect(screen.queryByText('help test text 1')?.querySelector('.pf-v5-screen-reader')).not.toBeInTheDocument();
expect(screen.queryByText('status')).not.toBeInTheDocument();
});

Object.values(['indeterminate', 'warning', 'success', 'error']).forEach((variant) => {
Expand All @@ -52,10 +52,21 @@ Object.values(['indeterminate', 'warning', 'success', 'error']).forEach((variant
text
</HelperTextItem>
);
expect(screen.getByText('text').querySelector('span')).toHaveTextContent(`: ${variant} status;`);
expect(screen.getByText(`: ${variant} status;`)).toBeInTheDocument();
});
});

test('Renders custom screen reader text', () => {
render(
<HelperTextItem variant="error" screenReaderText="danger">
help test text 1
</HelperTextItem>
);

expect(screen.queryByText(': error status;')).not.toBeInTheDocument();
expect(screen.getByText(': danger;')).toBeInTheDocument();
});

test('Renders id when id is passed', () => {
render(<HelperTextItem id="text-item">help test text 1</HelperTextItem>);
expect(screen.getByText('help test text 1').parentElement).toHaveAttribute('id', 'text-item');
Expand Down

0 comments on commit d7cb7b1

Please sign in to comment.