Skip to content

Commit

Permalink
Added expectation for visible tooltipIcon
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbastian committed Jun 18, 2021
1 parent 4a39740 commit b0de82a
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const defaultProps = {
validationMethods: () => {},
errorMessage: '',
helpText: 'This is a line of example help text',
hasTooltip: true,
hasTooltip: false,
tooltipText: 'This is a tooltip',
value: '',
placeholder: 'Example placeholder text...',
Expand Down Expand Up @@ -61,13 +61,16 @@ describe('LabeledErrorBoundInput', () => {
expect(errorText).toBeVisible();
});
it('renders a LabledErrorBoundInput with a InfoTooltip', async () => {
defaultProps.hasTooltip = true;
render(<LabeledErrorBoundInput {...defaultProps} />);

const label = screen.getByText(/username/i);
const textboxInput = screen.getByRole('textbox');
const tooltipIcon = screen.getByTestId('info-solid-small');

fireEvent.mouseOver(screen.getByTestId('info-solid-small'));
fireEvent.mouseOver(tooltipIcon);

expect(tooltipIcon).toBeVisible();
expect(label).toBeVisible();
expect(textboxInput).toBeVisible();
expect(await screen.findByText('This is a tooltip')).toBeInTheDocument();
Expand Down

0 comments on commit b0de82a

Please sign in to comment.