-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ui): Standardise page layout - Create password (#272)
* wip: first page setup * wip: password setup * fix: hint * fix: input response * fix: unit tests * fix: PasswordValidation stylesheet * fix: error message * fix: margin before error msg * fix: change button text
- Loading branch information
1 parent
316995d
commit 154aa9b
Showing
22 changed files
with
490 additions
and
452 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
interface ErrorMessageProps { | ||
message: string | undefined; | ||
timeout: boolean; | ||
timeout?: boolean; | ||
} | ||
|
||
export type { ErrorMessageProps }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/ui/components/PasswordValidation/PasswordValidation.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
.password-validation { | ||
padding-bottom: 0; | ||
background-color: var(--ion-color-light); | ||
|
||
ion-item { | ||
--background: var(--ion-color-light); | ||
.password-criteria-icon { | ||
font-size: 1.1rem; | ||
padding: 0.2rem; | ||
margin-right: 0.5rem; | ||
border-radius: 1.5rem; | ||
&.fails { | ||
color: var(--ion-color-secondary); | ||
background: var(--ion-color-light-grey); | ||
} | ||
&.pass { | ||
color: white; | ||
background: var(--ion-color-green); | ||
} | ||
} | ||
|
||
&::part(native) { | ||
padding: 0; | ||
} | ||
} | ||
|
||
@media screen and (min-width: 250px) and (max-width: 370px) { | ||
ion-label { | ||
font-size: 0.8rem; | ||
line-height: 1rem; | ||
} | ||
|
||
ion-icon, | ||
ion-label { | ||
margin-top: 0.5rem; | ||
margin-bottom: 0.5rem; | ||
} | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
src/ui/components/PasswordValidation/PasswordValidation.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { render } from "@testing-library/react"; | ||
import { PasswordValidation } from "../../components/PasswordValidation"; | ||
|
||
describe("Create Password Page", () => { | ||
test("validates password correctly", () => { | ||
const { container } = render(<PasswordValidation password="Abc123!@" />); | ||
const regexConditions = container.getElementsByClassName( | ||
"password-criteria-icon" | ||
); | ||
for (let i = 0; i < regexConditions.length; i++) { | ||
expect(regexConditions[i]).toHaveClass("pass"); | ||
} | ||
}); | ||
|
||
test("validates password length correctly", () => { | ||
const { container } = render(<PasswordValidation password="Abc123!@" />); | ||
const regexConditions = container.getElementsByClassName( | ||
"password-criteria-icon" | ||
); | ||
expect(regexConditions[0]).toHaveClass("pass"); | ||
}); | ||
|
||
test("validates password is too short", () => { | ||
const { container } = render(<PasswordValidation password="Ac123@" />); | ||
const regexConditions = container.getElementsByClassName( | ||
"password-criteria-icon" | ||
); | ||
expect(regexConditions[0]).toHaveClass("fails"); | ||
}); | ||
|
||
test("validates password is too long", () => { | ||
const { container } = render( | ||
<PasswordValidation password="Abc123456789012345678901234567890123456789012345678901234567890123@" /> | ||
); | ||
const regexConditions = container.getElementsByClassName( | ||
"password-criteria-icon" | ||
); | ||
expect(regexConditions[0]).toHaveClass("fails"); | ||
}); | ||
|
||
test("validates password doesn't have uppercase", () => { | ||
const { container } = render(<PasswordValidation password="abc123!@" />); | ||
const regexConditions = container.getElementsByClassName( | ||
"password-criteria-icon" | ||
); | ||
expect(regexConditions[1]).toHaveClass("fails"); | ||
}); | ||
|
||
test("validates password doesn't have lowercase", () => { | ||
const { container } = render(<PasswordValidation password="ABCD123!@" />); | ||
const regexConditions = container.getElementsByClassName( | ||
"password-criteria-icon" | ||
); | ||
expect(regexConditions[2]).toHaveClass("fails"); | ||
}); | ||
|
||
test("validates password doesn't have number", () => { | ||
const { container } = render(<PasswordValidation password="ABCDabcde!@" />); | ||
const regexConditions = container.getElementsByClassName( | ||
"password-criteria-icon" | ||
); | ||
expect(regexConditions[3]).toHaveClass("fails"); | ||
}); | ||
|
||
test("validates password doesn't have symbol", () => { | ||
const { container } = render( | ||
<PasswordValidation password="ABCDabcde123" /> | ||
); | ||
const regexConditions = container.getElementsByClassName( | ||
"password-criteria-icon" | ||
); | ||
expect(regexConditions[4]).toHaveClass("fails"); | ||
}); | ||
}); |
Oops, something went wrong.