diff --git a/__tests__/src/extend/withPlugins.test.js b/__tests__/src/extend/withPlugins.test.js index 1fbc554e1d11479a2312c77691312bb8a8c00c6a..1e3372b2501359e748c030215d3b331a239ed508 100644 --- a/__tests__/src/extend/withPlugins.test.js +++ b/__tests__/src/extend/withPlugins.test.js @@ -42,7 +42,7 @@ describe('PluginHoc: if no plugin exists for the target', () => { }); describe('PluginHoc: if wrap plugins exist for target', () => { - it('renders the first wrap plugin and passes the target component as prop', () => { + it('renders the first wrap plugin and passes the target component and the target props to it', () => { /** */ const WrapPluginComponentA = props => <div>look i am a plugin</div>; /** */ const WrapPluginComponentB = props => <div>look i am a plugin</div>; const plugins = { @@ -54,9 +54,8 @@ describe('PluginHoc: if wrap plugins exist for target', () => { const hoc = createPluginHoc(plugins); const selector = 'Connect(WrapPluginComponentA)'; expect(hoc.find(selector).length).toBe(1); - expect(hoc.find(selector).props().foo).toBe(1); - expect(hoc.find(selector).props().bar).toBe(2); expect(hoc.find(selector).props().TargetComponent).toBe(Target); + expect(hoc.find(selector).props().targetProps).toEqual({ bar: 2, foo: 1 }); }); }); diff --git a/src/extend/withPlugins.js b/src/extend/withPlugins.js index 8a5f7473380d8f49b0d5992351e46598b6e6db00..2f79734818156b96f4cb81749de4f4286cdc5340 100644 --- a/src/extend/withPlugins.js +++ b/src/extend/withPlugins.js @@ -18,7 +18,7 @@ function _withPlugins(targetName, TargetComponent) { // eslint-disable-line no-u if (!isEmpty(plugins.wrap)) { const WrapPluginComponent = connectPluginComponent(plugins.wrap[0]); - return <WrapPluginComponent {...this.props} TargetComponent={TargetComponent} />; + return <WrapPluginComponent targetProps={this.props} TargetComponent={TargetComponent} />; } if (!isEmpty(plugins.add)) {