From e41442b393f6acad8a38d1d812967e956c9ea47c Mon Sep 17 00:00:00 2001 From: Martin Stamm Date: Mon, 14 Feb 2022 11:58:15 +0100 Subject: [PATCH 1/2] fix(ordering): allow groups and associations in subprocesses related to https://github.com/camunda/camunda-modeler/issues/2751, https://github.com/camunda/camunda-modeler/issues/2752 --- lib/features/ordering/BpmnOrderingProvider.js | 4 +- .../ordering/BpmnOrderingProviderSpec.js | 89 +++++++++++++++++++ .../ordering/collapsed-subprocess.bpmn | 47 ++++++++++ .../features/ordering/data-association.bpmn | 57 ++++++++++++ 4 files changed, 195 insertions(+), 2 deletions(-) create mode 100644 test/spec/features/ordering/collapsed-subprocess.bpmn create mode 100644 test/spec/features/ordering/data-association.bpmn diff --git a/lib/features/ordering/BpmnOrderingProvider.js b/lib/features/ordering/BpmnOrderingProvider.js index 9b795e9b..f7330627 100644 --- a/lib/features/ordering/BpmnOrderingProvider.js +++ b/lib/features/ordering/BpmnOrderingProvider.js @@ -42,7 +42,7 @@ export default function BpmnOrderingProvider(eventBus, canvas, translate) { level: 9, containers: [ 'bpmn:Collaboration', - 'bpmn:Process' + 'bpmn:FlowElementsContainer' ] } }, @@ -70,7 +70,7 @@ export default function BpmnOrderingProvider(eventBus, canvas, translate) { level: 10, containers: [ 'bpmn:Collaboration', - 'bpmn:Process' + 'bpmn:FlowElementsContainer' ] } }, diff --git a/test/spec/features/ordering/BpmnOrderingProviderSpec.js b/test/spec/features/ordering/BpmnOrderingProviderSpec.js index 34b885fa..c8a3745a 100644 --- a/test/spec/features/ordering/BpmnOrderingProviderSpec.js +++ b/test/spec/features/ordering/BpmnOrderingProviderSpec.js @@ -343,6 +343,48 @@ describe('features/modeling - ordering', function() { }); + + describe('inside subprocess', function() { + + var diagramXML = require('./collapsed-subprocess.bpmn'); + + beforeEach(bootstrapModeler(diagramXML, { modules: testModules })); + + + describe('should stay always in front', function() { + + it('moving onto ', inject(function() { + + // when + move('Group', { x: 100, y: 0 }, 'StartEvent', false); + + // then + expectZOrder('StartEvent', 'Group'); + })); + + + it('moving onto ', inject(function() { + + // when + move('Group', { x: 200, y: 50 }, 'Task', false); + + // then + expectZOrder('Task', 'Group'); + })); + + + it('move onto ', inject(function() { + + // when + move('Group', { x: 400, y: 0 }, 'SubProcess', false); + + // then + expectZOrder('SubProcess', 'Group'); + })); + + }); + }); + }); @@ -364,4 +406,51 @@ describe('features/modeling - ordering', function() { }); + + describe('data associations', function() { + + var diagramXML = require('./data-association.bpmn'); + + beforeEach(bootstrapModeler(diagramXML, { modules: testModules })); + + it('should render data associations infront of Collaboration', inject(function() { + + // when + var connection = connect('DataStore', 'Task_1'); + + // then + expectZOrder('Collaboration_1', 'DataStore', connection); + })); + + + describe('inside subprocesses', function() { + + it('should render data associations behind other Subprocess', inject(function() { + + // assumne + expectZOrder('SubProcess_1', 'SubProcess_2'); + + // when + var connection = connect('DataReference_1', 'Task_1'); + + // then + expectZOrder('SubProcess_1', connection, 'SubProcess_2'); + + })); + + + it('should render in collapsed subprocess plane', inject(function() { + + // when + var connection = connect('DataReference_2', 'Task_2'); + + // then + expectZOrder('collapsedSubProcess_plane', 'DataReference_2', connection); + + })); + + }); + + }); + }); diff --git a/test/spec/features/ordering/collapsed-subprocess.bpmn b/test/spec/features/ordering/collapsed-subprocess.bpmn new file mode 100644 index 00000000..3bfddff9 --- /dev/null +++ b/test/spec/features/ordering/collapsed-subprocess.bpmn @@ -0,0 +1,47 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/spec/features/ordering/data-association.bpmn b/test/spec/features/ordering/data-association.bpmn new file mode 100644 index 00000000..717530c2 --- /dev/null +++ b/test/spec/features/ordering/data-association.bpmn @@ -0,0 +1,57 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From bd419fedf9ede870496d2e2f8eb6ec365623122a Mon Sep 17 00:00:00 2001 From: Martin Stamm Date: Mon, 14 Feb 2022 13:18:49 +0100 Subject: [PATCH 2/2] test(drilldown): add integration test for group creation --- test/spec/ModelerSpec.js | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/test/spec/ModelerSpec.js b/test/spec/ModelerSpec.js index d016f9a2..a6b6a3a1 100644 --- a/test/spec/ModelerSpec.js +++ b/test/spec/ModelerSpec.js @@ -744,6 +744,31 @@ describe('Modeler', function() { return verifyDrilldown(xml); }); + + it('should allow creation of groups in collapsed subprocesses', function() { + var xml = require('../fixtures/bpmn/collapsed-sub-process.bpmn'); + + return createModeler(xml).then(function() { + + // given + var elementRegistry = modeler.get('elementRegistry'), + elementFactory = modeler.get('elementFactory'), + modeling = modeler.get('modeling'); + + var collapsedProcessPlane = elementRegistry.get('collapsedProcess_plane'), + groupElement = elementFactory.createShape({ type: 'bpmn:Group' }); + + // when + var group = modeling.createShape(groupElement, { x: 100, y: 100 }, collapsedProcessPlane); + + // then + expect(group).to.exist; + expect(group.parent).to.equal(collapsedProcessPlane); + + }); + + }); + });