fix(bpmn-replace): add CallActivity to SubProcessStartEvent behaviour

Closes #1631
This commit is contained in:
Beatriz Mendes 2022-04-21 16:27:15 +02:00 committed by fake-join[bot]
parent 01c8aa6f0e
commit e07ab829ee
3 changed files with 55 additions and 1 deletions

View File

@ -20,7 +20,7 @@ export default function SubProcessStartEventBehavior(injector, modeling) {
if ( if (
!is(newShape, 'bpmn:SubProcess') || !is(newShape, 'bpmn:SubProcess') ||
!is(oldShape, 'bpmn:Task') || ! (is(oldShape, 'bpmn:Task') || is(oldShape, 'bpmn:CallActivity')) ||
!isExpanded(newShape) !isExpanded(newShape)
) { ) {
return; return;

View File

@ -2,6 +2,7 @@
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="Definitions_007va6i" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.2.0-dev"> <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" id="Definitions_007va6i" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.2.0-dev">
<bpmn:process id="Process_1giw3j5" isExecutable="true"> <bpmn:process id="Process_1giw3j5" isExecutable="true">
<bpmn:task id="Task_1" /> <bpmn:task id="Task_1" />
<bpmn:callActivity id="CallActivity_1" />
<bpmn:subProcess id="SubProcess_1" /> <bpmn:subProcess id="SubProcess_1" />
</bpmn:process> </bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1"> <bpmndi:BPMNDiagram id="BPMNDiagram_1">
@ -9,6 +10,9 @@
<bpmndi:BPMNShape id="Task_07xra8r_di" bpmnElement="Task_1"> <bpmndi:BPMNShape id="Task_07xra8r_di" bpmnElement="Task_1">
<dc:Bounds x="156" y="81" width="100" height="80" /> <dc:Bounds x="156" y="81" width="100" height="80" />
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1o55kco_di" bpmnElement="CallActivity_1" isExpanded="true">
<dc:Bounds x="285" y="81" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="SubProcess_01nq2r1_di" bpmnElement="SubProcess_1" isExpanded="true"> <bpmndi:BPMNShape id="SubProcess_01nq2r1_di" bpmnElement="SubProcess_1" isExpanded="true">
<dc:Bounds x="160" y="280" width="350" height="200" /> <dc:Bounds x="160" y="280" width="350" height="200" />
</bpmndi:BPMNShape> </bpmndi:BPMNShape>

View File

@ -99,6 +99,56 @@ describe('features/modeling/behavior - subprocess start event', function() {
}); });
describe('call activity -> expanded subprocess', function() {
it('should add start event child to subprocess', inject(
function(elementRegistry, bpmnReplace) {
// given
var callActivity = elementRegistry.get('CallActivity_1'),
expandedSubProcess,
startEvents;
// when
expandedSubProcess = bpmnReplace.replaceElement(callActivity, {
type: 'bpmn:SubProcess',
isExpanded: true
});
// then
startEvents = getChildStartEvents(expandedSubProcess);
expect(startEvents).to.have.length(1);
}
));
it('should wire startEvent di correctly', inject(
function(elementRegistry, bpmnReplace) {
// given
var callActivity = elementRegistry.get('CallActivity_1'),
expandedSubProcess,
startEvent,
startEventDi;
// when
expandedSubProcess = bpmnReplace.replaceElement(callActivity, {
type: 'bpmn:SubProcess',
isExpanded: true
});
// then
startEvent = getChildStartEvents(expandedSubProcess)[0];
startEventDi = getDi(startEvent);
expect(startEventDi.$parent).to.exist;
}
));
});
}); });
}); });