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

Does not call onSuggestSelect when user input is empty #383

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 0 additions & 3 deletions src/Geosuggest.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,6 @@ class Geosuggest extends React.Component {
* @param {String} userInput The input value of the user
*/
onInputChange = userInput => {
if (!userInput) {
this.props.onSuggestSelect();
}
this.setState({userInput}, this.onAfterInputChange);
};

Expand Down
20 changes: 0 additions & 20 deletions test/Geosuggest_spec.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,26 +113,6 @@ describe('Component: Geosuggest', () => {
expect(onSuggestSelect.calledOnce).to.be.true; // eslint-disable-line no-unused-expressions, max-len
});

it('should call `onSuggestSelect` when we clear out the selected city', () => { // eslint-disable-line max-len
const geoSuggestInput = TestUtils.findRenderedDOMComponentWithClass(component, 'geosuggest__input'); // eslint-disable-line max-len
geoSuggestInput.value = 'New';
TestUtils.Simulate.change(geoSuggestInput);
TestUtils.Simulate.keyDown(geoSuggestInput, {
key: 'keyDown',
keyCode: 40,
which: 40
});
TestUtils.Simulate.keyDown(geoSuggestInput, {
key: 'Enter',
keyCode: 13,
which: 13
});
expect(onSuggestSelect.calledOnce).to.be.true; // eslint-disable-line no-unused-expressions, max-len
geoSuggestInput.value = '';
TestUtils.Simulate.change(geoSuggestInput);
expect(onSuggestSelect.calledWithExactly()).to.be.true; // eslint-disable-line no-unused-expressions, max-len
});

it('should call `onActivateSuggest` when we key down to a suggestion', () => { // eslint-disable-line max-len
const geoSuggestInput = TestUtils.findRenderedDOMComponentWithClass(component, 'geosuggest__input'); // eslint-disable-line max-len
geoSuggestInput.value = 'New';
Expand Down