chore(modeling/BpmnUpdater): remove now unnecessary crop on reconnect

As of diagram-js@3.2.0 layouting will be triggered
on reconnectStart / reconnectEnd.

Related to #940
This commit is contained in:
Maciej Barelkowski 2019-04-09 14:06:49 +02:00 committed by merge-me[bot]
parent bc586d0d52
commit 6f7925080c
3 changed files with 35 additions and 5 deletions

View File

@ -54,9 +54,7 @@ export default function BpmnUpdater(
this.executed([ this.executed([
'connection.layout', 'connection.layout',
'connection.create', 'connection.create'
'connection.reconnectEnd',
'connection.reconnectStart'
], cropConnection); ], cropConnection);
this.reverted([ 'connection.layout' ], function(e) { this.reverted([ 'connection.layout' ], function(e) {

View File

@ -6,6 +6,8 @@ import {
import modelingModule from 'lib/features/modeling'; import modelingModule from 'lib/features/modeling';
import coreModule from 'lib/core'; import coreModule from 'lib/core';
/* global sinon */
var testModules = [ modelingModule, coreModule ]; var testModules = [ modelingModule, coreModule ];
@ -89,6 +91,36 @@ describe('features - bpmn-updater', function() {
}); });
describe('connection cropping', function() {
var diagramXML = require('./BpmnUpdater.bpmn');
beforeEach(bootstrapModeler(diagramXML, {
modules: testModules
}));
afterEach(sinon.restore);
it('should crop connection only once per reconnect', inject(
function(modeling, elementRegistry, connectionDocking) {
// given
var sequenceFlow = elementRegistry.get('SequenceFlow_1'),
target = elementRegistry.get('EndEvent_2'),
cropSpy = sinon.spy(connectionDocking, 'getCroppedWaypoints');
// when
modeling.reconnectEnd(sequenceFlow, target, { x: 418, y: 260 });
// then
expect(cropSpy).to.have.been.calledOnce;
expect(cropSpy).to.have.been.calledWith(sequenceFlow);
}
));
});
describe('incomplete DI', function() { describe('incomplete DI', function() {
var diagramXML = require('./BpmnUpdater.incompleteDi.bpmn'); var diagramXML = require('./BpmnUpdater.incompleteDi.bpmn');

View File

@ -255,8 +255,8 @@ describe('modeling - label layouting', function() {
modeling.reconnectEnd(connection, shape, { x: 294, y: 270 }); modeling.reconnectEnd(connection, shape, { x: 294, y: 270 });
// then // then
expect(Math.round(connection.label.x)).to.be.within(257, 260); expect(Math.round(connection.label.x)).to.be.within(224, 228);
expect(Math.round(connection.label.y)).to.be.within(185, 186); expect(Math.round(connection.label.y)).to.be.within(93, 97);
})); }));