From 7cebf58d2b1431f6a78de53ab3d60bb75b665680 Mon Sep 17 00:00:00 2001 From: Samuel Vaillant Date: Mon, 9 Oct 2017 12:15:15 +0200 Subject: [PATCH] fix(connectRangeSlider): only clear the refinement on the current attribute (#2459) --- .../__tests__/connectRangeSlider-test.js | 18 +++++++++--------- .../range-slider/connectRangeSlider.js | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/connectors/range-slider/__tests__/connectRangeSlider-test.js b/src/connectors/range-slider/__tests__/connectRangeSlider-test.js index 2b185f41ce..c39ffe2351 100644 --- a/src/connectors/range-slider/__tests__/connectRangeSlider-test.js +++ b/src/connectors/range-slider/__tests__/connectRangeSlider-test.js @@ -539,7 +539,7 @@ describe('connectRangeSlider', () => { expect(helper.getNumericRefinement(attributeName, '>=')).toEqual([10]); expect(helper.getNumericRefinement(attributeName, '<=')).toEqual([490]); - expect(helper.clearRefinements).toHaveBeenCalled(); + expect(helper.clearRefinements).toHaveBeenCalledWith(attributeName); expect(helper.search).toHaveBeenCalled(); }); @@ -553,7 +553,7 @@ describe('connectRangeSlider', () => { expect(helper.getNumericRefinement(attributeName, '>=')).toEqual([10]); expect(helper.getNumericRefinement(attributeName, '<=')).toEqual([490]); - expect(helper.clearRefinements).toHaveBeenCalled(); + expect(helper.clearRefinements).toHaveBeenCalledWith(attributeName); expect(helper.search).toHaveBeenCalled(); }); @@ -570,7 +570,7 @@ describe('connectRangeSlider', () => { expect(helper.getNumericRefinement(attributeName, '>=')).toEqual([10]); expect(helper.getNumericRefinement(attributeName, '<=')).toEqual([490]); - expect(helper.clearRefinements).toHaveBeenCalled(); + expect(helper.clearRefinements).toHaveBeenCalledWith(attributeName); expect(helper.search).toHaveBeenCalled(); }); @@ -587,7 +587,7 @@ describe('connectRangeSlider', () => { expect(helper.getNumericRefinement(attributeName, '>=')).toEqual([10]); expect(helper.getNumericRefinement(attributeName, '<=')).toEqual([490]); - expect(helper.clearRefinements).toHaveBeenCalled(); + expect(helper.clearRefinements).toHaveBeenCalledWith(attributeName); expect(helper.search).toHaveBeenCalled(); }); @@ -603,7 +603,7 @@ describe('connectRangeSlider', () => { undefined ); expect(helper.getNumericRefinement(attributeName, '<=')).toEqual([490]); - expect(helper.clearRefinements).toHaveBeenCalled(); + expect(helper.clearRefinements).toHaveBeenCalledWith(attributeName); expect(helper.search).toHaveBeenCalled(); }); @@ -619,7 +619,7 @@ describe('connectRangeSlider', () => { expect(helper.getNumericRefinement(attributeName, '<=')).toEqual( undefined ); - expect(helper.clearRefinements).toHaveBeenCalled(); + expect(helper.clearRefinements).toHaveBeenCalledWith(attributeName); expect(helper.search).toHaveBeenCalled(); }); @@ -635,7 +635,7 @@ describe('connectRangeSlider', () => { undefined ); expect(helper.getNumericRefinement(attributeName, '<=')).toEqual([490]); - expect(helper.clearRefinements).toHaveBeenCalled(); + expect(helper.clearRefinements).toHaveBeenCalledWith(attributeName); expect(helper.search).toHaveBeenCalled(); }); @@ -651,7 +651,7 @@ describe('connectRangeSlider', () => { expect(helper.getNumericRefinement(attributeName, '<=')).toEqual( undefined ); - expect(helper.clearRefinements).toHaveBeenCalled(); + expect(helper.clearRefinements).toHaveBeenCalledWith(attributeName); expect(helper.search).toHaveBeenCalled(); }); @@ -686,7 +686,7 @@ describe('connectRangeSlider', () => { expect(helper.getNumericRefinement(attributeName, '<=')).toEqual( undefined ); - expect(helper.clearRefinements).toHaveBeenCalled(); + expect(helper.clearRefinements).toHaveBeenCalledWith(attributeName); expect(helper.search).toHaveBeenCalled(); }); }); diff --git a/src/connectors/range-slider/connectRangeSlider.js b/src/connectors/range-slider/connectRangeSlider.js index 5ac51ce938..9bb26801ec 100644 --- a/src/connectors/range-slider/connectRangeSlider.js +++ b/src/connectors/range-slider/connectRangeSlider.js @@ -132,7 +132,7 @@ export default function connectRangeSlider(renderFn) { !hasMaxBound && rangeMax === nextMax ? undefined : nextMax; if (min !== newNextMin || max !== newNextMax) { - helper.clearRefinements(); + helper.clearRefinements(attributeName); const isValidMinInput = _isFinite(newNextMin); const isValidMinRange = _isFinite(rangeMin);