Skip to content

Commit

Permalink
Merge pull request #1882 from auth0/blank-pw-hint
Browse files Browse the repository at this point in the history
Show the "Can't be blank" message under the password input
  • Loading branch information
adamjmcgrath authored Jun 11, 2020
2 parents 26acc3f + 64c18a2 commit eb6f64c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions css/index.styl
Original file line number Diff line number Diff line change
Expand Up @@ -1210,6 +1210,7 @@ loadingSize = 30px
.auth0-lock-password-strength
width 100%
bottom 41px
left 0
// width calc(100% - 28px)
display block
text-align left
Expand Down
9 changes: 5 additions & 4 deletions src/__tests__/ui/input/__snapshots__/input_wrap.test.jsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ exports[`InputWrap renders correctly with the \`after\` prop 1`] = `
>
<div
className="auth0-lock-input-wrap"
/>
<span>
after
</span>
>
<span>
after
</span>
</div>
</div>
`;
6 changes: 6 additions & 0 deletions src/__tests__/ui/input/password_input.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { mount, shallow } from 'enzyme';

import { mockComponent } from 'testUtils';
import { extractPropsFromWrapper } from '../../testUtils';
import InputWrap from '../../../ui/input/input_wrap';

jest.mock('ui/input/input_wrap', () => mockComponent('input_wrap'));
jest.mock('ui/input/password/password_strength', () => mockComponent('password_strength'));
Expand Down Expand Up @@ -51,4 +52,9 @@ describe('PasswordInput', () => {
const wrapper = mount(<Input {...defaultProps} />);
expect(wrapper.find('input').props().autoComplete).toBe('off');
});
test('shows invalid Hint', () => {
const Input = getComponent();
const wrapper = mount(<Input {...defaultProps} />);
expect(wrapper.find(InputWrap).props().invalidHint).toBe('invalidHint');
});
});
2 changes: 1 addition & 1 deletion src/ui/input/input_wrap.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ export default class InputWrap extends React.Component {
<div className={wrapClassName}>
{iconElement}
{this.props.children}
{after}
</div>
{after}
{errorTooltip}
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/input/password_input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default class PasswordInput extends React.Component {
<InputWrap
after={passwordStrength}
focused={focused}
invalidHint={policy ? undefined : invalidHint}
invalidHint={invalidHint}
isValid={isValid}
name="password"
icon={icon}
Expand Down

0 comments on commit eb6f64c

Please sign in to comment.