onSelectResetsInput regression fixed#2215
Conversation
test/Select-test.js
Outdated
|
|
||
| }); | ||
|
|
||
| describe('with multi=true and onSelectResetsInput=false', () => { |
There was a problem hiding this comment.
more accurately describe('with multi=true and different onSelectResetsInput', () => {
test/Select-test.js
Outdated
| }); | ||
|
|
||
| describe('with multi=true and onSelectResetsInput=false', () => { | ||
| it('should have retained inputValue after accepting selection', () => { |
There was a problem hiding this comment.
it('should have retained inputValue after accepting selection if onSelectResetsInput=false ', () => {
test/Select-test.js
Outdated
| expect(instance.state.inputValue, 'to equal', 'two'); | ||
| }); | ||
|
|
||
| it('should have reset the inputValue after accepting selection', () => { |
There was a problem hiding this comment.
it('should have reset the inputValue after accepting selection if onSelectResetsInput= true or not set', () => {
As suggested by @yuri-sakharov
As suggested by @yuri-sakharov
|
Thanks for the fix @dehamilton and for the review, @yuri-sakharov. I'm about to publish a new version so I've made the changes you suggested directly, so I can get this merged 👍 |
| } | ||
|
|
||
| if (this.state.inputValue && this.props.value !== nextProps.value) { | ||
| if (this.state.inputValue && this.props.value !== nextProps.value && this.props.onSelectResetsInput) { |
There was a problem hiding this comment.
I think better if (this.state.inputValue && this.props.value !== nextProps.value && nextProps.onSelectResetsInput) {
There was a problem hiding this comment.
Hi, @JedWatson
Sorry I didn't see the merge. Can you please also add this change?
Thank you.
Recent changes to componentWillReceiveProps prevented the input from retaining values even if onSelectResetsInput was false. This PR resolves that regression and adds tests around onSelectResetsInput, which I didn't notice anywhere. Also updated package.json to use cross-env for all scripts.