Skip to content

Commit

Permalink
add tests for removed filter value, updated comment
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnC-80 committed Nov 21, 2024
1 parent 42b44fe commit e197711
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
3 changes: 1 addition & 2 deletions lib/MultiSelection/MultiSelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ const MultiSelection = ({
break;
}
},
//
stateReducer(state, actionAndChanges) {
const { changes, type } = actionAndChanges
switch (type) {
Expand All @@ -274,7 +273,7 @@ const MultiSelection = ({
});
setFilterValue('');
return {
isOpen: false, // keep the menu open after selection.
isOpen: false, // close the menu.
highlightedIndex, // don't move highlight cursor back to top of list on selection.
}
} else {
Expand Down
10 changes: 10 additions & 0 deletions lib/MultiSelection/tests/MultiSelection-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,16 @@ describe('MultiSelect', () => {

it('calls the action\'s onSelect function', () => converge(() => { if (!actionSelected) throw new Error('MultiSelection - action should be executed'); }));
});

describe('clicking a filtered action', () => {
beforeEach(async () => {
await multiselection.filter('act');
await multiselection.select('actionItem');
});

it('calls the action\'s onSelect function', () => converge(() => { if (!actionSelected) throw new Error('MultiSelection - action should be executed'); }));
it('clears the filter value', () => multiselection.has({ filterValue: '' }));
});
});

describe('asyncFiltering', () => {
Expand Down

0 comments on commit e197711

Please sign in to comment.