Skip to content

Commit

Permalink
fix(rules): allow associations where data associations are allowed, too
Browse files Browse the repository at this point in the history
  • Loading branch information
nikku authored and fake-join[bot] committed Jan 2, 2020
1 parent 31b8130 commit 4a675b3
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 35 deletions.
8 changes: 7 additions & 1 deletion lib/features/rules/BpmnRules.js
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,13 @@ function canConnectAssociation(source, target) {
}

// allow connection of associations between <!TextAnnotation> and <TextAnnotation>
return isOneTextAnnotation(source, target);
if (isOneTextAnnotation(source, target)) {
return true;
}

// can connect associations where we can connect
// data associations, too (!)
return !!canConnectDataAssociation(source, target);
}

function canConnectMessageFlow(source, target) {
Expand Down
47 changes: 13 additions & 34 deletions test/spec/features/rules/BpmnRulesSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ describe('features/modeling/rules - BpmnRules', function() {
expectCanConnect('StartEvent_None', 'DataObjectReference', {
sequenceFlow: false,
messageFlow: false,
association: false,
association: true,
dataAssociation: { type: 'bpmn:DataOutputAssociation' }
});
}));
Expand All @@ -307,7 +307,7 @@ describe('features/modeling/rules - BpmnRules', function() {
expectCanConnect('DataObjectReference', 'EndEvent_None', {
sequenceFlow: false,
messageFlow: false,
association: false,
association: true,
dataAssociation: { type: 'bpmn:DataInputAssociation' }
});
}));
Expand All @@ -329,7 +329,7 @@ describe('features/modeling/rules - BpmnRules', function() {
expectCanConnect('Task', 'DataObjectReference', {
sequenceFlow: false,
messageFlow: false,
association: false,
association: true,
dataAssociation: { type: 'bpmn:DataOutputAssociation' }
});
}));
Expand All @@ -340,7 +340,7 @@ describe('features/modeling/rules - BpmnRules', function() {
expectCanConnect('DataObjectReference', 'Task', {
sequenceFlow: false,
messageFlow: false,
association: false,
association: true,
dataAssociation: { type: 'bpmn:DataInputAssociation' }
});
}));
Expand All @@ -351,7 +351,7 @@ describe('features/modeling/rules - BpmnRules', function() {
expectCanConnect('SubProcess', 'DataObjectReference', {
sequenceFlow: false,
messageFlow: false,
association: false,
association: true,
dataAssociation: { type: 'bpmn:DataOutputAssociation' }
});
}));
Expand All @@ -362,7 +362,7 @@ describe('features/modeling/rules - BpmnRules', function() {
expectCanConnect('DataObjectReference', 'SubProcess', {
sequenceFlow: false,
messageFlow: false,
association: false,
association: true,
dataAssociation: { type: 'bpmn:DataInputAssociation' }
});
}));
Expand Down Expand Up @@ -428,7 +428,7 @@ describe('features/modeling/rules - BpmnRules', function() {
expectCanConnect('StartEvent_None', 'DataStoreReference', {
sequenceFlow: false,
messageFlow: false,
association: false,
association: true,
dataAssociation: { type: 'bpmn:DataOutputAssociation' }
});
}));
Expand All @@ -439,7 +439,7 @@ describe('features/modeling/rules - BpmnRules', function() {
expectCanConnect('DataStoreReference', 'EndEvent_None', {
sequenceFlow: false,
messageFlow: false,
association: false,
association: true,
dataAssociation: { type: 'bpmn:DataInputAssociation' }
});
}));
Expand All @@ -461,7 +461,7 @@ describe('features/modeling/rules - BpmnRules', function() {
expectCanConnect('Task', 'DataStoreReference', {
sequenceFlow: false,
messageFlow: false,
association: false,
association: true,
dataAssociation: { type: 'bpmn:DataOutputAssociation' }
});
}));
Expand All @@ -472,7 +472,7 @@ describe('features/modeling/rules - BpmnRules', function() {
expectCanConnect('DataStoreReference', 'Task', {
sequenceFlow: false,
messageFlow: false,
association: false,
association: true,
dataAssociation: { type: 'bpmn:DataInputAssociation' }
});
}));
Expand All @@ -483,7 +483,7 @@ describe('features/modeling/rules - BpmnRules', function() {
expectCanConnect('SubProcess', 'DataStoreReference', {
sequenceFlow: false,
messageFlow: false,
association: false,
association: true,
dataAssociation: { type: 'bpmn:DataOutputAssociation' }
});
}));
Expand All @@ -494,7 +494,7 @@ describe('features/modeling/rules - BpmnRules', function() {
expectCanConnect('DataStoreReference', 'SubProcess', {
sequenceFlow: false,
messageFlow: false,
association: false,
association: true,
dataAssociation: { type: 'bpmn:DataInputAssociation' }
});
}));
Expand Down Expand Up @@ -666,17 +666,6 @@ describe('features/modeling/rules - BpmnRules', function() {
}));


it('connect EventBasedGateway -> IntermediateCatchEvent_Message', inject(function() {

expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent_Message', {
sequenceFlow: true,
messageFlow: false,
association: false,
dataAssociation: false
});
}));


it('connect EventBasedGateway -> IntermediateCatchEvent_Signal', inject(function() {

expectCanConnect('EventBasedGateway', 'IntermediateCatchEvent_Signal', {
Expand Down Expand Up @@ -764,17 +753,6 @@ describe('features/modeling/rules - BpmnRules', function() {
});
}));


it('connect EventBasedGateway -> ParallelGateway', inject(function() {

expectCanConnect('EventBasedGateway', 'ParallelGateway', {
sequenceFlow: false,
messageFlow: false,
association: false,
dataAssociation: false
});
}));

});

describe('Task -> EventBasedGateway target with incoming sequence flow', function() {
Expand Down Expand Up @@ -1498,6 +1476,7 @@ describe('features/modeling/rules - BpmnRules', function() {
move: true
});
}));

});


Expand Down

0 comments on commit 4a675b3

Please sign in to comment.