Skip to content

Commit

Permalink
[BUGFIX] [ISSUE-958] Autocomplete renders loading component on clear (m…
Browse files Browse the repository at this point in the history
…agento#961)

* [BUGFIX] [ISSUE-958] Autocomplete renders loading component on clear
  • Loading branch information
ronak2ram authored and tjwiebell committed Mar 11, 2019
1 parent 10e35b8 commit a2b7a94
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import TestRenderer from 'react-test-renderer';
import { Form } from 'informed';
import TextInput from 'src/components/TextInput';
import SearchBar from '../searchBar';
import SearchAutocomplete from '../autocomplete';

const removeEventListenerMock = jest.fn();
Object.defineProperty(window.document, 'removeEventListener', {
Expand Down Expand Up @@ -119,8 +120,11 @@ test('the reset button clears the input', () => {
const button = instance.find(buttonTypes);
button.props.onClick();

// Test that the input has been cleared.
// Test that the input has been cleared and autocomplete is closed.
expect(input.props.value).toBe('');
expect(
instance.findByType(SearchAutocomplete).props.autocompleteVisible
).toBe(false);
});

test('submitting the form executes the search', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export class SearchBar extends Component {
};

resetForm = () => {
this.updateAutocompleteVisible(false);
this.formApi.reset();
};

Expand Down

0 comments on commit a2b7a94

Please sign in to comment.