mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-01 03:29:39 +08:00
parent
7e9cc07059
commit
26c61a12d5
@ -180,9 +180,9 @@ class Input extends React.Component<InputProps, any> {
|
||||
}
|
||||
|
||||
renderClearIcon(prefixCls: string) {
|
||||
const { allowClear } = this.props;
|
||||
const { allowClear, disabled } = this.props;
|
||||
const { value } = this.state;
|
||||
if (!allowClear || value === undefined || value === null || value === '') {
|
||||
if (!allowClear || disabled || value === undefined || value === null || value === '') {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
|
@ -308,4 +308,9 @@ describe('Input allowClear', () => {
|
||||
.getDOMNode(),
|
||||
);
|
||||
});
|
||||
|
||||
it('should not support allowClear when it is disabled', () => {
|
||||
const wrapper = mount(<Input allowClear defaultValue="111" disabled />);
|
||||
expect(wrapper.find('.ant-input-clear-icon').length).toBe(0);
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user