Skip to content

Commit

Permalink
fix(modeling): repair event based gateway target pasting
Browse files Browse the repository at this point in the history
The incoming connections of an event based gateway
target should not be removed when pasting.

Closes #1163
  • Loading branch information
barmac authored and merge-me[bot] committed Aug 12, 2019
1 parent 2da7834 commit bf18032
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 3 deletions.
9 changes: 7 additions & 2 deletions lib/features/modeling/behavior/EventBasedGatewayBehavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,15 @@ export default function EventBasedGatewayBehavior(eventBus, modeling) {
*/
this.preExecuted('connection.create', function(event) {

var source = event.context.source,
target = event.context.target,
var context = event.context,
source = context.source,
target = context.target,
existingIncomingConnections = target.incoming.slice();

if (context.hints && context.hints.createElementsBehavior === false) {
return;
}

if (
is(source, 'bpmn:EventBasedGateway') &&
target.incoming.length
Expand Down
17 changes: 16 additions & 1 deletion test/spec/features/copy-paste/BpmnCopyPasteSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ describe('features/copy-paste', function() {
propertiesXML = require('./properties.bpmn'),
collaborationXML = require('./collaboration.bpmn'),
collaborationMultipleXML = require('./collaboration-multiple.bpmn'),
collaborationAssociationsXML = require('./data-associations.bpmn');
collaborationAssociationsXML = require('./data-associations.bpmn'),
eventBasedGatewayXML = require('./event-based-gateway.bpmn');


describe('basic diagram', function() {
Expand Down Expand Up @@ -606,6 +607,20 @@ describe('features/copy-paste', function() {

});


describe('event based gateway', function() {

beforeEach(bootstrapModeler(eventBasedGatewayXML, {
modules: testModules
}));


it('should copy and paste event based gateway connected to an event', integrationTest([
'EventBasedGateway_1',
'IntermediateCatchEvent_1'
]));
});

});

// helpers //////////
Expand Down
27 changes: 27 additions & 0 deletions test/spec/features/copy-paste/event-based-gateway.bpmn
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.2.1">
<bpmn:process id="Process_1" isExecutable="false">
<bpmn:eventBasedGateway id="EventBasedGateway_1">
<bpmn:outgoing>SequenceFlow_4</bpmn:outgoing>
</bpmn:eventBasedGateway>
<bpmn:intermediateCatchEvent id="IntermediateCatchEvent_1">
<bpmn:incoming>SequenceFlow_4</bpmn:incoming>
<bpmn:messageEventDefinition />
</bpmn:intermediateCatchEvent>
<bpmn:sequenceFlow id="SequenceFlow_4" sourceRef="EventBasedGateway_1" targetRef="IntermediateCatchEvent_1" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
<bpmndi:BPMNShape id="EventBasedGateway_1dkii50_di" bpmnElement="EventBasedGateway_1">
<dc:Bounds x="156" y="555" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="IntermediateCatchEvent_1pvz0xw_di" bpmnElement="IntermediateCatchEvent_1">
<dc:Bounds x="262" y="562" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1m3ovdd_di" bpmnElement="SequenceFlow_4">
<di:waypoint x="206" y="580" />
<di:waypoint x="262" y="580" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>

0 comments on commit bf18032

Please sign in to comment.