Skip to content
This repository has been archived by the owner on Sep 18, 2023. It is now read-only.

Commit

Permalink
fix: toggle pw visibility, add loading
Browse files Browse the repository at this point in the history
  • Loading branch information
sbolel committed Aug 8, 2023
1 parent 1719b7e commit 45d663e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
1 change: 0 additions & 1 deletion src/components/forms/InputFormControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ const InputFormControl = <TFieldValues extends FieldValues>({
input: {
'aria-invalid': !!error,
'aria-labelledby': `${name}-label`,
pattern: name || 'text',
...inputSlotProps,
},
}}
Expand Down
6 changes: 4 additions & 2 deletions src/views/SignIn/SignIn.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ describe('SignIn', () => {

// Type the password into the password field
await user.type(
screen.getByRole('textbox', { name: /password/i }),
screen.getByLabelText(/password/i, {
selector: 'input',
}),
'password'
)

// Save the form
await user.click(screen.getByRole('button', { name: /^login$/i }))
await user.click(screen.getByRole('button', { name: /login/i }))

// Wait for form submission to complete
waitFor(() => {
Expand Down
16 changes: 10 additions & 6 deletions src/views/SignIn/SignIn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import Stack from '@mui/material/Stack'
import Typography from '@mui/material/Typography'
import useMediaQuery from '@mui/material/useMediaQuery'
import InputFormControl from '@/components/forms/InputFormControl'
import LinearIndeterminate from '@/components/mui/LinearLoadingBar'
import CircularProgress from '@mui/material/CircularProgress'
import Backdrop from '@mui/material/Backdrop'
import PasswordVisibilityToggle from '@/components/PasswordVisibilityToggle'
import SubmitButton from '@/components/forms/SubmitButton'
import BlankLayout from '@/layouts/BlankLayout'
Expand Down Expand Up @@ -119,7 +120,9 @@ const SignIn = () => {
control={control}
name="password"
InputProps={{
autoComplete: 'current-password',
endAdornment: <ShowPasswordButton />,
type: showPassword ? 'text' : 'password',
}}
/>
<SubmitButton
Expand All @@ -128,8 +131,13 @@ const SignIn = () => {
name="login"
role="button"
>
Login
Sign In
</SubmitButton>
{loading && (
<Backdrop open={loading} sx={{ borderRadius: 2 }}>
<CircularProgress data-testid="linear-indeterminate" />
</Backdrop>
)}
<Typography align="center" variant="subtitle2">
or...
</Typography>
Expand All @@ -143,10 +151,6 @@ const SignIn = () => {
</Button>
</Stack>
{/* End of Form */}

{loading && (
<LinearIndeterminate data-testid="linear-indeterminate" />
)}
</VerticalCenteredFlexBox>
</CenteredFlexBox>
</RightWrapper>
Expand Down

0 comments on commit 45d663e

Please sign in to comment.