diff --git a/src/Select.js b/src/Select.js index 9c22206e7c..7fd4fdc94e 100644 --- a/src/Select.js +++ b/src/Select.js @@ -553,7 +553,7 @@ const Select = React.createClass({ * @param {Object} nextProps - optionally specify the nextProps so the returned array uses the latest configuration * @returns {Array} the value of the select represented in an array */ - getValueArray (value, nextProps) { + getValueArray (value, nextProps = undefined) { /** support optionally passing in the `nextProps` so `componentWillReceiveProps` updates will function as expected */ const props = typeof nextProps === 'object' ? nextProps : this.props; if (props.multi) { @@ -881,7 +881,16 @@ const Select = React.createClass({ }, renderClear () { - if (!this.props.clearable || (!this.props.value || this.props.value === 0) || (this.props.multi && !this.props.value.length) || this.props.disabled || this.props.isLoading) return; + if ( + !this.props.clearable + || this.props.value === undefined + || this.props.value === null + || this.props.value === '' + || (this.props.multi && !this.props.value.length) + || this.props.disabled + || this.props.isLoading + ) return; + return ( { }); }); + describe('with option value==0', () => { + beforeEach(() => { + instance = createControl({ + options: [{label: 'Zero', value: 0}], + value: 0, + }); + }); + + it.only('should show the clear icon', () => { + expect(ReactDOM.findDOMNode(instance), 'to contain elements matching', '.Select-clear'); + }); + }); + describe('custom menuRenderer option', () => { it('should render the custom menu', () => { const instance = createControl({