Skip to content

Commit

Permalink
fix(modeling/behavior): hook UpdateFlowNodeRefs behavior in on elemen…
Browse files Browse the repository at this point in the history
…ts.create
  • Loading branch information
nikku authored and fake-join[bot] committed Dec 6, 2019
1 parent d769e6d commit 4455c3f
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/features/modeling/behavior/UpdateFlowNodeRefsBehavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ export default function UpdateFlowNodeRefsBehavior(eventBus, modeling, translate
'lane.add',
'lane.resize',
'lane.split',
'elements.move',
'elements.create',
'elements.delete',
'elements.move',
'shape.create',
'shape.delete',
'shape.move',
Expand Down
43 changes: 40 additions & 3 deletions test/spec/features/modeling/lanes/UpdateFlowNodeRefsSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,22 @@ import {

import modelingModule from 'lib/features/modeling';
import coreModule from 'lib/core';
import copyPasteModule from 'lib/features/copy-paste';

/* global sinon */


describe('features/modeling - lanes - flowNodeRefs', function() {

var diagramXML = require('./flowNodeRefs.bpmn');

var testModules = [ coreModule, modelingModule ];

beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
beforeEach(bootstrapModeler(diagramXML, {
modules: [
coreModule,
modelingModule,
copyPasteModule
]
}));


describe('should unwire during move', function() {
Expand Down Expand Up @@ -290,4 +297,34 @@ describe('features/modeling - lanes - flowNodeRefs', function() {
expect(lane1.flowNodeRef).to.have.length(1);
expect(lane2.flowNodeRef).to.have.length(2);
}));


describe('should wire once during paste', function() {

it('execute', inject(function(canvas, eventBus, elementRegistry, copyPaste) {

// given
var participant = elementRegistry.get('Participant_A');

var updateRefsSpy = sinon.spy();

eventBus.on('commandStack.lane.updateRefs.execute', updateRefsSpy);

// when
copyPaste.copy(participant);

copyPaste.paste({
element: canvas.getRootElement(),
point: {
x: 350,
y: 150
}
});

// then
expect(updateRefsSpy).to.have.been.calledOnce;
}));

});

});

0 comments on commit 4455c3f

Please sign in to comment.