Skip to content

Commit

Permalink
fix test error
Browse files Browse the repository at this point in the history
  • Loading branch information
koji committed May 9, 2024
1 parent c799277 commit 135cb51
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 5 additions & 1 deletion app/src/organisms/NetworkSettings/SetWifiCred.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,11 @@ export function SetWifiCred({
gridGap={SPACING.spacing12}
width="7.375rem"
>
<Icon name={showPassword ? 'eye-slash' : 'eye'} size="3rem" />
<Icon
name={showPassword ? 'eye-slash' : 'eye'}
size="3rem"
data-testid={showPassword ? 'icon_eye-slash' : 'icon_eye'}
/>
<StyledText as="p" fontWeight={TYPOGRAPHY.fontWeightSemiBold}>
{showPassword ? t('hide') : t('show')}
</StyledText>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,14 @@ describe('SetWifiCred', () => {
it('should switch the input type and button text when tapping the icon next to the input', () => {
render(props)
const button = screen.getByRole('button', { name: 'Show' })
// ToDo: 11/08/2022 kj switch to screen.getByRole once understand the issue on this input
const inputBox = screen.getByLabelText('wifi_password')
expect(inputBox).toHaveAttribute('type', 'password')
fireEvent.click(button)
screen.getByRole('button', { name: 'Hide' })
expect(inputBox).toHaveAttribute('type', 'text')
screen.getByTestId('icon_eye-slash')
expect(screen.getByLabelText('wifi_password')).toHaveAttribute(
'type',
'text'
)
})
})

0 comments on commit 135cb51

Please sign in to comment.