Skip to content

Commit

Permalink
fix: filtered dropdown items by display value instead of event target (
Browse files Browse the repository at this point in the history
  • Loading branch information
cintnguyen authored Aug 18, 2023
1 parent c803a4d commit cac6984
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/Form/FormAutosuggest.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ function FormAutosuggest({
return childrenOpt;
}

const handleExpand = (e) => {
const handleExpand = () => {
setIsMenuClosed(!isMenuClosed);

const newState = {
dropDownItems: [],
};

if (isMenuClosed) {
newState.dropDownItems = getItems(e.target.value);
newState.dropDownItems = getItems(state.displayValue);
newState.errorMessage = '';
}

Expand Down
2 changes: 1 addition & 1 deletion src/Form/tests/FormAutosuggest.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit cac6984

Please sign in to comment.