Skip to content

Commit

Permalink
feat(camunda-plugin): display Deployment Tool on Camunda tabs only
Browse files Browse the repository at this point in the history
  • Loading branch information
Niklas Kiefer authored and merge-me[bot] committed Feb 16, 2021
1 parent c47eb2b commit bc998ec
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ export default class DeploymentTool extends PureComponent {
} = this.state;

return <React.Fragment>
{ activeTab && activeTab.type !== 'empty' && <Fill slot="toolbar" group="8_deploy">
{ isCamundaTab(activeTab) && <Fill slot="toolbar" group="8_deploy">
<Button
onClick={ this.deploy }
title="Deploy current diagram"
Expand Down Expand Up @@ -485,3 +485,11 @@ function addOrUpdateById(collection, element) {
element
];
}

function isCamundaTab(tab) {
return tab && [
'bpmn',
'cmmn',
'dmn'
].includes(tab.type);
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,42 @@ describe('<DeploymentTool>', () => {
});


it('should not display the button if there is no active tab', () => {
it('should display the button if there is an active tab', () => {

// given
const { wrapper } = createDeploymentTool({ activeTab: { type: 'empty', id: '__empty' } });
const activeTab = createTab({ type: 'bpmn' });

// when
const { wrapper } = createDeploymentTool({ activeTab });

// then
expect(wrapper.find('Button')).to.have.lengthOf(1);
});


it('should NOT display the button if there is no active tab', () => {

// given
const activeTab = createTab({ type: 'empty', id: '__empty' });

// when
const { wrapper } = createDeploymentTool({ activeTab });

// then
expect(wrapper.find('Button')).to.have.lengthOf(0);
});


it('should NOT display the button if there is no camunda tab', () => {

// given
const activeTab = createTab();

// when
const { wrapper } = createDeploymentTool({ activeTab });

// then
expect(wrapper).to.be.empty;
expect(wrapper.find('Button')).to.have.lengthOf(0);
});


Expand Down Expand Up @@ -605,7 +634,7 @@ function createDeploymentTool({
...props
} = {}, render = shallow) {
const subscribe = (event, callback) => {
event === 'app.activeTabChanged' && callback(activeTab);
event === 'app.activeTabChanged' && callback({ activeTab });
};

const triggerAction = (event, context) => {
Expand Down

0 comments on commit bc998ec

Please sign in to comment.