diff --git a/components/input/Input.tsx b/components/input/Input.tsx index 4d4df0157e..f92060c01b 100644 --- a/components/input/Input.tsx +++ b/components/input/Input.tsx @@ -180,9 +180,9 @@ class Input extends React.Component { } 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 ( diff --git a/components/input/__tests__/index.test.js b/components/input/__tests__/index.test.js index 3ea12bba07..a16adc405a 100644 --- a/components/input/__tests__/index.test.js +++ b/components/input/__tests__/index.test.js @@ -308,4 +308,9 @@ describe('Input allowClear', () => { .getDOMNode(), ); }); + + it('should not support allowClear when it is disabled', () => { + const wrapper = mount(); + expect(wrapper.find('.ant-input-clear-icon').length).toBe(0); + }); });