chore(project): migrate to new attach related Modeling APIs

Related to bpmn-io/diagram-js#242

BREAKING CHANGE:

* as documented in bpmn-io/diagram-js#242 a few modeling APIs changed;
  users of these APIs must adapt accordingly.
This commit is contained in:
Nico Rehwaldt 2017-12-20 10:36:07 +01:00
parent 22d2b97bbe
commit 11354e951c
4 changed files with 13 additions and 6 deletions

View File

@ -29,7 +29,7 @@ describe('features/modeling/behavior - create boundary events', function() {
modeling.createShape(task, { x: 100, y: 100 }, rootElement);
// when
var newEvent = modeling.createShape(intermediateEvent, { x: 50 + 15, y: 100 }, task, true);
var newEvent = modeling.createShape(intermediateEvent, { x: 50 + 15, y: 100 }, task, { attach: true });
// then
expect(newEvent.type).to.equal('bpmn:BoundaryEvent');

View File

@ -14,6 +14,8 @@ var is = require('../../../../../lib/util/ModelUtil').is,
var domQuery = require('min-dom/lib/query');
var ATTACH = { attach: true };
describe('features/modeling - move start event behavior', function() {
@ -335,7 +337,7 @@ describe('features/modeling - move start event behavior', function() {
eventDefinitionType: 'bpmn:CancelEventDefinition'
});
modeling.moveElements([ newBoundaryEvent ], { x: 500, y: 0 }, subProcess, true);
modeling.moveElements([ newBoundaryEvent ], { x: 500, y: 0 }, subProcess, ATTACH);
var movedBoundaryEvent = elementRegistry.filter(function(element) {
return (element.type === 'bpmn:BoundaryEvent' && element.id !== 'BoundaryEvent_2');
@ -367,7 +369,7 @@ describe('features/modeling - move start event behavior', function() {
eventDefinitionType: 'bpmn:CancelEventDefinition'
});
modeling.moveElements([ newBoundaryEvent ], { x: 500, y: 0 }, subProcess, true);
modeling.moveElements([ newBoundaryEvent ], { x: 500, y: 0 }, subProcess, ATTACH);
commandStack.undo();

View File

@ -15,7 +15,10 @@ var modelingModule = require('../../../../lib/features/modeling'),
describe('features/modeling - ordering', function() {
var testModules = [ coreModule, modelingModule ];
var testModules = [
coreModule,
modelingModule
];
describe('boundary events', function() {

View File

@ -51,7 +51,9 @@ function move(elementIds, delta, targetId, isAttach) {
target = targetId && getElement(targetId);
}
return modeling.moveElements(elements, delta, target, isAttach);
var hints = isAttach ? { attach: true } : {};
return modeling.moveElements(elements, delta, target, hints);
});
}
@ -78,7 +80,7 @@ function add(attrs, position, target, isAttach) {
target = getElement(target);
}
return modeling.createShape(attrs, position, target, isAttach);
return modeling.createShape(attrs, position, target, { attach: isAttach });
});
}