fix(replace): make sure is respected for expanded sub processes

Closes camunda/camunda-modeler#511
This commit is contained in:
Ricardo Matias 2017-02-03 14:58:41 +01:00 committed by Philipp Fromme
parent b5c65f0b42
commit 1a4a8959fe
2 changed files with 33 additions and 1 deletions

View File

@ -143,7 +143,7 @@ function BpmnReplace(bpmnFactory, replace, selection, modeling, eventBus) {
// TODO: need also to respect min/max Size // TODO: need also to respect min/max Size
// copy size, from an expanded subprocess to an expanded alternative subprocess // copy size, from an expanded subprocess to an expanded alternative subprocess
// except bpmn:Task, because Task is always expanded // except bpmn:Task, because Task is always expanded
if ((isExpanded(oldBusinessObject) && !is(oldBusinessObject, 'bpmn:Task')) && target.isExpanded) { if ((isExpanded(oldBusinessObject) && !is(oldBusinessObject, 'bpmn:Task')) && newElement.isExpanded) {
newElement.width = element.width; newElement.width = element.width;
newElement.height = element.height; newElement.height = element.height;
} }

View File

@ -779,6 +779,38 @@ describe('features/replace - bpmn replace', function() {
}) })
); );
it('should keep size when morphing ad hoc',
inject(function(bpmnReplace, elementRegistry, modeling) {
// given
var element = elementRegistry.get('SubProcess_1');
var newElementData = {
type: 'bpmn:AdHocSubProcess'
};
var width = element.width,
height = element.height;
modeling.resizeShape(element, {
x: element.x,
y: element.y,
width: width + 20,
height: height + 20
});
// when
var newElement = bpmnReplace.replaceElement(element, newElementData);
// then
expect(is(newElement, 'bpmn:AdHocSubProcess')).to.be.true;
expect(isExpanded(newElement)).to.be.true;
expect(newElement.width).to.equal(width + 20);
expect(newElement.height).to.equal(height + 20);
})
);
}); });