Skip to content

Commit e219e74

Browse files
Merge pull request #36 from input-output-hk/test/LW-10799-create-wallet-e2e [LW-10799]
test: add test ids for PasswordBox [LW-10799]
2 parents aad2e00 + cb2bfa2 commit e219e74

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

src/design-system/password-box/password-box-button.component.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,22 @@ interface PasswordBoxButtonProps {
1010
onClick: (event: Readonly<React.MouseEvent<HTMLButtonElement>>) => void;
1111
disabled: boolean;
1212
isPasswordVisible: boolean;
13+
testId?: string;
1314
}
1415

1516
export const PasswordInputButton = ({
1617
onClick,
1718
disabled,
1819
isPasswordVisible,
20+
testId,
1921
}: Readonly<PasswordBoxButtonProps>): JSX.Element => {
2022
return (
2123
<button
2224
type="button"
2325
className={cx.inputButton}
2426
onClick={onClick}
2527
disabled={disabled}
28+
data-testid={testId}
2629
>
2730
{isPasswordVisible ? (
2831
<CloseEye

src/design-system/password-box/password-box-input.component.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export interface PasswordInputProps extends Form.FormControlProps {
2121
defaultIsPasswordVisible?: boolean;
2222
containerClassName?: string;
2323
containerStyle?: React.CSSProperties;
24+
testId?: string;
2425
}
2526

2627
export const PasswordInput = ({
@@ -35,6 +36,7 @@ export const PasswordInput = ({
3536
onChange,
3637
defaultIsPasswordVisible = false,
3738
containerStyle,
39+
testId,
3840
}: Readonly<PasswordInputProps>): JSX.Element => {
3941
const [isPasswordVisible, setIsPasswordVisible] = useState(
4042
defaultIsPasswordVisible,
@@ -62,6 +64,7 @@ export const PasswordInput = ({
6264
value={value}
6365
onChange={onChange}
6466
id={id}
67+
data-testid={testId}
6568
/>
6669
</Form.Control>
6770
<Form.Label
@@ -70,6 +73,7 @@ export const PasswordInput = ({
7073
{label}
7174
</Form.Label>
7275
<PasswordInputButton
76+
testId={testId && `${testId}-toggle`}
7377
onClick={(event): void => {
7478
event.preventDefault();
7579
setIsPasswordVisible(!isPasswordVisible);

0 commit comments

Comments
 (0)