fix(replace): properly set parent of event definitions
Related to bpmn-io/bpmn-js-properties-panel#82
This commit is contained in:
parent
a0d4b7807c
commit
acb3716716
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}));
|
||||
});
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue