Skip to content

Commit

Permalink
fix(connectRefinementList): currentRefinements: return an array inste…
Browse files Browse the repository at this point in the history
…ad of first item

fixes #2102
  • Loading branch information
Haroenv committed Apr 7, 2017
1 parent 0b912e9 commit a53223a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Expand Up @@ -262,7 +262,7 @@ describe('connectRefinementList', () => {
});

const firstRenderingOptions = rendering.lastCall.args[0];
expect(firstRenderingOptions.currentRefinement).toBe(null);
expect(firstRenderingOptions.currentRefinement).toEqual([]);

widget.render({
results: new SearchResults(helper.state, [{
Expand All @@ -286,11 +286,11 @@ describe('connectRefinementList', () => {
});

const secondRenderingOptions = rendering.lastCall.args[0];
expect(secondRenderingOptions.currentRefinement).toEqual({
expect(secondRenderingOptions.currentRefinement).toEqual([{
name: 'Decoration',
highlighted: 'Decoration',
count: 880,
isRefined: true,
});
}]);
});
});
2 changes: 1 addition & 1 deletion src/connectors/refinement-list/connectRefinementList.js
Expand Up @@ -101,7 +101,7 @@ export default function connectRefinementList(renderFn) {
isFromSearch,
canRefine: isFromSearch || items.length > 0,
widgetParams,
currentRefinement: items.find(({isRefined}) => isRefined) || null,
currentRefinement: items.filter(({isRefined}) => isRefined) || null,
}, isFirstSearch);
};

Expand Down

0 comments on commit a53223a

Please sign in to comment.