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

Update WorkspaceControlPanelButton to handle multiple plugins. Closes #2325

parent 92a955a6
No related branches found
No related tags found
No related merge requests found
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { shallow } from 'enzyme';
import WorkspaceAddButton from '../../../src/containers/WorkspaceAddButton';
import WorkspaceMenuButton from '../../../src/containers/WorkspaceMenuButton';
import WorkspaceFullScreenButton from '../../../src/containers/WorkspaceFullScreenButton'; import WorkspaceFullScreenButton from '../../../src/containers/WorkspaceFullScreenButton';
import { WorkspaceControlPanelButtons } import { WorkspaceControlPanelButtons }
from '../../../src/components/WorkspaceControlPanelButtons'; from '../../../src/components/WorkspaceControlPanelButtons';
...@@ -10,7 +12,10 @@ describe('WorkspaceControlPanelButtons', () => { ...@@ -10,7 +12,10 @@ describe('WorkspaceControlPanelButtons', () => {
wrapper = shallow(<WorkspaceControlPanelButtons />); wrapper = shallow(<WorkspaceControlPanelButtons />);
}); });
it('renders without an error', () => { it('render all needed elements', () => {
expect(wrapper.find(WorkspaceAddButton).length).toBe(1);
expect(wrapper.find(WorkspaceMenuButton).length).toBe(1);
expect(wrapper.find(WorkspaceFullScreenButton).length).toBe(1); expect(wrapper.find(WorkspaceFullScreenButton).length).toBe(1);
expect(wrapper.find('PluginHook').length).toBe(1);
}); });
}); });
...@@ -5,8 +5,12 @@ import WorkspaceMenuButton from '../containers/WorkspaceMenuButton'; ...@@ -5,8 +5,12 @@ import WorkspaceMenuButton from '../containers/WorkspaceMenuButton';
/** Renders plugins */ /** Renders plugins */
const PluginHook = (props) => { const PluginHook = (props) => {
const { PluginComponent } = props; // eslint-disable-line react/prop-types const { PluginComponents } = props; // eslint-disable-line react/prop-types
return PluginComponent ? <PluginComponent {...props} /> : null; return PluginComponents ? (
PluginComponents.map((PluginComponent, index) => (
<PluginComponent {...props} key={index} /> // eslint-disable-line react/no-array-index-key
))
) : null;
}; };
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment