Browse Source

🐛 Fix Input.Password unmount crash (#18475)

close #18473
pull/18482/head
偏右 5 years ago
committed by GitHub
parent
commit
c9a703d9fb
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      components/input/Password.tsx
  2. 8
      components/input/__tests__/Password.test.js

4
components/input/Password.tsx

@ -55,7 +55,9 @@ export default class Password extends React.Component<PasswordProps, PasswordSta
}
saveInput = (instance: Input) => {
this.input = instance.input;
if (instance && instance.input) {
this.input = instance.input;
}
};
focus() {

8
components/input/__tests__/Password.test.js

@ -61,4 +61,12 @@ describe('Input.Password', () => {
.getDOMNode(),
);
});
// https://github.com/ant-design/ant-design/pull/18441
it('should unmount without error', () => {
const wrapper = mount(<Input.Password />);
expect(() => {
wrapper.unmount();
}).not.toThrow();
});
});

Loading…
Cancel
Save