diff --git a/packages/venia-concept/src/components/SearchBar/__tests__/searchBar.spec.js b/packages/venia-concept/src/components/SearchBar/__tests__/searchBar.spec.js index 824657c408..6d59748735 100644 --- a/packages/venia-concept/src/components/SearchBar/__tests__/searchBar.spec.js +++ b/packages/venia-concept/src/components/SearchBar/__tests__/searchBar.spec.js @@ -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', { @@ -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', () => { diff --git a/packages/venia-concept/src/components/SearchBar/searchBar.js b/packages/venia-concept/src/components/SearchBar/searchBar.js index 19f0301497..7f5082e4f8 100644 --- a/packages/venia-concept/src/components/SearchBar/searchBar.js +++ b/packages/venia-concept/src/components/SearchBar/searchBar.js @@ -107,6 +107,7 @@ export class SearchBar extends Component { }; resetForm = () => { + this.updateAutocompleteVisible(false); this.formApi.reset(); };