diff --git a/package-lock.json b/package-lock.json index 63b487e6e..433c4a039 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1766,6 +1766,16 @@ "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", "dev": true }, + "camunda-bpmn-js-behaviors": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/camunda-bpmn-js-behaviors/-/camunda-bpmn-js-behaviors-0.1.0.tgz", + "integrity": "sha512-YJs4kAkRhZ1GyE4VVPTJlZ/GjuDHnSGvzuLTa87HIfpEonVMHsmRrQL0Gr/bkSVcQaA4s6XB0XKV6rz32LHNUA==", + "dev": true, + "requires": { + "ids": "^1.0.0", + "min-dash": "^3.7.0" + } + }, "camunda-bpmn-moddle": { "version": "6.1.2", "resolved": "https://registry.npmjs.org/camunda-bpmn-moddle/-/camunda-bpmn-moddle-6.1.2.tgz", diff --git a/package.json b/package.json index d94dc8cde..15b263e20 100644 --- a/package.json +++ b/package.json @@ -75,6 +75,7 @@ "babel-loader": "^8.2.2", "bpmn-js": "9.0.3", "bpmn-moddle": "^7.1.2", + "camunda-bpmn-js-behaviors": "^0.1.0", "camunda-bpmn-moddle": "^6.1.2", "chai": "^4.3.4", "copy-webpack-plugin": "^9.0.0", @@ -111,6 +112,7 @@ }, "peerDependencies": { "bpmn-js": "8.x || 9.x", + "camunda-bpmn-js-behaviors": "0.1.x", "diagram-js": "7.x || 8.x", "@bpmn-io/properties-panel": "0.13.x" } diff --git a/test/spec/provider/camunda-platform/AsynchronousContinuationsProps.bpmn b/test/spec/provider/camunda-platform/AsynchronousContinuationsProps.bpmn index 20433f07b..5b3c12e87 100644 --- a/test/spec/provider/camunda-platform/AsynchronousContinuationsProps.bpmn +++ b/test/spec/provider/camunda-platform/AsynchronousContinuationsProps.bpmn @@ -1,25 +1,35 @@ - + + + - - + + - - + + + + + + + + + + diff --git a/test/spec/provider/camunda-platform/AsynchronousContinuationsProps.spec.js b/test/spec/provider/camunda-platform/AsynchronousContinuationsProps.spec.js index 09ed7e4a3..c8fa2c4f9 100644 --- a/test/spec/provider/camunda-platform/AsynchronousContinuationsProps.spec.js +++ b/test/spec/provider/camunda-platform/AsynchronousContinuationsProps.spec.js @@ -24,6 +24,8 @@ import BpmnPropertiesPanel from 'src/render'; import BpmnPropertiesProvider from 'src/provider/bpmn'; import CamundaPlatformPropertiesProvider from 'src/provider/camunda-platform'; +import BehaviorsModule from 'camunda-bpmn-js-behaviors/lib/camunda-platform'; + import camundaModdleExtensions from 'camunda-bpmn-moddle/resources/camunda.json'; import processDiagramXML from './AsynchronousContinuationsProps.bpmn'; @@ -37,7 +39,8 @@ describe('provider/camunda-platform - AsynchronousContinuationsProps', function( CamundaPlatformPropertiesProvider, CoreModule, ModelingModule, - SelectionModule + SelectionModule, + BehaviorsModule ]; const moddleExtensions = { @@ -447,6 +450,54 @@ describe('provider/camunda-platform - AsynchronousContinuationsProps', function( }) ); + + describe('integration', function() { + + it('should set to true if async before set to false', inject(async function(elementRegistry, selection) { + + // given + const task = elementRegistry.get('Task_2'); + + await act(() => { + selection.select(task); + }); + + // assume + expect(isExclusive(task)).to.be.false; + + // when + const asyncBeforeCheckbox = domQuery('input[name=asynchronousContinuationBefore]', container); + + clickInput(asyncBeforeCheckbox); + + // then + expect(isExclusive(task)).to.be.true; + })); + + + it('should set to true if async after set to false', inject(async function(elementRegistry, selection) { + + // given + const task = elementRegistry.get('Task_3'); + + await act(() => { + selection.select(task); + }); + + // assume + expect(isExclusive(task)).to.be.false; + + // when + const asyncAfterCheckbox = domQuery('input[name=asynchronousContinuationAfter]', container); + + clickInput(asyncAfterCheckbox); + + // then + expect(isExclusive(task)).to.be.true; + })); + + }); + }); }); diff --git a/test/spec/provider/camunda-platform/DmnImplementationProps.spec.js b/test/spec/provider/camunda-platform/DmnImplementationProps.spec.js index 143c57da6..dd4eae410 100644 --- a/test/spec/provider/camunda-platform/DmnImplementationProps.spec.js +++ b/test/spec/provider/camunda-platform/DmnImplementationProps.spec.js @@ -19,6 +19,8 @@ import CoreModule from 'bpmn-js/lib/core'; import SelectionModule from 'diagram-js/lib/features/selection'; import ModelingModule from 'bpmn-js/lib/features/modeling'; +import BehaviorsModule from 'camunda-bpmn-js-behaviors/lib/camunda-platform'; + import BpmnPropertiesPanel from 'src/render'; import BpmnPropertiesProvider from 'src/provider/bpmn'; @@ -37,7 +39,8 @@ describe('provider/camunda-platform - DmnImplementationProps', function() { CamundaPlatformPropertiesProvider, CoreModule, ModelingModule, - SelectionModule + SelectionModule, + BehaviorsModule ]; let container; @@ -745,6 +748,29 @@ describe('provider/camunda-platform - DmnImplementationProps', function() { }) ); + + describe('integration', function() { + + it('should remove map decision result when result variable is removed', inject(async function(elementRegistry, selection) { + + // given + const businessRuleTask = elementRegistry.get('BusinessRuleTask_resultVariable'), + businessObject = getBusinessObject(businessRuleTask); + + await act(() => selection.select(businessRuleTask)); + + // when + const input = domQuery('input[name=decisionRefResultVariable]', container); + + changeInput(input, ''); + + // then + // expect default + expect(businessObject.get('camunda:mapDecisionResult')).to.equal('resultList'); + })); + + }); + }); }); diff --git a/test/spec/provider/camunda-platform/FormDataProps.bpmn b/test/spec/provider/camunda-platform/FormDataProps.bpmn index e2d0e1754..e4e4547c1 100644 --- a/test/spec/provider/camunda-platform/FormDataProps.bpmn +++ b/test/spec/provider/camunda-platform/FormDataProps.bpmn @@ -1,5 +1,5 @@ - + @@ -11,10 +11,9 @@ - - - - + + + @@ -35,6 +34,14 @@ + + + + + + + + @@ -44,6 +51,12 @@ + + + + + + diff --git a/test/spec/provider/camunda-platform/FormDataProps.spec.js b/test/spec/provider/camunda-platform/FormDataProps.spec.js index 4b4fc6c99..edf352ef3 100644 --- a/test/spec/provider/camunda-platform/FormDataProps.spec.js +++ b/test/spec/provider/camunda-platform/FormDataProps.spec.js @@ -24,6 +24,8 @@ import CoreModule from 'bpmn-js/lib/core'; import SelectionModule from 'diagram-js/lib/features/selection'; import ModelingModule from 'bpmn-js/lib/features/modeling'; +import BehaviorsModule from 'camunda-bpmn-js-behaviors/lib/camunda-platform'; + import BpmnPropertiesPanel from 'src/render'; import BpmnPropertiesProvider from 'src/provider/bpmn'; @@ -42,7 +44,8 @@ describe('provider/camunda-platform - FormDataProps', function() { CamundaPlatformPropertiesProvider, CoreModule, ModelingModule, - SelectionModule + SelectionModule, + BehaviorsModule ]; const moddleExtensions = { @@ -247,6 +250,34 @@ describe('provider/camunda-platform - FormDataProps', function() { expect(getFormFieldsList(task)).to.have.length(1); })); + + describe('integration', function() { + + it('should remove business key', inject(async function(elementRegistry, selection) { + + // given + const startEvent = elementRegistry.get('StartEvent_3'); + + await act(() => { + selection.select(startEvent); + }); + + // assume + expect(getFormData(startEvent).get('camunda:businessKey')).to.equal('foo'); + + // when + const formDataGroup = domQuery('div[data-group-id=group-CamundaPlatform__FormData]', container); + + const formFieldRemoveButton = domQueryAll('.bio-properties-panel-remove-entry', formDataGroup)[ 0 ]; + + clickInput(formFieldRemoveButton); + + // then + expect(getFormData(startEvent).get('camunda:businessKey')).not.to.exist; + })); + + }); + }); diff --git a/test/spec/provider/camunda-platform/FormField.bpmn b/test/spec/provider/camunda-platform/FormField.bpmn index 2bf44bd78..210131f65 100644 --- a/test/spec/provider/camunda-platform/FormField.bpmn +++ b/test/spec/provider/camunda-platform/FormField.bpmn @@ -1,5 +1,5 @@ - + @@ -62,6 +62,13 @@ + + + + + + + @@ -80,6 +87,12 @@ + + + + + + diff --git a/test/spec/provider/camunda-platform/FormField.spec.js b/test/spec/provider/camunda-platform/FormField.spec.js index b7198edae..c922efae1 100644 --- a/test/spec/provider/camunda-platform/FormField.spec.js +++ b/test/spec/provider/camunda-platform/FormField.spec.js @@ -25,6 +25,8 @@ import CoreModule from 'bpmn-js/lib/core'; import SelectionModule from 'diagram-js/lib/features/selection'; import ModelingModule from 'bpmn-js/lib/features/modeling'; +import BehaviorsModule from 'camunda-bpmn-js-behaviors/lib/camunda-platform'; + import BpmnPropertiesPanel from 'src/render'; import BpmnPropertiesProvider from 'src/provider/bpmn'; @@ -43,7 +45,8 @@ describe('provider/camunda-platform - FormField', function() { CamundaPlatformPropertiesProvider, CoreModule, ModelingModule, - SelectionModule + SelectionModule, + BehaviorsModule ]; const moddleExtensions = { @@ -126,6 +129,29 @@ describe('provider/camunda-platform - FormField', function() { expect(idInput.value).to.eql(originalValue); })); + + describe('integration', function() { + + it('should update', inject(async function(elementRegistry, selection) { + + // given + const event = elementRegistry.get('StartEvent_2'); + + await act(() => { + selection.select(event); + }); + + const idInput = domQuery('input[name=StartEvent_2-formField-0-formFieldID]', container); + + // when + changeInput(idInput, 'bar'); + + // then + expect(getFormData(event).get('camunda:businessKey')).to.equal('bar'); + })); + + }); + }); @@ -421,6 +447,29 @@ describe('provider/camunda-platform - FormField', function() { }); + + describe('integration', function() { + + it('should remove values when type set to boolean', inject(async function(elementRegistry, selection) { + + // given + const userTask = elementRegistry.get('UserTask_2'); + + await act(() => { + selection.select(userTask); + }); + + const typeSelect = domQuery('select[name=UserTask_2-formField-0-formFieldType]', container); + + // when + changeInput(typeSelect, 'boolean'); + + // then + expect(getFormFieldValues(userTask, 0)).to.be.empty; + })); + + }); + }); diff --git a/test/spec/provider/camunda-platform/FormTypeProps.spec.js b/test/spec/provider/camunda-platform/FormTypeProps.spec.js index 6da1ca7c1..adc5667e8 100644 --- a/test/spec/provider/camunda-platform/FormTypeProps.spec.js +++ b/test/spec/provider/camunda-platform/FormTypeProps.spec.js @@ -24,6 +24,8 @@ import CoreModule from 'bpmn-js/lib/core'; import SelectionModule from 'diagram-js/lib/features/selection'; import ModelingModule from 'bpmn-js/lib/features/modeling'; +import BehaviorsModule from 'camunda-bpmn-js-behaviors/lib/camunda-platform'; + import BpmnPropertiesPanel from 'src/render'; import BpmnPropertiesProvider from 'src/provider/bpmn'; @@ -42,7 +44,8 @@ describe('provider/camunda-platform - FormTypeProps', function() { CamundaPlatformPropertiesProvider, CoreModule, ModelingModule, - SelectionModule + SelectionModule, + BehaviorsModule ]; const moddleExtensions = { @@ -291,6 +294,54 @@ describe('provider/camunda-platform - FormTypeProps', function() { expect(select.value).to.equal(''); })); + + describe('integration', function() { + + it('should remove form key when form ref is set', inject(async function(elementRegistry, selection) { + + // given + const task = elementRegistry.get('StartEvent_FormKey'), + businessObject = getBusinessObject(task); + + await act(() => { + selection.select(task); + }); + + // when + const select = domQuery('select[name=formType]', container); + + changeInput(select, 'formRef'); + + // then + expect(businessObject.get('camunda:formKey')).not.to.exist; + expect(businessObject.get('camunda:formRef')).to.equal(''); + })); + + + it('should remove form ref when form key is set', inject(async function(elementRegistry, selection) { + + // given + const task = elementRegistry.get('StartEvent_FormRef'), + businessObject = getBusinessObject(task); + + await act(() => { + selection.select(task); + }); + + // when + const select = domQuery('select[name=formType]', container); + + changeInput(select, 'formKey'); + + // then + expect(businessObject.get('camunda:formRef')).not.to.exist; + expect(businessObject.get('camunda:formRefBinding')).not.to.exist; + expect(businessObject.get('camunda:formRefVersion')).not.to.exist; + expect(businessObject.get('camunda:formKey')).to.equal(''); + })); + + }); + }); // helpers ////////// diff --git a/test/spec/provider/camunda-platform/ImplementationProps.spec.js b/test/spec/provider/camunda-platform/ImplementationProps.spec.js index 9cbf332c2..6adc9d2f9 100644 --- a/test/spec/provider/camunda-platform/ImplementationProps.spec.js +++ b/test/spec/provider/camunda-platform/ImplementationProps.spec.js @@ -1182,7 +1182,6 @@ describe('provider/camunda-platform - ImplementationProps', function() { }); - }); diff --git a/test/spec/provider/camunda-platform/ImplementationTypeProps.spec.js b/test/spec/provider/camunda-platform/ImplementationTypeProps.spec.js index 7bfaee1bb..d72aae412 100644 --- a/test/spec/provider/camunda-platform/ImplementationTypeProps.spec.js +++ b/test/spec/provider/camunda-platform/ImplementationTypeProps.spec.js @@ -13,7 +13,8 @@ import { } from 'min-dom'; import { - getBusinessObject + getBusinessObject, + is } from 'bpmn-js/lib/util/ModelUtil'; import CoreModule from 'bpmn-js/lib/core'; @@ -34,6 +35,8 @@ import { import BpmnPropertiesProvider from 'src/provider/bpmn'; import CamundaPlatformPropertiesProvider from 'src/provider/camunda-platform'; +import BehaviorsModule from 'camunda-bpmn-js-behaviors/lib/camunda-platform'; + import camundaModdleExtensions from 'camunda-bpmn-moddle/resources/camunda.json'; import diagramXML from './ImplementationProps.bpmn'; @@ -47,7 +50,8 @@ describe('provider/camunda-platform - ImplementationTypeProps', function() { CamundaPlatformPropertiesProvider, CoreModule, ModelingModule, - SelectionModule + SelectionModule, + BehaviorsModule ]; let container; @@ -1326,6 +1330,34 @@ describe('provider/camunda-platform - ImplementationTypeProps', function() { }); + + describe('integration', function() { + + it('should remove error event definitions when updating to non-external', inject( + async function(elementRegistry, selection) { + + // given + const serviceTask = elementRegistry.get('ServiceTask_error'); + + await act(() => { + selection.select(serviceTask); + }); + + // when + const select = domQuery('select[name=implementationType]', container); + + changeInput(select, 'class'); + + // then + const businessObject = getBusinessObject(serviceTask), + errorEventDefinitions = getErrorEventDefinitions(businessObject); + + expect(errorEventDefinitions).to.be.empty; + } + )); + + }); + }); @@ -1350,3 +1382,15 @@ function asOptionNamesList(select) { return names; } + +function getErrorEventDefinitions(businessObject) { + const extensionElements = businessObject.get('extensionElements'); + + if (!extensionElements) { + return; + } + + return extensionElements.get('values').filter((element) => { + return is(element, 'camunda:ErrorEventDefinition'); + }); +} diff --git a/test/spec/provider/camunda-platform/InputProps.bpmn b/test/spec/provider/camunda-platform/InputProps.bpmn index 10584f3b1..4d2400a8c 100644 --- a/test/spec/provider/camunda-platform/InputProps.bpmn +++ b/test/spec/provider/camunda-platform/InputProps.bpmn @@ -1,13 +1,13 @@ - + - - - - + + + + @@ -20,6 +20,13 @@ + + + + + + + @@ -35,6 +42,10 @@ + + + + diff --git a/test/spec/provider/camunda-platform/InputProps.spec.js b/test/spec/provider/camunda-platform/InputProps.spec.js index 8536ef92d..7fae9e5f6 100644 --- a/test/spec/provider/camunda-platform/InputProps.spec.js +++ b/test/spec/provider/camunda-platform/InputProps.spec.js @@ -22,6 +22,8 @@ import CoreModule from 'bpmn-js/lib/core'; import SelectionModule from 'diagram-js/lib/features/selection'; import ModelingModule from 'bpmn-js/lib/features/modeling'; +import BehaviorsModule from 'camunda-bpmn-js-behaviors/lib/camunda-platform'; + import BpmnPropertiesPanel from 'src/render'; import CamundaPlatformPropertiesProvider from 'src/provider/camunda-platform'; @@ -29,6 +31,7 @@ import CamundaPlatformPropertiesProvider from 'src/provider/camunda-platform'; import camundaModdleExtensions from 'camunda-bpmn-moddle/resources/camunda.json'; import { + getInputOutput, getInputParameters } from 'src/provider/camunda-platform/utils/InputOutputUtil'; @@ -40,7 +43,8 @@ describe('provider/camunda-platform - InputProps', function() { const testModules = [ CoreModule, SelectionModule, ModelingModule, BpmnPropertiesPanel, - CamundaPlatformPropertiesProvider + CamundaPlatformPropertiesProvider, + BehaviorsModule ]; const moddleExtensions = { @@ -209,6 +213,33 @@ describe('provider/camunda-platform - InputProps', function() { }) ); + + describe('integration', function() { + + it('should remove empty input output', inject(async function(elementRegistry, selection) { + + // given + const serviceTask = elementRegistry.get('ServiceTask_OneInput'); + + await act(() => { + selection.select(serviceTask); + }); + + const group = getGroup(container, 'CamundaPlatform__Input'); + const listItems = getInputListItems(group); + const removeEntry = domQuery('.bio-properties-panel-remove-entry', listItems[0]); + + // when + await act(() => { + removeEntry.click(); + }); + + // then + expect(getInputOutput(serviceTask)).not.to.exist; + })); + + }); + }); }); diff --git a/test/spec/provider/camunda-platform/JobExecutionProps-Process.bpmn b/test/spec/provider/camunda-platform/JobExecutionProps-Process.bpmn index 8e5fe30c3..760772c55 100644 --- a/test/spec/provider/camunda-platform/JobExecutionProps-Process.bpmn +++ b/test/spec/provider/camunda-platform/JobExecutionProps-Process.bpmn @@ -1,5 +1,5 @@ - + @@ -10,6 +10,11 @@ + + + 1234 + + @@ -25,6 +30,9 @@ + + + diff --git a/test/spec/provider/camunda-platform/JobExecutionProps.spec.js b/test/spec/provider/camunda-platform/JobExecutionProps.spec.js index 352ad64ed..7328eba2a 100644 --- a/test/spec/provider/camunda-platform/JobExecutionProps.spec.js +++ b/test/spec/provider/camunda-platform/JobExecutionProps.spec.js @@ -4,6 +4,7 @@ import { act } from '@testing-library/preact'; import { bootstrapPropertiesPanel, changeInput, + clickInput, inject } from 'test/TestHelper'; @@ -29,6 +30,8 @@ import BpmnPropertiesPanel from 'src/render'; import BpmnPropertiesProvider from 'src/provider/bpmn'; import CamundaPlatformPropertiesProvider from 'src/provider/camunda-platform'; +import BehaviorsModule from 'camunda-bpmn-js-behaviors/lib/camunda-platform'; + import camundaModdleExtensions from 'camunda-bpmn-moddle/resources/camunda.json'; import processDiagramXML from './JobExecutionProps-Process.bpmn'; @@ -43,7 +46,8 @@ describe('provider/camunda-platform - JobExecutionProps', function() { CamundaPlatformPropertiesProvider, CoreModule, ModelingModule, - SelectionModule + SelectionModule, + BehaviorsModule ]; const moddleExtensions = { @@ -378,6 +382,58 @@ describe('provider/camunda-platform - JobExecutionProps', function() { expect(getExtensionElementsList(bo)).to.have.length(2); })); + + describe('integration', function() { + + it('should remove retry time cycle when setting async before to false', inject(async function(elementRegistry, selection) { + + // given + const serviceTask = elementRegistry.get('ServiceTask_3'), + businessObject = getBusinessObject(serviceTask); + + await act(() => { + selection.select(serviceTask); + }); + + expect(businessObject.get('asyncBefore')).to.be.true; + + // when + const asyncBeforeCheckbox = domQuery('input[name=asynchronousContinuationBefore]', container); + + clickInput(asyncBeforeCheckbox); + + // then + expect(businessObject.get('asyncBefore')).to.be.false; + + expect(getJobRetryTimeCycle(serviceTask)).not.to.exist; + })); + + + it('should remove retry time cycle when setting async after to false', inject(async function(elementRegistry, selection) { + + // given + const serviceTask = elementRegistry.get('ServiceTask_2'), + businessObject = getBusinessObject(serviceTask); + + await act(() => { + selection.select(serviceTask); + }); + + expect(businessObject.get('asyncAfter')).to.be.true; + + // when + const asyncAfterCheckbox = domQuery('input[name=asynchronousContinuationAfter]', container); + + clickInput(asyncAfterCheckbox); + + // then + expect(businessObject.get('asyncAfter')).to.be.false; + + expect(getJobRetryTimeCycle(serviceTask)).not.to.exist; + })); + + }); + }); }); @@ -396,6 +452,11 @@ function getJobPriority(element) { function getJobRetryTimeCycle(element) { const businessObject = getBusinessObject(element); - return getExtensionElementsList(businessObject, 'camunda:FailedJobRetryTimeCycle')[0].body || - ''; + const failedJobRetryTimeCycleExtensionElements = getExtensionElementsList(businessObject, 'camunda:FailedJobRetryTimeCycle'); + + if (!failedJobRetryTimeCycleExtensionElements || !failedJobRetryTimeCycleExtensionElements.length) { + return null; + } + + return failedJobRetryTimeCycleExtensionElements[ 0 ].get('body'); } diff --git a/test/spec/provider/camunda-platform/OutputProps.bpmn b/test/spec/provider/camunda-platform/OutputProps.bpmn index 9f7c194fe..5f164c83c 100644 --- a/test/spec/provider/camunda-platform/OutputProps.bpmn +++ b/test/spec/provider/camunda-platform/OutputProps.bpmn @@ -1,13 +1,13 @@ - + - - - - + + + + @@ -20,6 +20,13 @@ + + + + + + + @@ -35,6 +42,10 @@ + + + + diff --git a/test/spec/provider/camunda-platform/OutputProps.spec.js b/test/spec/provider/camunda-platform/OutputProps.spec.js index 05a99624b..97ad58ae3 100644 --- a/test/spec/provider/camunda-platform/OutputProps.spec.js +++ b/test/spec/provider/camunda-platform/OutputProps.spec.js @@ -22,6 +22,8 @@ import CoreModule from 'bpmn-js/lib/core'; import SelectionModule from 'diagram-js/lib/features/selection'; import ModelingModule from 'bpmn-js/lib/features/modeling'; +import BehaviorsModule from 'camunda-bpmn-js-behaviors/lib/camunda-platform'; + import BpmnPropertiesPanel from 'src/render'; import CamundaPlatformPropertiesProvider from 'src/provider/camunda-platform'; @@ -29,6 +31,7 @@ import CamundaPlatformPropertiesProvider from 'src/provider/camunda-platform'; import camundaModdleExtensions from 'camunda-bpmn-moddle/resources/camunda.json'; import { + getInputOutput, getOutputParameters } from 'src/provider/camunda-platform/utils/InputOutputUtil'; @@ -40,7 +43,8 @@ describe('provider/camunda-platform - OutputProps', function() { const testModules = [ CoreModule, SelectionModule, ModelingModule, BpmnPropertiesPanel, - CamundaPlatformPropertiesProvider + CamundaPlatformPropertiesProvider, + BehaviorsModule ]; const moddleExtensions = { @@ -209,6 +213,33 @@ describe('provider/camunda-platform - OutputProps', function() { }) ); + + describe('integration', function() { + + it('should remove empty input output', inject(async function(elementRegistry, selection) { + + // given + const serviceTask = elementRegistry.get('ServiceTask_OneOutput'); + + await act(() => { + selection.select(serviceTask); + }); + + const group = getGroup(container, 'CamundaPlatform__Output'); + const listItems = getOutputListItems(group); + const removeEntry = domQuery('.bio-properties-panel-remove-entry', listItems[0]); + + // when + await act(() => { + removeEntry.click(); + }); + + // then + expect(getInputOutput(serviceTask)).not.to.exist; + })); + + }); + }); }); diff --git a/test/spec/provider/zeebe/AssignmentDefinitionProps.bpmn b/test/spec/provider/zeebe/AssignmentDefinitionProps.bpmn index ddb4d7137..5b11f6120 100644 --- a/test/spec/provider/zeebe/AssignmentDefinitionProps.bpmn +++ b/test/spec/provider/zeebe/AssignmentDefinitionProps.bpmn @@ -1,37 +1,52 @@ - + - + - + + + + + + + + + + + + + + - + - + - - + + + + + + - \ No newline at end of file + diff --git a/test/spec/provider/zeebe/AssignmentDefinitionProps.spec.js b/test/spec/provider/zeebe/AssignmentDefinitionProps.spec.js index a8bde4598..07f3646ac 100644 --- a/test/spec/provider/zeebe/AssignmentDefinitionProps.spec.js +++ b/test/spec/provider/zeebe/AssignmentDefinitionProps.spec.js @@ -26,6 +26,8 @@ import BpmnPropertiesPanel from 'src/render'; import ZeebePropertiesProvider from 'src/provider/zeebe'; +import BehaviorsModule from 'camunda-bpmn-js-behaviors/lib/camunda-cloud'; + import zeebeModdleExtensions from 'zeebe-bpmn-moddle/resources/zeebe'; import { @@ -42,7 +44,8 @@ describe('provider/zeebe - AssignmentDefinitionProps', function() { SelectionModule, ModelingModule, BpmnPropertiesPanel, - ZeebePropertiesProvider + ZeebePropertiesProvider, + BehaviorsModule ]; const moddleExtensions = { @@ -324,6 +327,51 @@ describe('provider/zeebe - AssignmentDefinitionProps', function() { }); + describe('integration', function() { + + describe('removing assignment definition when empty', function() { + + it('removing assignee', inject(async function(elementRegistry, selection) { + + // given + const userTask = elementRegistry.get('UserTask_4'); + + await act(() => { + selection.select(userTask); + }); + + // when + const assigneeInput = domQuery('input[name=assignmentDefinitionAssignee]', container); + + changeInput(assigneeInput, ''); + + // then + expect(getAssignmentDefinition(userTask)).not.to.exist; + })); + + + it('removing candidate groups', inject(async function(elementRegistry, selection) { + + // given + const userTask = elementRegistry.get('UserTask_5'); + + await act(() => { + selection.select(userTask); + }); + + // when + const candidateGroupsInput = domQuery('input[name=assignmentDefinitionCandidateGroups]', container); + + changeInput(candidateGroupsInput, ''); + + // then + expect(getAssignmentDefinition(userTask)).not.to.exist; + })); + + }); + + }); + }); diff --git a/test/spec/provider/zeebe/BusinessRuleImplementationProps.bpmn b/test/spec/provider/zeebe/BusinessRuleImplementationProps.bpmn index 549438fef..3fd98359b 100644 --- a/test/spec/provider/zeebe/BusinessRuleImplementationProps.bpmn +++ b/test/spec/provider/zeebe/BusinessRuleImplementationProps.bpmn @@ -10,6 +10,9 @@ + + + diff --git a/test/spec/provider/zeebe/BusinessRuleImplementationProps.spec.js b/test/spec/provider/zeebe/BusinessRuleImplementationProps.spec.js index 74f4c9a3d..7434488ad 100644 --- a/test/spec/provider/zeebe/BusinessRuleImplementationProps.spec.js +++ b/test/spec/provider/zeebe/BusinessRuleImplementationProps.spec.js @@ -28,6 +28,8 @@ import ModelingModule from 'bpmn-js/lib/features/modeling'; import SelectionModule from 'diagram-js/lib/features/selection'; import ZeebePropertiesProvider from 'src/provider/zeebe'; +import BehaviorsModule from 'camunda-bpmn-js-behaviors/lib/camunda-cloud'; + import zeebeModdleExtensions from 'zeebe-bpmn-moddle/resources/zeebe'; import diagramXML from './BusinessRuleImplementationProps.bpmn'; @@ -40,7 +42,8 @@ describe('provider/zeebe - TargetProps', function() { CoreModule, ModelingModule, SelectionModule, - ZeebePropertiesProvider + ZeebePropertiesProvider, + BehaviorsModule ]; const moddleExtensions = { @@ -219,7 +222,7 @@ describe('provider/zeebe - TargetProps', function() { const implementation = getImplementationSelect(container); // assume - expect(getExtensionElementsList(businessObject)).to.have.length(1); + expect(getExtensionElementsList(businessObject)).to.have.length(2); // when changeInput(implementation, 'dmn'); @@ -287,6 +290,56 @@ describe('provider/zeebe - TargetProps', function() { }); + + describe('integration', function() { + + it('should remove task definition and task headers when adding called decision', inject(async function(elementRegistry, selection) { + + // given + const businessRuleTask = elementRegistry.get('BusinessRuleTask_3'); + + await act(() => selection.select(businessRuleTask)); + + // assume + expect(getTaskDefinition(businessRuleTask)).to.exist; + expect(getTaskHeaders(businessRuleTask)).to.exist; + + // when + const implementationSelect = getImplementationSelect(container); + + changeInput(implementationSelect, 'dmn'); + + // then + expect(getTaskDefinition(businessRuleTask)).not.to.exist; + expect(getTaskHeaders(businessRuleTask)).not.to.exist; + + expect(getCalledDecision(businessRuleTask)).to.exist; + })); + + + it('should remove called decision when adding task definition', inject(async function(elementRegistry, selection) { + + // given + const businessRuleTask = elementRegistry.get('BusinessRuleTask_2'); + + await act(() => selection.select(businessRuleTask)); + + // assume + expect(getCalledDecision(businessRuleTask)).to.exist; + + // when + const implementationSelect = getImplementationSelect(container); + + changeInput(implementationSelect, 'jobWorker'); + + // then + expect(getCalledDecision(businessRuleTask)).not.to.exist; + + expect(getTaskDefinition(businessRuleTask)).to.exist; + })); + + }); + }); }); @@ -309,3 +362,9 @@ function getCalledDecision(element) { return getExtensionElementsList(businessObject, 'zeebe:CalledDecision')[0]; } + +function getTaskHeaders(element) { + const businessObject = getBusinessObject(element); + + return getExtensionElementsList(businessObject, 'zeebe:TaskHeaders')[ 0 ]; +} diff --git a/test/spec/provider/zeebe/OutputPropagationProps.bpmn b/test/spec/provider/zeebe/OutputPropagationProps.bpmn index 5ca0a5a32..31d85d3d6 100644 --- a/test/spec/provider/zeebe/OutputPropagationProps.bpmn +++ b/test/spec/provider/zeebe/OutputPropagationProps.bpmn @@ -1,5 +1,5 @@ - + @@ -28,6 +28,14 @@ + + + + + + + + @@ -53,6 +61,10 @@ + + + + diff --git a/test/spec/provider/zeebe/OutputPropagationProps.spec.js b/test/spec/provider/zeebe/OutputPropagationProps.spec.js index 60cdaf716..f6c8a8d90 100644 --- a/test/spec/provider/zeebe/OutputPropagationProps.spec.js +++ b/test/spec/provider/zeebe/OutputPropagationProps.spec.js @@ -19,6 +19,11 @@ import { getPropagateAllChildVariables } from 'src/provider/zeebe/utils/CalledElementUtil.js'; +import { + getIoMapping, + getOutputParameters +} from 'src/provider/zeebe/utils/InputOutputUtil.js'; + import { getExtensionElementsList } from 'src/utils/ExtensionElementsUtil.js'; @@ -33,6 +38,8 @@ import ModelingModule from 'bpmn-js/lib/features/modeling'; import SelectionModule from 'diagram-js/lib/features/selection'; import ZeebePropertiesProvider from 'src/provider/zeebe'; +import BehaviorsModule from 'camunda-bpmn-js-behaviors/lib/camunda-cloud'; + import zeebeModdleExtensions from 'zeebe-bpmn-moddle/resources/zeebe'; import diagramXML from './OutputPropagationProps.bpmn'; @@ -45,7 +52,8 @@ describe('provider/zeebe - OutputPropagationProps', function() { CoreModule, ModelingModule, SelectionModule, - ZeebePropertiesProvider + ZeebePropertiesProvider, + BehaviorsModule ]; const moddleExtensions = { @@ -314,6 +322,311 @@ describe('provider/zeebe - OutputPropagationProps', function() { expect(getCalledElement(callActivity)).to.exist; })); + + describe('integration', function() { + + describe('remove zeebe:outputParameters', function() { + + describe('when toggling on with zeebe:outputParameters and zeebe:inputParameters', function() { + + let callActivity; + + + describe('zeebe:propagateAllChildVariables explicitly set', function() { + + beforeEach(inject(async function(elementRegistry, selection) { + + // given + callActivity = elementRegistry.get('CallActivity_6'); + + // when + await act(() => { + selection.select(callActivity); + }); + + const slider = domQuery('.bio-properties-panel-toggle-switch__slider', container); + + clickInput(slider); + })); + + + it('should execute', function() { + + // then + const outputParameters = getOutputParameters(callActivity); + + expect(outputParameters).to.have.length(0); + }); + + + it('should undo', inject(function(commandStack) { + + // when + commandStack.undo(); + + // then + const outputParameters = getOutputParameters(callActivity); + + expect(outputParameters).to.exist; + expect(outputParameters).to.have.length(1); + })); + + + it('should undo/redo', inject(function(commandStack) { + + // when + commandStack.undo(); + commandStack.redo(); + + // then + const outputParameters = getOutputParameters(callActivity); + + expect(outputParameters).to.have.length(0); + })); + + }); + + + describe('zeebe:propagateAllChildVariables not explicitly set (legacy bpmn:CallActivity)', function() { + + beforeEach(inject(async function(selection, elementRegistry) { + + // given + callActivity = elementRegistry.get('CallActivity_4'); + + // when + await act(() => { + selection.select(callActivity); + }); + + const slider = domQuery('.bio-properties-panel-toggle-switch__slider', container); + + clickInput(slider); + })); + + + it('should execute', function() { + + // then + const outputParameters = getOutputParameters(callActivity); + + expect(outputParameters).to.have.length(0); + }); + + + it('should undo', inject(function(commandStack) { + + // when + commandStack.undo(); + + // then + const outputParameters = getOutputParameters(callActivity); + + expect(outputParameters).to.exist; + expect(outputParameters).to.have.length(1); + })); + + + it('should undo/redo', inject(function(commandStack) { + + // when + commandStack.undo(); + commandStack.redo(); + + // then + const outputParameters = getOutputParameters(callActivity); + + expect(outputParameters).to.have.length(0); + })); + + }); + + }); + + }); + + + describe('remove zeebe:IoMapping', function() { + + describe('when toggling on with outputParameters', function() { + + let shape; + + describe(' explicitly set', function() { + + beforeEach(inject(async function(selection, elementRegistry) { + + // given + shape = elementRegistry.get('CallActivity_6'); + + // when + await act(() => { + selection.select(shape); + }); + + const slider = domQuery('.bio-properties-panel-toggle-switch__slider', container); + + clickInput(slider); + })); + + + it('should execute', function() { + + // then + const inputOutput = getIoMapping(shape); + expect(inputOutput).not.to.exist; + }); + + + it('should undo', inject(function(commandStack) { + + // when + commandStack.undo(); + + // then + const outputParameters = getOutputParameters(shape); + expect(outputParameters).to.exist; + expect(outputParameters.length).to.equal(1); + + const inputOutput = getIoMapping(shape); + expect(inputOutput).to.exist; + })); + + + it('should undo/redo', inject(function(commandStack) { + + // when + commandStack.undo(); + commandStack.redo(); + + // then + const inputOutput = getIoMapping(shape); + expect(inputOutput).not.to.exist; + })); + + }); + + + describe(' not explicitly set (legacy callActivity)', function() { + + beforeEach(inject(async function(selection, elementRegistry) { + + // given + shape = elementRegistry.get('CallActivity_4'); + + // when + await act(() => { + selection.select(shape); + }); + + const slider = domQuery('.bio-properties-panel-toggle-switch__slider', container); + + clickInput(slider); + })); + + + it('should execute', function() { + + // then + const inputOutput = getIoMapping(shape); + expect(inputOutput).not.to.exist; + }); + + + it('should undo', inject(function(commandStack) { + + // when + commandStack.undo(); + + // then + const outputParameters = getOutputParameters(shape); + expect(outputParameters).to.exist; + expect(outputParameters.length).to.equal(1); + + const inputOutput = getIoMapping(shape); + expect(inputOutput).to.exist; + })); + + + it('should undo/redo', inject(function(commandStack) { + + // when + commandStack.undo(); + commandStack.redo(); + + // then + const inputOutput = getIoMapping(shape); + expect(inputOutput).not.to.exist; + })); + + }); + + }); + + }); + + + describe('set zeebe:propagateAllChildVariables to false', function() { + + describe('when adding output parameters', function() { + + let shape, calledElement; + + beforeEach(inject(async function(selection, elementRegistry) { + + // given + shape = elementRegistry.get('CallActivity_2'); + calledElement = getCalledElement(shape); + + // assume + const inputOutput = getIoMapping(shape); + + expect(inputOutput).not.to.exist; + + // when + await act(() => { + selection.select(shape); + }); + + const slider = domQuery('.bio-properties-panel-toggle-switch__slider', container); + + clickInput(slider); + })); + + + it('should execute', function() { + + // then + expect(calledElement.get('propagateAllChildVariables')).to.equal(false); + }); + + + it('should undo', inject(function(commandStack) { + + // when + commandStack.undo(); + + // assume + expect(calledElement.propagateAllChildVariables).to.equal(true); + })); + + + it('should undo/redo', inject(function(commandStack) { + + // when + commandStack.undo(); + commandStack.redo(); + + // then + expect(calledElement.propagateAllChildVariables).to.equal(false); + })); + + }); + + }); + + }); + }); });