Skip to content

Commit

Permalink
add tests for icon check
Browse files Browse the repository at this point in the history
  • Loading branch information
koji committed Feb 11, 2025
1 parent cbd678f commit b31a059
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,16 @@ describe('TextAreaField', () => {

expect(screen.getByText('Error: Invalid input')).toBeInTheDocument()
})

it('display an icon when tooltip prop is provided', () => {
props.tooltipText = 'ot-icon-check'
render(props)
screen.getByTestId('tooltip-icon')
})

it('display left icon when leftIcon prop is provided', () => {
props.leftIcon = 'information'
render(props)
screen.getByTestId('left-icon')
})
})
8 changes: 7 additions & 1 deletion protocol-designer/src/molecules/TextAreaField/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ export const TextAreaField = forwardRef<
name="information"
size={SPACING.spacing12}
color={COLORS.grey60}
data-testid="tooltip-icon"
/>
</Flex>
<Tooltip tooltipProps={tooltipProps}>{tooltipText}</Tooltip>
Expand All @@ -186,7 +187,12 @@ export const TextAreaField = forwardRef<
>
{leftIcon !== undefined && (
<Flex>
<Icon name={leftIcon} color={COLORS.grey60} size="1.25rem" />
<Icon
name={leftIcon}
color={COLORS.grey60}
size="1.25rem"
data-testid="left-icon"
/>
</Flex>
)}
<StyledTextArea
Expand Down

0 comments on commit b31a059

Please sign in to comment.