From 175e395768fe2350d523462dcdef1650d3eb06e1 Mon Sep 17 00:00:00 2001 From: Philipp Fromme Date: Tue, 7 May 2019 14:00:12 +0200 Subject: [PATCH] feat(ordering): always render groups on top Closes #979 --- lib/features/ordering/BpmnOrderingProvider.js | 3 +- .../ordering/BpmnOrderingProviderSpec.js | 43 +++++++++++++++++++ test/spec/features/ordering/groups.bpmn | 31 +++++++++++++ 3 files changed, 76 insertions(+), 1 deletion(-) create mode 100644 test/spec/features/ordering/groups.bpmn diff --git a/lib/features/ordering/BpmnOrderingProvider.js b/lib/features/ordering/BpmnOrderingProvider.js index 58d1f4a5..fdee5ccb 100644 --- a/lib/features/ordering/BpmnOrderingProvider.js +++ b/lib/features/ordering/BpmnOrderingProvider.js @@ -15,7 +15,7 @@ import { /** * a simple ordering provider that makes sure: * - * (0) labels are rendered always on top + * (0) labels and groups are rendered always on top * (1) elements are ordered by a {level} property */ export default function BpmnOrderingProvider(eventBus, canvas, translate) { @@ -63,6 +63,7 @@ export default function BpmnOrderingProvider(eventBus, canvas, translate) { } }, { type: 'bpmn:BoundaryEvent', order: { level: 8 } }, + { type: 'bpmn:Group', order: { level: 10 } }, { type: 'bpmn:FlowElement', order: { level: 5 } }, { type: 'bpmn:Participant', order: { level: -2 } }, { type: 'bpmn:Lane', order: { level: -1 } } diff --git a/test/spec/features/ordering/BpmnOrderingProviderSpec.js b/test/spec/features/ordering/BpmnOrderingProviderSpec.js index 6caba6f8..0474e2fe 100644 --- a/test/spec/features/ordering/BpmnOrderingProviderSpec.js +++ b/test/spec/features/ordering/BpmnOrderingProviderSpec.js @@ -283,6 +283,49 @@ describe('features/modeling - ordering', function() { }); + describe('groups', function() { + + var diagramXML = require('./groups.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'); + })); + + }); + + }); + + describe('connections', function() { var diagramXML = require('./ordering.bpmn'); diff --git a/test/spec/features/ordering/groups.bpmn b/test/spec/features/ordering/groups.bpmn new file mode 100644 index 00000000..35f86aea --- /dev/null +++ b/test/spec/features/ordering/groups.bpmn @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +