feat(replace): create bpmn:LinkEventDefinition with empty name
Closes https://github.com/bpmn-io/bpmn-js/issues/1296
This commit is contained in:
parent
ee6b89db16
commit
95b50f08a7
|
@ -117,7 +117,7 @@ ElementFactory.prototype.createBpmnElement = function(elementType, attrs) {
|
|||
|
||||
if (attrs.eventDefinitionType) {
|
||||
eventDefinitions = businessObject.get('eventDefinitions') || [];
|
||||
newEventDefinition = this._bpmnFactory.create(attrs.eventDefinitionType);
|
||||
newEventDefinition = this._bpmnFactory.create(attrs.eventDefinitionType, attrs.eventDefinitionAttrs);
|
||||
|
||||
if (attrs.eventDefinitionType === 'bpmn:ConditionalEventDefinition') {
|
||||
newEventDefinition.condition = this._bpmnFactory.create('bpmn:FormalExpression');
|
||||
|
|
|
@ -173,6 +173,7 @@ export default function BpmnReplace(
|
|||
// i.e. because we copied it
|
||||
if (!hasEventDefinition(newBusinessObject, target.eventDefinitionType)) {
|
||||
newElement.eventDefinitionType = target.eventDefinitionType;
|
||||
newElement.eventDefinitionAttrs = target.eventDefinitionAttrs;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -137,7 +137,10 @@ export var INTERMEDIATE_EVENT = [
|
|||
className: 'bpmn-icon-intermediate-event-catch-link',
|
||||
target: {
|
||||
type: 'bpmn:IntermediateCatchEvent',
|
||||
eventDefinitionType: 'bpmn:LinkEventDefinition'
|
||||
eventDefinitionType: 'bpmn:LinkEventDefinition',
|
||||
eventDefinitionAttrs: {
|
||||
name: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -146,7 +149,10 @@ export var INTERMEDIATE_EVENT = [
|
|||
className: 'bpmn-icon-intermediate-event-throw-link',
|
||||
target: {
|
||||
type: 'bpmn:IntermediateThrowEvent',
|
||||
eventDefinitionType: 'bpmn:LinkEventDefinition'
|
||||
eventDefinitionType: 'bpmn:LinkEventDefinition',
|
||||
eventDefinitionAttrs: {
|
||||
name: ''
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
|
@ -73,6 +73,34 @@ describe('features - element factory', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('should create with link event definition', inject(function(elementFactory) {
|
||||
|
||||
// when
|
||||
var intermediateThrowEvent = elementFactory.createShape({
|
||||
type: 'bpmn:IntermediateThrowEvent',
|
||||
eventDefinitionType: 'bpmn:LinkEventDefinition',
|
||||
eventDefinitionAttrs: {
|
||||
name: ''
|
||||
}
|
||||
});
|
||||
|
||||
// then
|
||||
expect(intermediateThrowEvent).to.exist;
|
||||
expect(is(intermediateThrowEvent, 'bpmn:IntermediateThrowEvent')).to.be.true;
|
||||
|
||||
var intermediateThrowEventBo = getBusinessObject(intermediateThrowEvent),
|
||||
eventDefinitions = intermediateThrowEventBo.eventDefinitions;
|
||||
|
||||
expect(eventDefinitions).to.exist;
|
||||
expect(eventDefinitions).to.have.length(1);
|
||||
|
||||
var eventDefinition = eventDefinitions[ 0 ];
|
||||
|
||||
expect(is(eventDefinition, 'bpmn:LinkEventDefinition')).to.be.true;
|
||||
expect(eventDefinition.name).to.eql('');
|
||||
}));
|
||||
|
||||
|
||||
describe('integration', function() {
|
||||
|
||||
it('should create event definition with ID', inject(function(elementFactory) {
|
||||
|
|
Loading…
Reference in New Issue