fix(replace): properly set parent of event definitions

Related to bpmn-io/bpmn-js-properties-panel#82
This commit is contained in:
pedesen 2015-11-19 13:28:39 +01:00
parent a0d4b7807c
commit acb3716716
2 changed files with 23 additions and 0 deletions

View File

@ -76,6 +76,7 @@ function BpmnReplace(bpmnFactory, moddle, popupMenu, replace, selection, modelin
var eventDefinitions = businessObject.get('eventDefinitions'),
eventDefinition = moddle.create(target.eventDefinition);
eventDefinition.$parent = businessObject;
eventDefinitions.push(eventDefinition);
}

View File

@ -1374,4 +1374,26 @@ describe('features/replace', function() {
});
describe('events', function() {
var diagramXML = require('../../../fixtures/bpmn/basic.bpmn');
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
it('should properly set parent of event definitions', inject(function(elementRegistry, modeling, bpmnReplace) {
var startEvent = elementRegistry.get('StartEvent_1');
var messageEvent = bpmnReplace.replaceElement(startEvent, {
type: 'bpmn:StartEvent',
eventDefinition: 'bpmn:MessageEventDefinition'
});
var parent = messageEvent.businessObject.eventDefinitions[0].$parent;
expect(parent).to.exist;
expect(parent).to.equal(messageEvent.businessObject);
}));
});
});