fix(bpmn-replace): correctly replace sub process -> call activity

* when not morphing collapsed sub process with children
  into expanded sub process children must be removed

Related to camunda/camunda-modeler#739
This commit is contained in:
Philipp Fromme 2018-02-13 16:58:46 +01:00 committed by Nico Rehwaldt
parent efaeeddf19
commit ef52dff84c
2 changed files with 26 additions and 0 deletions

View File

@ -151,6 +151,13 @@ function BpmnReplace(bpmnFactory, replace, selection, modeling, eventBus) {
} }
} }
// remove children if not expanding sub process
if (is(oldBusinessObject, 'bpmn:SubProcess')
&& !isExpanded(oldBusinessObject)
&& !is(newBusinessObject, 'bpmn:SubProcess')) {
hints.moveChildren = false;
}
// transform collapsed/expanded pools // transform collapsed/expanded pools
if (is(oldBusinessObject, 'bpmn:Participant')) { if (is(oldBusinessObject, 'bpmn:Participant')) {

View File

@ -853,6 +853,25 @@ describe('features/replace - bpmn replace', function() {
}) })
); );
it('should remove children of collapsed sub process not morphing into expanded',
inject(function(bpmnReplace, elementRegistry, modeling) {
// given
var element = elementRegistry.get('SubProcess_1');
var newElementData = {
type: 'bpmn:CallActivity'
};
modeling.toggleCollapse(element);
// when
var newElement = bpmnReplace.replaceElement(element, newElementData);
// then
expect(is(newElement, 'bpmn:CallActivity')).to.be.true;
}));
}); });