diff --git a/src/Form/FormAutosuggest.jsx b/src/Form/FormAutosuggest.jsx index f943539172..489b84e758 100644 --- a/src/Form/FormAutosuggest.jsx +++ b/src/Form/FormAutosuggest.jsx @@ -79,7 +79,7 @@ function FormAutosuggest({ return childrenOpt; } - const handleExpand = (e) => { + const handleExpand = () => { setIsMenuClosed(!isMenuClosed); const newState = { @@ -87,7 +87,7 @@ function FormAutosuggest({ }; if (isMenuClosed) { - newState.dropDownItems = getItems(e.target.value); + newState.dropDownItems = getItems(state.displayValue); newState.errorMessage = ''; } diff --git a/src/Form/tests/FormAutosuggest.test.jsx b/src/Form/tests/FormAutosuggest.test.jsx index 1eef6e3fbc..9a00480cd8 100644 --- a/src/Form/tests/FormAutosuggest.test.jsx +++ b/src/Form/tests/FormAutosuggest.test.jsx @@ -140,7 +140,7 @@ describe('FormAutosuggest', () => { expect(container.find(dropdownContainer).find('button').length).toEqual(0); container.find('button.pgn__form-autosuggest__icon-button').simulate('click'); - expect(container.find(dropdownContainer).find('button').length).toEqual(3); + expect(container.find(dropdownContainer).find('button').length).toEqual(1); }); it('shows options list depends on field value', () => {