diff --git a/widgets/hits-per-page-selector/__tests__/hits-per-page-selector-test.js b/widgets/hits-per-page-selector/__tests__/hits-per-page-selector-test.js
index 21d0aa76fc..b06757d20b 100644
--- a/widgets/hits-per-page-selector/__tests__/hits-per-page-selector-test.js
+++ b/widgets/hits-per-page-selector/__tests__/hits-per-page-selector-test.js
@@ -58,7 +58,8 @@ describe('hitsPerPageSelector()', () => {
expect(widget.getConfiguration).toEqual(undefined);
});
- it('calls ReactDOM.render(, container)', () => {
+ it('calls twice ReactDOM.render(, container)', () => {
+ widget.render({helper, results, state: helper.state});
widget.render({helper, results, state: helper.state});
props = {
cssClasses: {
@@ -73,9 +74,11 @@ describe('hitsPerPageSelector()', () => {
],
setValue: () => {}
};
- expect(ReactDOM.render.calledOnce).toBe(true, 'ReactDOM.render called once');
+ expect(ReactDOM.render.calledTwice).toBe(true, 'ReactDOM.render called twice');
expect(ReactDOM.render.firstCall.args[0]).toEqualJSX();
expect(ReactDOM.render.firstCall.args[1]).toEqual(container);
+ expect(ReactDOM.render.secondCall.args[0]).toEqualJSX();
+ expect(ReactDOM.render.secondCall.args[1]).toEqual(container);
});
it('sets the underlying hitsPerPage', () => {
diff --git a/widgets/hits/__tests__/hits-test.js b/widgets/hits/__tests__/hits-test.js
index 67b3e28979..e78d43b269 100644
--- a/widgets/hits/__tests__/hits-test.js
+++ b/widgets/hits/__tests__/hits-test.js
@@ -45,13 +45,16 @@ describe('hits()', () => {
expect(widget.getConfiguration()).toEqual({hitsPerPage: 20});
});
- it('calls ReactDOM.render(, container)', () => {
+ it('calls twice ReactDOM.render(, container)', () => {
props = getProps();
widget.render({results});
+ widget.render({results});
- expect(ReactDOM.render.calledOnce).toBe(true, 'ReactDOM.render called once');
+ expect(ReactDOM.render.calledTwice).toBe(true, 'ReactDOM.render called twice');
expect(ReactDOM.render.firstCall.args[0]).toEqualJSX();
expect(ReactDOM.render.firstCall.args[1]).toEqual(container);
+ expect(ReactDOM.render.secondCall.args[0]).toEqualJSX();
+ expect(ReactDOM.render.secondCall.args[1]).toEqual(container);
});
afterEach(() => {
diff --git a/widgets/index-selector/__tests__/index-selector-test.js b/widgets/index-selector/__tests__/index-selector-test.js
index 4cd4879d38..7c97c38809 100644
--- a/widgets/index-selector/__tests__/index-selector-test.js
+++ b/widgets/index-selector/__tests__/index-selector-test.js
@@ -56,7 +56,8 @@ describe('indexSelector()', () => {
expect(widget.getConfiguration).toEqual(undefined);
});
- it('calls ReactDOM.render(, container)', () => {
+ it('calls twice ReactDOM.render(, container)', () => {
+ widget.render({helper, results});
widget.render({helper, results});
props = {
cssClasses: {
@@ -71,9 +72,11 @@ describe('indexSelector()', () => {
],
setValue: () => {}
};
- expect(ReactDOM.render.calledOnce).toBe(true, 'ReactDOM.render called once');
+ expect(ReactDOM.render.calledTwice).toBe(true, 'ReactDOM.render called twice');
expect(ReactDOM.render.firstCall.args[0]).toEqualJSX();
expect(ReactDOM.render.firstCall.args[1]).toEqual(container);
+ expect(ReactDOM.render.secondCall.args[0]).toEqualJSX();
+ expect(ReactDOM.render.secondCall.args[1]).toEqual(container);
});
it('sets the underlying index', () => {
diff --git a/widgets/pagination/__tests__/pagination-test.js b/widgets/pagination/__tests__/pagination-test.js
index 3edde7125f..5fa9059bfc 100644
--- a/widgets/pagination/__tests__/pagination-test.js
+++ b/widgets/pagination/__tests__/pagination-test.js
@@ -44,12 +44,15 @@ describe('pagination()', () => {
expect(helper.search.calledOnce).toBe(true);
});
- it('calls ReactDOM.render(, container)', () => {
+ it('calls twice ReactDOM.render(, container)', () => {
+ widget.render({results, helper});
widget.render({results, helper});
- expect(ReactDOM.render.calledOnce).toBe(true, 'ReactDOM.render called once');
+ expect(ReactDOM.render.calledTwice).toBe(true, 'ReactDOM.render called twice');
expect(ReactDOM.render.firstCall.args[0]).toEqualJSX();
expect(ReactDOM.render.firstCall.args[1]).toEqual(container);
+ expect(ReactDOM.render.secondCall.args[0]).toEqualJSX();
+ expect(ReactDOM.render.secondCall.args[1]).toEqual(container);
});
context('mocking getContainerNode', function() {
diff --git a/widgets/price-ranges/__tests__/price-ranges-test.js b/widgets/price-ranges/__tests__/price-ranges-test.js
index 64caead2f7..b4f63fded6 100644
--- a/widgets/price-ranges/__tests__/price-ranges-test.js
+++ b/widgets/price-ranges/__tests__/price-ranges-test.js
@@ -96,12 +96,15 @@ describe('priceRanges()', () => {
};
});
- it('calls ReactDOM.render(, container)', () => {
+ it('calls twice ReactDOM.render(, container)', () => {
+ widget.render({results, helper});
widget.render({results, helper});
- expect(ReactDOM.render.calledOnce).toBe(true, 'ReactDOM.render called once');
+ expect(ReactDOM.render.calledTwice).toBe(true, 'ReactDOM.render called twice');
expect(ReactDOM.render.firstCall.args[0]).toEqualJSX();
expect(ReactDOM.render.firstCall.args[1]).toEqual(container);
+ expect(ReactDOM.render.secondCall.args[0]).toEqualJSX();
+ expect(ReactDOM.render.secondCall.args[1]).toEqual(container);
});
it('calls the decorators', () => {
diff --git a/widgets/range-slider/__tests__/range-slider-test.js b/widgets/range-slider/__tests__/range-slider-test.js
index dc09781000..833daee885 100644
--- a/widgets/range-slider/__tests__/range-slider-test.js
+++ b/widgets/range-slider/__tests__/range-slider-test.js
@@ -56,27 +56,32 @@ describe('rangeSlider()', () => {
expect(widget.getConfiguration()).toEqual({disjunctiveFacets: ['aFacetName']});
});
- it('calls ReactDOM.render(, container)', () => {
+ it('calls twice ReactDOM.render(, container)', () => {
widget.render({results, helper});
- expect(ReactDOM.render.calledOnce).toBe(true, 'ReactDOM.render called once');
- expect(autoHideContainer.calledOnce).toBe(true, 'autoHideContainer called once');
- expect(headerFooter.calledOnce).toBe(true, 'headerFooter called once');
- expect(ReactDOM.render.firstCall.args[0]).toEqualJSX(
- {}}
- range={{max: 4999.98, min: 1.99}}
- shouldAutoHideContainer={false}
- start={[-Infinity, Infinity]}
- templateProps={{
+ widget.render({results, helper});
+
+ var props = {
+ cssClasses: {body: null, root: null},
+ onChange: () => {},
+ range: {max: 4999.98, min: 1.99},
+ shouldAutoHideContainer: false,
+ start: [-Infinity, Infinity],
+ templateProps: {
templates: {footer: '', header: ''},
templatesConfig: undefined,
transformData: undefined,
useCustomCompileOptions: {footer: false, header: false}
- }}
- tooltips
- />);
+ },
+ tooltips: true
+ };
+
+ expect(ReactDOM.render.calledTwice).toBe(true, 'ReactDOM.render called twice');
+ expect(autoHideContainer.calledOnce).toBe(true, 'autoHideContainer called once');
+ expect(headerFooter.calledOnce).toBe(true, 'headerFooter called once');
+ expect(ReactDOM.render.firstCall.args[0]).toEqualJSX();
expect(ReactDOM.render.firstCall.args[1]).toEqual(container);
+ expect(ReactDOM.render.secondCall.args[0]).toEqualJSX();
+ expect(ReactDOM.render.secondCall.args[1]).toEqual(container);
});
it('doesn\'t call the refinement functions if not refined', () => {
diff --git a/widgets/stats/__tests__/stats-test.js b/widgets/stats/__tests__/stats-test.js
index 44931b4e91..e3e90f05c8 100644
--- a/widgets/stats/__tests__/stats-test.js
+++ b/widgets/stats/__tests__/stats-test.js
@@ -47,30 +47,33 @@ describe('stats()', () => {
expect(widget.getConfiguration).toEqual(undefined);
});
- it('calls ReactDOM.render(, container)', () => {
+ it('calls twice ReactDOM.render(, container)', () => {
widget.render({results});
- expect(ReactDOM.render.calledOnce).toBe(true, 'ReactDOM.render called once');
- expect(autoHideContainer.calledOnce).toBe(true, 'autoHideContainer called once');
- expect(headerFooter.calledOnce).toBe(true, 'headerFooter called once');
- expect(ReactDOM.render.firstCall.args[0]).toEqualJSX(
- );
+ },
+ hitsPerPage: 2,
+ nbHits: 20,
+ nbPages: 10,
+ page: 0,
+ processingTimeMS: 42,
+ query: 'a query',
+ shouldAutoHideContainer: false,
+ templateProps: ReactDOM.render.firstCall.args[0].props.templateProps
+ };
+ expect(ReactDOM.render.calledTwice).toBe(true, 'ReactDOM.render called twice');
+ expect(autoHideContainer.calledOnce).toBe(true, 'autoHideContainer called once');
+ expect(headerFooter.calledOnce).toBe(true, 'headerFooter called once');
+ expect(ReactDOM.render.firstCall.args[0]).toEqualJSX();
expect(ReactDOM.render.firstCall.args[1]).toEqual(container);
+ expect(ReactDOM.render.secondCall.args[0]).toEqualJSX();
+ expect(ReactDOM.render.secondCall.args[1]).toEqual(container);
});
afterEach(() => {
diff --git a/widgets/toggle/__tests__/toggle-test.js b/widgets/toggle/__tests__/toggle-test.js
index b76512a2dd..98e733d075 100644
--- a/widgets/toggle/__tests__/toggle-test.js
+++ b/widgets/toggle/__tests__/toggle-test.js
@@ -107,7 +107,7 @@ describe('toggle()', () => {
};
});
- it('calls ReactDOM.render', () => {
+ it('calls twice ReactDOM.render', () => {
results = {
hits: [{Hello: ', world!'}],
nbHits: 1,
@@ -115,8 +115,10 @@ describe('toggle()', () => {
};
widget = toggle({container, facetName, label});
widget.render({results, helper});
- expect(ReactDOM.render.calledOnce).toBe(true, 'ReactDOM.render called once');
+ widget.render({results, helper});
+ expect(ReactDOM.render.calledTwice).toBe(true, 'ReactDOM.render called twice');
expect(ReactDOM.render.firstCall.args[1]).toEqual(container);
+ expect(ReactDOM.render.secondCall.args[1]).toEqual(container);
});
it('with facet values', () => {
@@ -127,6 +129,7 @@ describe('toggle()', () => {
};
widget = toggle({container, facetName, label});
widget.render({results, helper});
+ widget.render({results, helper});
props = {
facetValues: [{count: 1, isRefined: false, name: label}],
@@ -135,6 +138,7 @@ describe('toggle()', () => {
};
expect(ReactDOM.render.firstCall.args[0]).toEqualJSX();
+ expect(ReactDOM.render.secondCall.args[0]).toEqualJSX();
});
it('without facet values', () => {
@@ -145,6 +149,7 @@ describe('toggle()', () => {
};
widget = toggle({container, facetName, label});
widget.render({results, helper});
+ widget.render({results, helper});
props = {
facetValues: [{name: label, isRefined: false, count: null}],
@@ -153,6 +158,7 @@ describe('toggle()', () => {
};
expect(ReactDOM.render.firstCall.args[0]).toEqualJSX();
+ expect(ReactDOM.render.secondCall.args[0]).toEqualJSX();
});
it('when refined', () => {
@@ -166,6 +172,7 @@ describe('toggle()', () => {
};
widget = toggle({container, facetName, label});
widget.render({results, helper});
+ widget.render({results, helper});
props = {
facetValues: [{count: 2, isRefined: true, name: label}],
@@ -174,6 +181,7 @@ describe('toggle()', () => {
};
expect(ReactDOM.render.firstCall.args[0]).toEqualJSX();
+ expect(ReactDOM.render.secondCall.args[0]).toEqualJSX();
});
it('using props.toggleRefinement', () => {