fix(ordering): correctly treat transactions / ad-hoc sub-processes
This commit is contained in:
parent
4732dcfc74
commit
13be55dca1
|
@ -53,7 +53,7 @@ function BpmnOrderingProvider(eventBus, translate) {
|
||||||
|
|
||||||
function computeOrder(element) {
|
function computeOrder(element) {
|
||||||
var entry = find(orders, function(o) {
|
var entry = find(orders, function(o) {
|
||||||
return element.type === o.type;
|
return isAny(element, [ o.type ]);
|
||||||
});
|
});
|
||||||
|
|
||||||
return entry && entry.order || { level: 1 };
|
return entry && entry.order || { level: 1 };
|
||||||
|
|
|
@ -98,10 +98,10 @@ describe('features/modeling - ordering', function() {
|
||||||
it('should stay behind boundary events', inject(function() {
|
it('should stay behind boundary events', inject(function() {
|
||||||
|
|
||||||
// when
|
// when
|
||||||
move('BoundaryEvent_1', { x: 50, y: 0 }, 'SubProcess_1', true);
|
move('BoundaryEvent_SubProcess', { x: 50, y: 0 }, 'SubProcess_1', true);
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expectZOrder('SubProcess_1', 'BoundaryEvent_1');
|
expectZOrder('SubProcess_1', 'BoundaryEvent_SubProcess');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
@ -126,4 +126,43 @@ describe('features/modeling - ordering', function() {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
describe('transaction', function() {
|
||||||
|
|
||||||
|
var diagramXML = require('./ordering-subprocesses.bpmn');
|
||||||
|
|
||||||
|
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||||
|
|
||||||
|
|
||||||
|
it('should stay behind boundary events', inject(function() {
|
||||||
|
|
||||||
|
// when
|
||||||
|
move('BoundaryEvent_Transaction', { x: 50, y: 0 }, 'Transaction_1', true);
|
||||||
|
|
||||||
|
// then
|
||||||
|
expectZOrder('Transaction_1', 'BoundaryEvent_Transaction');
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
it('should stay behind tasks', inject(function() {
|
||||||
|
|
||||||
|
// when
|
||||||
|
move(['Task_1', 'Task_2'], { x: 50, y: 0 }, 'Transaction_1');
|
||||||
|
|
||||||
|
// then
|
||||||
|
expectZOrder('Transaction_1', 'Task_1', 'Task_2');
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
it('should be in front of tasks if task is not a child', inject(function() {
|
||||||
|
|
||||||
|
// when
|
||||||
|
move(['Task_1', 'Task_2'], { x: 200, y: 0 }, 'Root');
|
||||||
|
|
||||||
|
// then
|
||||||
|
expectZOrder('Task_1', 'Task_2', 'Transaction_1');
|
||||||
|
}));
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn">
|
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn">
|
||||||
<bpmn:process id="Process_1" isExecutable="false">
|
<bpmn:process id="Process_1" isExecutable="false">
|
||||||
|
@ -5,14 +6,16 @@
|
||||||
<bpmn:task id="Task_1" />
|
<bpmn:task id="Task_1" />
|
||||||
<bpmn:task id="Task_2" />
|
<bpmn:task id="Task_2" />
|
||||||
</bpmn:subProcess>
|
</bpmn:subProcess>
|
||||||
<bpmn:boundaryEvent id="BoundaryEvent_1" attachedToRef="SubProcess_1" />
|
<bpmn:boundaryEvent id="BoundaryEvent_SubProcess" attachedToRef="SubProcess_1" />
|
||||||
|
<bpmn:transaction id="Transaction_1" />
|
||||||
|
<bpmn:boundaryEvent id="BoundaryEvent_Transaction" attachedToRef="Transaction_1" />
|
||||||
</bpmn:process>
|
</bpmn:process>
|
||||||
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
||||||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
|
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
|
||||||
<bpmndi:BPMNShape id="SubProcess_1_di" bpmnElement="SubProcess_1" isExpanded="true">
|
<bpmndi:BPMNShape id="SubProcess_1_di" bpmnElement="SubProcess_1" isExpanded="true">
|
||||||
<dc:Bounds x="100" y="44" width="350" height="200" />
|
<dc:Bounds x="100" y="44" width="350" height="200" />
|
||||||
</bpmndi:BPMNShape>
|
</bpmndi:BPMNShape>
|
||||||
<bpmndi:BPMNShape id="BoundaryEvent_1_di" bpmnElement="BoundaryEvent_1">
|
<bpmndi:BPMNShape id="BoundaryEvent_SubProcess_di" bpmnElement="BoundaryEvent_SubProcess">
|
||||||
<dc:Bounds x="157" y="226" width="36" height="36" />
|
<dc:Bounds x="157" y="226" width="36" height="36" />
|
||||||
<bpmndi:BPMNLabel>
|
<bpmndi:BPMNLabel>
|
||||||
<dc:Bounds x="130" y="262" width="90" height="20" />
|
<dc:Bounds x="130" y="262" width="90" height="20" />
|
||||||
|
@ -24,6 +27,15 @@
|
||||||
<bpmndi:BPMNShape id="Task_2_di" bpmnElement="Task_2">
|
<bpmndi:BPMNShape id="Task_2_di" bpmnElement="Task_2">
|
||||||
<dc:Bounds x="305" y="68" width="100" height="80" />
|
<dc:Bounds x="305" y="68" width="100" height="80" />
|
||||||
</bpmndi:BPMNShape>
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="Transaction_1_di" bpmnElement="Transaction_1" isExpanded="true">
|
||||||
|
<dc:Bounds x="100" y="302" width="350" height="200" />
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="BoundaryEvent_Transaction_di" bpmnElement="BoundaryEvent_Transaction">
|
||||||
|
<dc:Bounds x="249" y="484" width="36" height="36" />
|
||||||
|
<bpmndi:BPMNLabel>
|
||||||
|
<dc:Bounds x="222" y="520" width="90" height="20" />
|
||||||
|
</bpmndi:BPMNLabel>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
</bpmndi:BPMNPlane>
|
</bpmndi:BPMNPlane>
|
||||||
</bpmndi:BPMNDiagram>
|
</bpmndi:BPMNDiagram>
|
||||||
</bpmn:definitions>
|
</bpmn:definitions>
|
||||||
|
|
Loading…
Reference in New Issue