feat(modeling): layout connection once per detachment

This commit is contained in:
Maciej Barelkowski 2019-06-04 14:55:33 +02:00 committed by Nico Rehwaldt
parent 4d6c8586e4
commit c1052383da
2 changed files with 24 additions and 1 deletions

View File

@ -51,7 +51,7 @@ export default function DetachEventBehavior(eventBus, bpmnReplace) {
}; };
} }
newShape = bpmnReplace.replaceElement(shape, intermediateEvent); newShape = bpmnReplace.replaceElement(shape, intermediateEvent, { layoutConnection: false });
context.shapes = [ newShape ]; context.shapes = [ newShape ];
} }

View File

@ -1,3 +1,5 @@
/* global sinon */
import { import {
bootstrapModeler, bootstrapModeler,
inject inject
@ -143,6 +145,27 @@ describe('features/modeling/behavior - detach events', function() {
expect(intermediateEvent.outgoing).to.have.lengthOf(1); expect(intermediateEvent.outgoing).to.have.lengthOf(1);
expect(task.incoming).to.have.lengthOf(1); expect(task.incoming).to.have.lengthOf(1);
})); }));
it('should lay out connection once',
inject(function(eventBus, canvas, elementRegistry, modeling) {
// given
var layoutSpy = sinon.spy(),
event = elementRegistry.get(eventId),
root = canvas.getRootElement();
eventBus.on('commandStack.connection.layout.execute', layoutSpy);
var elements = [ event ];
// when
modeling.moveElements(elements, { x: 0, y: 100 }, root);
// then
expect(layoutSpy).to.be.calledOnce;
})
);
}); });