Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests 1.0 #610

Merged
merged 28 commits into from
Nov 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
f4a6fb6
Update wallaby.js
bruderstein Nov 8, 2015
edb91fd
Test removed - relies on changing value
bruderstein Nov 9, 2015
309f7c3
Tests removed - behaviour changed
bruderstein Nov 9, 2015
825b603
Two tests marked as "broken" that actually weren't :)
bruderstein Nov 9, 2015
d29743f
The hidden input is only rendered with a name property
bruderstein Nov 9, 2015
ebf7046
Wrong selector was used in test
bruderstein Nov 9, 2015
5778276
Add TODO marking a genuine regression
bruderstein Nov 9, 2015
983396f
Add `wireUpOnChangeToValue` option for `createControlWithWrapper`
bruderstein Nov 9, 2015
ad2ad88
value prop for multi should now be an array, or a single value
bruderstein Nov 20, 2015
4d5eaf5
Fix for value prop being set to zero
bruderstein Nov 20, 2015
ef21e38
Fix tests for param changes for onChange
bruderstein Nov 20, 2015
c7b2d84
Fix tests for `multi=true` with value prop set
bruderstein Nov 20, 2015
b74f272
More value prop / onChange test fixes
bruderstein Nov 20, 2015
f4810d9
Comma to create an item is no longer supported
bruderstein Nov 22, 2015
1dfa63a
Behaviour change: multi-select non-searchable remains open after select
bruderstein Nov 22, 2015
420a70a
When selection is empty, onChange now called with null
bruderstein Nov 22, 2015
73c7447
onChange called with null, and placeholder selector changed
bruderstein Nov 22, 2015
9767a8d
Fix bug where escape doesn't clear the input
bruderstein Nov 22, 2015
377b832
SimpleValue and delimiter tests fixed for 1.0
bruderstein Nov 22, 2015
3f102e5
The options are initially filtered, then again when control focused
bruderstein Nov 22, 2015
c76c80b
No public API for getInputNode()
bruderstein Nov 22, 2015
906a129
For disabled, input element is now rendered, just with a readonly
bruderstein Nov 22, 2015
801fada
onClick is now onMouseDown
bruderstein Nov 22, 2015
9ec273b
Wrong selectors were used in tests
bruderstein Nov 22, 2015
4c423c1
label renderer is now inside the .Select-value-label span
bruderstein Nov 22, 2015
b95c9c2
"Clicking away" is now controlled by blurring the text input
bruderstein Nov 22, 2015
a68eaea
When value is not in the options, it must be a full option
bruderstein Nov 22, 2015
f837b33
Temporarily disabling asyncOptions tests
bruderstein Nov 22, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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