Skip to content

Commit b31a059

Browse files
committed
add tests for icon check
1 parent cbd678f commit b31a059

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

protocol-designer/src/molecules/TextAreaField/__tests__/TextAreaField.test.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,16 @@ describe('TextAreaField', () => {
5454

5555
expect(screen.getByText('Error: Invalid input')).toBeInTheDocument()
5656
})
57+
58+
it('display an icon when tooltip prop is provided', () => {
59+
props.tooltipText = 'ot-icon-check'
60+
render(props)
61+
screen.getByTestId('tooltip-icon')
62+
})
63+
64+
it('display left icon when leftIcon prop is provided', () => {
65+
props.leftIcon = 'information'
66+
render(props)
67+
screen.getByTestId('left-icon')
68+
})
5769
})

protocol-designer/src/molecules/TextAreaField/index.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ export const TextAreaField = forwardRef<
168168
name="information"
169169
size={SPACING.spacing12}
170170
color={COLORS.grey60}
171+
data-testid="tooltip-icon"
171172
/>
172173
</Flex>
173174
<Tooltip tooltipProps={tooltipProps}>{tooltipText}</Tooltip>
@@ -186,7 +187,12 @@ export const TextAreaField = forwardRef<
186187
>
187188
{leftIcon !== undefined && (
188189
<Flex>
189-
<Icon name={leftIcon} color={COLORS.grey60} size="1.25rem" />
190+
<Icon
191+
name={leftIcon}
192+
color={COLORS.grey60}
193+
size="1.25rem"
194+
data-testid="left-icon"
195+
/>
190196
</Flex>
191197
)}
192198
<StyledTextArea

0 commit comments

Comments
 (0)