Skip to content

Commit b21950e

Browse files
fix: correct password visibility toggle test expectations
The test was expecting 'Hide password' label initially, but the component correctly shows 'Show password' when password is hidden (isVisible = false). Updated test to match the correct component behavior.
1 parent 93bfc60 commit b21950e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

apps/docs/src/remix-hook-form/password-field.stories.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,20 +123,20 @@ const testDefaultValues = ({ canvas }: StoryContext) => {
123123

124124
const testPasswordVisibilityToggle = async ({ canvas }: StoryContext) => {
125125
const passwordInput = canvas.getByLabelText('Password');
126-
const toggleButton = canvas.getByLabelText('Hide password');
126+
const toggleButton = canvas.getByLabelText('Show password');
127127

128128
// Initially password should be hidden (type="password")
129129
expect(passwordInput).toHaveAttribute('type', 'password');
130130

131131
// Click toggle to show password
132132
await userEvent.click(toggleButton);
133133
expect(passwordInput).toHaveAttribute('type', 'text');
134-
expect(canvas.getByLabelText('Show password')).toBeInTheDocument();
134+
expect(canvas.getByLabelText('Hide password')).toBeInTheDocument();
135135

136136
// Click toggle to hide password again
137-
await userEvent.click(canvas.getByLabelText('Show password'));
137+
await userEvent.click(canvas.getByLabelText('Hide password'));
138138
expect(passwordInput).toHaveAttribute('type', 'password');
139-
expect(canvas.getByLabelText('Hide password')).toBeInTheDocument();
139+
expect(canvas.getByLabelText('Show password')).toBeInTheDocument();
140140
};
141141

142142
const testWeakPasswordValidation = async ({ canvas }: StoryContext) => {

0 commit comments

Comments
 (0)