fix(modeling): connections are properly removed
This fixes the loss of connections when moving a boundary event outside of a subprocess. Closes #480
This commit is contained in:
parent
2371a8da23
commit
b9b64f589b
|
@ -0,0 +1,42 @@
|
||||||
|
<?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">
|
||||||
|
<bpmn:process id="Process_1" isExecutable="false">
|
||||||
|
<bpmn:subProcess id="SubProcess_1">
|
||||||
|
<bpmn:task id="Task_1" />
|
||||||
|
<bpmn:boundaryEvent id="BoundaryEvent_1" attachedToRef="Task_1">
|
||||||
|
<bpmn:outgoing>SequenceFlow_1</bpmn:outgoing>
|
||||||
|
</bpmn:boundaryEvent>
|
||||||
|
<bpmn:task id="Task_2">
|
||||||
|
<bpmn:incoming>SequenceFlow_1</bpmn:incoming>
|
||||||
|
</bpmn:task>
|
||||||
|
<bpmn:sequenceFlow id="SequenceFlow_1" sourceRef="BoundaryEvent_1" targetRef="Task_2" />
|
||||||
|
</bpmn:subProcess>
|
||||||
|
</bpmn:process>
|
||||||
|
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
||||||
|
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
|
||||||
|
<bpmndi:BPMNShape id="SubProcess_1_di" bpmnElement="SubProcess_1" isExpanded="true">
|
||||||
|
<dc:Bounds x="77" y="46" width="452" height="284" />
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="Task_1_di" bpmnElement="Task_1">
|
||||||
|
<dc:Bounds x="117" y="79" width="100" height="80" />
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="BoundaryEvent_1_di" bpmnElement="BoundaryEvent_1">
|
||||||
|
<dc:Bounds x="147" y="141" width="36" height="36" />
|
||||||
|
<bpmndi:BPMNLabel>
|
||||||
|
<dc:Bounds x="120" y="177" width="90" height="20" />
|
||||||
|
</bpmndi:BPMNLabel>
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNShape id="Task_2_di" bpmnElement="Task_2">
|
||||||
|
<dc:Bounds x="234" y="204" width="100" height="80" />
|
||||||
|
</bpmndi:BPMNShape>
|
||||||
|
<bpmndi:BPMNEdge id="SequenceFlow_1_di" bpmnElement="SequenceFlow_1">
|
||||||
|
<di:waypoint xsi:type="dc:Point" x="165" y="177" />
|
||||||
|
<di:waypoint xsi:type="dc:Point" x="165" y="244" />
|
||||||
|
<di:waypoint xsi:type="dc:Point" x="234" y="244" />
|
||||||
|
<bpmndi:BPMNLabel>
|
||||||
|
<dc:Bounds x="135" y="201" width="90" height="20" />
|
||||||
|
</bpmndi:BPMNLabel>
|
||||||
|
</bpmndi:BPMNEdge>
|
||||||
|
</bpmndi:BPMNPlane>
|
||||||
|
</bpmndi:BPMNDiagram>
|
||||||
|
</bpmn:definitions>
|
|
@ -10,6 +10,8 @@ var is = require('../../../../../lib/util/ModelUtil').is,
|
||||||
var modelingModule = require('../../../../../lib/features/modeling'),
|
var modelingModule = require('../../../../../lib/features/modeling'),
|
||||||
coreModule = require('../../../../../lib/core');
|
coreModule = require('../../../../../lib/core');
|
||||||
|
|
||||||
|
var canvasEvent = require('../../../../util/MockEvents').createCanvasEvent;
|
||||||
|
|
||||||
|
|
||||||
function getConnection(source, target, connectionOrType) {
|
function getConnection(source, target, connectionOrType) {
|
||||||
return find(source.outgoing, function(c) {
|
return find(source.outgoing, function(c) {
|
||||||
|
@ -304,8 +306,11 @@ describe('features/modeling - replace connection', function() {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
describe('boundary events', function() {
|
describe('boundary events', function() {
|
||||||
|
|
||||||
|
describe('moving host', function() {
|
||||||
|
|
||||||
var processDiagramXML = require('./ReplaceConnectionBehavior.boundary-events.bpmn');
|
var processDiagramXML = require('./ReplaceConnectionBehavior.boundary-events.bpmn');
|
||||||
|
|
||||||
beforeEach(bootstrapModeler(processDiagramXML, { modules: testModules }));
|
beforeEach(bootstrapModeler(processDiagramXML, { modules: testModules }));
|
||||||
|
@ -318,8 +323,6 @@ describe('features/modeling - replace connection', function() {
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
|
|
||||||
describe('moving host', function() {
|
|
||||||
|
|
||||||
it('should remove invalid connections', inject(function(modeling) {
|
it('should remove invalid connections', inject(function(modeling) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
|
@ -373,6 +376,50 @@ describe('features/modeling - replace connection', function() {
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
describe('moving along host with outgoing', function () {
|
||||||
|
var processDiagramXML = require('../../../../fixtures/bpmn/features/replace/connection.bpmn');
|
||||||
|
|
||||||
|
beforeEach(bootstrapModeler(processDiagramXML, { modules: testModules }));
|
||||||
|
|
||||||
|
it('should move connections outgoing from an attacher',
|
||||||
|
inject(function(canvas, elementFactory, move, dragging, elementRegistry, selection) {
|
||||||
|
var rootShape = canvas.getRootElement(),
|
||||||
|
rootGfx = elementRegistry.getGraphics(rootShape),
|
||||||
|
host = elementRegistry.get('Task_1'),
|
||||||
|
task = elementRegistry.get('Task_2'),
|
||||||
|
boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||||
|
connection = elementRegistry.get('SequenceFlow_1');
|
||||||
|
|
||||||
|
// given
|
||||||
|
selection.select([ host, boundaryEvent, task ]);
|
||||||
|
|
||||||
|
// when
|
||||||
|
move.start(canvasEvent({ x: 0, y: 0 }), host);
|
||||||
|
|
||||||
|
dragging.hover({
|
||||||
|
element: rootShape,
|
||||||
|
gfx: rootGfx
|
||||||
|
});
|
||||||
|
|
||||||
|
dragging.move(canvasEvent({ x: 0, y: 300 }));
|
||||||
|
dragging.end();
|
||||||
|
|
||||||
|
// then
|
||||||
|
expect(connection.waypoints[0].x).to.equal(165);
|
||||||
|
expect(connection.waypoints[0].y).to.equal(477);
|
||||||
|
|
||||||
|
expect(connection.waypoints[1].x).to.equal(165);
|
||||||
|
expect(connection.waypoints[1].y).to.equal(544);
|
||||||
|
|
||||||
|
expect(connection.waypoints[2].x).to.equal(234);
|
||||||
|
expect(connection.waypoints[2].y).to.equal(544);
|
||||||
|
|
||||||
|
expect(connection.source).to.eql(boundaryEvent);
|
||||||
|
expect(connection.target).to.eql(task);
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue