Skip to content

Commit

Permalink
feat(odyssey-react-mui): add new storyObj with hasShowPassowrd=false
Browse files Browse the repository at this point in the history
  • Loading branch information
AnirudhMani-okta committed Sep 27, 2023
1 parent 6c3b8d2 commit 1e55998
Showing 1 changed file with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ const storybookMeta: Meta<PasswordFieldProps> = {
autoCompleteType: "current-password",
label: "Password",
isOptional: false,
hasShowPassword: true,
id: "password-input",
},
decorators: [MuiThemeDecorator],
Expand Down Expand Up @@ -120,3 +119,22 @@ export const Default: StoryObj<PasswordFieldProps> = {
});
},
};

export const NoShowPassword: StoryObj<PasswordFieldProps> = {
args: {
hasShowPassword: false,
},
play: async ({ args, canvasElement, step }) => {
await step("toggle password", async () => {
const fieldElement = canvasElement.querySelector(
`#${args.id}`
) as HTMLInputElement;
expect(fieldElement.type).toBe("password");

const buttonElement = canvasElement.querySelector(
'[aria-label="toggle password visibility"]'
);
expect(buttonElement).toBe(null);
});
},
};

0 comments on commit 1e55998

Please sign in to comment.