test(modeling/behavior): add test cases for boundary event connections

Related to #323
This commit is contained in:
pedesen 2015-09-01 15:30:00 +02:00 committed by Nico Rehwaldt
parent 6bed01e023
commit d831ed45b8
2 changed files with 110 additions and 0 deletions

View File

@ -0,0 +1,40 @@
<?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:task id="Task_1" />
<bpmn:boundaryEvent id="BoundaryEvent_1" attachedToRef="Task_1">
<bpmn:outgoing>SequenceFlow_1</bpmn:outgoing>
</bpmn:boundaryEvent>
<bpmn:subProcess id="SubProcess_1" />
<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:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
<bpmndi:BPMNShape id="Task_1_di" bpmnElement="Task_1">
<dc:Bounds x="161" y="83" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="BoundaryEvent_1_di" bpmnElement="BoundaryEvent_1">
<dc:Bounds x="243" y="105" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="653" y="205" width="90" height="20" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="SubProcess_1_di" bpmnElement="SubProcess_1" isExpanded="true">
<dc:Bounds x="158" y="211" width="350" height="200" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Task_2_di" bpmnElement="Task_2">
<dc:Bounds x="403" y="83" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1_di" bpmnElement="SequenceFlow_1">
<di:waypoint xsi:type="dc:Point" x="279" y="123" />
<di:waypoint xsi:type="dc:Point" x="403" y="123" />
<bpmndi:BPMNLabel>
<dc:Bounds x="459" y="149" width="90" height="20" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>

View File

@ -310,4 +310,74 @@ describe('features/modeling - replace connection', function() {
});
describe('boundary events', function() {
var processDiagramXML = require('./ReplaceConnectionBehavior.boundary-events.bpmn');
beforeEach(bootstrapModeler(processDiagramXML, { modules: testModules }));
var element;
beforeEach(inject(function(elementRegistry) {
element = function(id) {
return elementRegistry.get(id);
};
}));
describe('moving host', function() {
it('should remove invalid connections', inject(function(modeling) {
// given
var taskShape = element('Task_1'),
targetShape = element('SubProcess_1'),
sequenceFlow = element('SequenceFlow_1');
// when
modeling.moveElements([ taskShape ], { x: 30, y: 200 }, targetShape);
// then
expectNotConnected(taskShape, targetShape, sequenceFlow);
}));
it('should remove invalid connections (undo)', inject(function(modeling, commandStack) {
// given
var taskShape = element('Task_1'),
targetShape = element('SubProcess_1'),
sequenceFlow = element('SequenceFlow_1');
// when
modeling.moveElements([ taskShape ], { x: 30, y: 200 }, targetShape);
commandStack.undo();
// then
expectConnected(taskShape, targetShape, sequenceFlow);
}));
it('should remove invalid connections (redo)', inject(function(modeling, commandStack) {
// given
var taskShape = element('Task_1'),
targetShape = element('SubProcess_1'),
sequenceFlow = element('SequenceFlow_1');
// when
modeling.moveElements([ taskShape ], { x: 30, y: 200 }, targetShape);
commandStack.undo();
commandStack.redo();
// then
expectNotConnected(taskShape, targetShape, sequenceFlow);
}));
});
});
});