fix(rules): allow to create attachments

Related to https://github.com/camunda/camunda-modeler/issues/1462
This commit is contained in:
Maciej Barelkowski 2019-08-12 16:21:49 +02:00 committed by merge-me[bot]
parent 2776cd8958
commit 6ed51fc036
2 changed files with 34 additions and 0 deletions

View File

@ -128,6 +128,10 @@ BpmnRules.prototype.init = function() {
return canConnect(element.source, element.target, element);
}
if (element.host) {
return canAttach(element, element.host, null, position);
}
return canCreate(element, target, null, position);
});
});

View File

@ -81,6 +81,36 @@ describe('features/modeling/rules - BpmnRules', function() {
expectCanCreate([ task1, task2, sequenceFlow ], 'Process', false);
}));
it('create task and non-interrupting boundary event', inject(function(elementFactory) {
// given
var task = elementFactory.createShape({ type: 'bpmn:Task' }),
boundaryEvent = elementFactory.createShape({
type: 'bpmn:BoundaryEvent',
eventDefinitionType: 'bpmn:EscalationEventDefinition',
cancelActivity: false,
host: task
});
// then
expectCanCreate([ task, boundaryEvent ], 'Process', true);
}));
it('create task and interrupting boundary event', inject(function(elementFactory) {
// given
var task = elementFactory.createShape({ type: 'bpmn:Task' }),
boundaryEvent = elementFactory.createShape({
type: 'bpmn:BoundaryEvent',
eventDefinitionType: 'bpmn:EscalationEventDefinition',
host: task
});
// then
expectCanCreate([ task, boundaryEvent ], 'Process', true);
}));
});