fix(grid-snapping): do not update waypoints on multiple create
Related to https://github.com/camunda/camunda-modeler/issues/1617
This commit is contained in:
parent
b2b607f558
commit
d769e6ddb0
|
@ -30,7 +30,7 @@ export default function LayoutConnectionBehavior(eventBus, gridSnapping, modelin
|
|||
hints = context.hints || {},
|
||||
waypoints = connection.waypoints;
|
||||
|
||||
if (hints.connectionStart || hints.connectionEnd) {
|
||||
if (hints.connectionStart || hints.connectionEnd || hints.createElementsBehavior === false) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,10 +7,15 @@ import coreModule from 'lib/core';
|
|||
import gridSnappingModule from 'lib/features/grid-snapping';
|
||||
import modelingModule from 'lib/features/modeling';
|
||||
import moveModule from 'diagram-js/lib/features/move';
|
||||
import copyPasteModule from 'lib/features/copy-paste';
|
||||
|
||||
/* global sinon */
|
||||
|
||||
|
||||
describe('features/grid-snapping - layout connection', function() {
|
||||
|
||||
describe('on connection create', function() {
|
||||
|
||||
var diagramXML = require('./LayoutConnectionBehavior.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, {
|
||||
|
@ -23,8 +28,6 @@ describe('features/grid-snapping - layout connection', function() {
|
|||
}));
|
||||
|
||||
|
||||
describe('on connection create', function() {
|
||||
|
||||
it('should snap 3 segment connection (1 middle segment)', inject(
|
||||
function(elementRegistry, modeling) {
|
||||
|
||||
|
@ -64,6 +67,17 @@ describe('features/grid-snapping - layout connection', function() {
|
|||
|
||||
describe('on connection layout', function() {
|
||||
|
||||
var diagramXML = require('./LayoutConnectionBehavior.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, {
|
||||
modules: [
|
||||
coreModule,
|
||||
gridSnappingModule,
|
||||
modelingModule,
|
||||
moveModule
|
||||
]
|
||||
}));
|
||||
|
||||
var task1, task2, connection;
|
||||
|
||||
beforeEach(inject(function(elementRegistry, modeling) {
|
||||
|
@ -129,4 +143,50 @@ describe('features/grid-snapping - layout connection', function() {
|
|||
|
||||
});
|
||||
|
||||
|
||||
describe('on paste multiple', function() {
|
||||
|
||||
var diagramXML = require('./LayoutConnectionBehavior.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, {
|
||||
modules: [
|
||||
coreModule,
|
||||
gridSnappingModule,
|
||||
modelingModule,
|
||||
moveModule,
|
||||
copyPasteModule
|
||||
]
|
||||
}));
|
||||
|
||||
|
||||
it('should not update waypoints', inject(
|
||||
function(canvas, eventBus, copyPaste, elementRegistry) {
|
||||
|
||||
// given
|
||||
var layoutSpy = sinon.spy();
|
||||
|
||||
copyPaste.copy([
|
||||
elementRegistry.get('Task_2'),
|
||||
elementRegistry.get('SequenceFlow_1'),
|
||||
elementRegistry.get('Task_5')
|
||||
]);
|
||||
|
||||
eventBus.on('commandStack.connection.updateWaypoints.execute', layoutSpy);
|
||||
|
||||
// when
|
||||
copyPaste.paste({
|
||||
element: canvas.getRootElement(),
|
||||
point: {
|
||||
x: 100,
|
||||
y: 200
|
||||
}
|
||||
});
|
||||
|
||||
// then
|
||||
expect(layoutSpy).not.to.have.been.called;
|
||||
}
|
||||
));
|
||||
|
||||
});
|
||||
|
||||
});
|
Loading…
Reference in New Issue