Skip to content

Commit

Permalink
feat(connector): connectClearAll iteration 2 (fix)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre Stanislawski committed Mar 20, 2017
1 parent 097e6c8 commit 03653f1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
6 changes: 0 additions & 6 deletions src/connectors/clear-all/__tests__/connectClearAll-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,7 @@ describe('connectClearAll', () => {
expect(rendering.lastCall.args[1]).toBe(true);

const firstRenderingOptions = rendering.lastCall.args[0];
expect(firstRenderingOptions.containerNode).toBe(container);
expect(firstRenderingOptions.hasRefinements).toBe(false);
expect(firstRenderingOptions.collapsible).toBe(false);
expect(firstRenderingOptions.shouldAutoHideContainer).toBe(true);

widget.render({
results: new SearchResults(helper.state, [{}]),
Expand All @@ -54,10 +51,7 @@ describe('connectClearAll', () => {
expect(rendering.lastCall.args[1]).toBe(false);

const secondRenderingOptions = rendering.lastCall.args[0];
expect(secondRenderingOptions.containerNode).toBe(container);
expect(secondRenderingOptions.hasRefinements).toBe(false);
expect(secondRenderingOptions.collapsible).toBe(false);
expect(secondRenderingOptions.shouldAutoHideContainer).toBe(true);
});

it('Receives a mean to clear the values', () => {
Expand Down
14 changes: 10 additions & 4 deletions src/widgets/clear-all/__tests__/clear-all-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,19 @@ describe('clearAll()', () => {
shouldAutoHideContainer: true,
templateProps: {
templates: defaultTemplates,
templatesConfig: undefined,
templatesConfig: {},
transformData: undefined,
useCustomCompileOptions: {header: false, footer: false, link: false},
},
url: '#all-cleared',
};
widget.init({helper, createURL: () => {}});
widget.init({
helper,
createURL: () => {},
instantSearchInstance: {
templatesConfig: {},
},
});
});

it('configures nothing', () => {
Expand All @@ -69,8 +75,8 @@ describe('clearAll()', () => {
});

it('calls twice ReactDOM.render(<ClearAll props />, container)', () => {
widget.render({results, helper, state: helper.state, createURL});
widget.render({results, helper, state: helper.state, createURL});
widget.render({results, helper, state: helper.state, createURL, instantSearchInstance: {}});
widget.render({results, helper, state: helper.state, createURL, instantSearchInstance: {}});

expect(ReactDOM.render.calledTwice).toBe(true, 'ReactDOM.render called twice');
expect(ReactDOM.render.firstCall.args[0]).toEqualJSX(<ClearAll {...getProps()} />);
Expand Down
3 changes: 1 addition & 2 deletions src/widgets/clear-all/clear-all.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,10 @@ export default function ClearAll({
cssClasses,
collapsible,
autoHideContainer,
state: {},
renderState: {},
templates,
});

const makeWidget = connectClearAll(specializedRenderer);
return makeWidget({excludeAttributes});
}

0 comments on commit 03653f1

Please sign in to comment.