Skip to content
Snippets Groups Projects
Commit 63139109 authored by Mathias Maaß's avatar Mathias Maaß
Browse files

Explicitly pass target props to wrapping plugin. Closes #2386

parent 22f1f7f0
Branches
No related tags found
No related merge requests found
......@@ -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 });
});
});
......
......@@ -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)) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment