Skip to content

Commit

Permalink
Merge pull request #610 from bruderstein/fix-tests-1.0
Browse files Browse the repository at this point in the history
Fix tests 1.0
  • Loading branch information
JedWatson committed Nov 22, 2015
2 parents 1c117db + f837b33 commit 0e6d6e9
Show file tree
Hide file tree
Showing 4 changed files with 163 additions and 181 deletions.
9 changes: 7 additions & 2 deletions examples/src/components/States.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ var StatesField = React.createClass({
country: 'AU',
disabled: false,
searchable: this.props.searchable,
selectValue: 'new-south-wales'
selectValue: 'new-south-wales',
clearable: true,
};
},
switchCountry (e) {
Expand Down Expand Up @@ -50,7 +51,7 @@ var StatesField = React.createClass({
return (
<div className="section">
<h3 className="section-heading">{this.props.label}</h3>
<Select ref="stateSelect" autofocus options={options} simpleValue name="selected-state" disabled={this.state.disabled} value={this.state.selectValue} onChange={this.updateValue} searchable={this.state.searchable} />
<Select ref="stateSelect" autofocus options={options} simpleValue clearable={this.state.clearable} name="selected-state" disabled={this.state.disabled} value={this.state.selectValue} onChange={this.updateValue} searchable={this.state.searchable} />

<div style={{ marginTop: 14 }}>
<button type="button" onClick={this.focusStateSelect}>Focus Select</button>
Expand All @@ -62,6 +63,10 @@ var StatesField = React.createClass({
<input type="checkbox" className="checkbox-control" name="disabled" checked={this.state.disabled} onChange={this.toggleCheckbox}/>
<span className="checkbox-label">Disabled</span>
</label>
<label className="checkbox" style={{ marginLeft: 10 }}>
<input type="checkbox" className="checkbox-control" name="clearable" checked={this.state.clearable} onChange={this.toggleCheckbox}/>
<span className="checkbox-label">Clearable</span>
</label>
</div>
<div className="checkbox-list">
<label className="checkbox">
Expand Down
5 changes: 3 additions & 2 deletions src/Select.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ const Select = React.createClass({
closeMenu () {
this.setState({
isOpen: false,
isPseudoFocused: this.state.isFocused && !this.props.multi
isPseudoFocused: this.state.isFocused && !this.props.multi,
inputValue: '',
});
},

Expand Down Expand Up @@ -297,7 +298,7 @@ const Select = React.createClass({
if (this.props.multi) {
if (typeof value === 'string') value = value.split(this.props.delimiter);
if (!Array.isArray(value)) {
if (!value) return [];
if (value === null || value === undefined) return [];
value = [value];
}
return value.map(this.expandValue).filter(i => i);
Expand Down
Loading

0 comments on commit 0e6d6e9

Please sign in to comment.