fix(replace): do NOT show current sequence flow type for OR-gateways

Closes #410
This commit is contained in:
Adam Brengesjö 2015-11-10 12:32:43 +01:00 committed by pedesen
parent a6b76d7fc3
commit 0a33d7c2b4
3 changed files with 81 additions and 2 deletions

View File

@ -296,8 +296,8 @@ function BpmnReplace(bpmnFactory, moddle, popupMenu, replace, selection, modelin
switch (entry.actionName) {
case 'replace-with-default-flow':
if (businessObject.sourceRef.default !== businessObject &&
is(businessObject.sourceRef, 'bpmn:ExclusiveGateway') ||
is(businessObject.sourceRef, 'bpmn:InclusiveGateway')) {
(is(businessObject.sourceRef, 'bpmn:ExclusiveGateway') ||
is(businessObject.sourceRef, 'bpmn:InclusiveGateway'))) {
menuEntries.push(addMenuEntry(entry, function() {
modeling.updateProperties(element.source, { default: businessObject });

View File

@ -0,0 +1,48 @@
<?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:incoming>SequenceFlow_1</bpmn:incoming>
</bpmn:task>
<bpmn:sequenceFlow id="SequenceFlow_1" sourceRef="InclusiveGateway_1" targetRef="Task_1" />
<bpmn:inclusiveGateway id="InclusiveGateway_1" default="SequenceFlow_1">
<bpmn:outgoing>SequenceFlow_1</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_2</bpmn:outgoing>
</bpmn:inclusiveGateway>
<bpmn:task id="Task_2">
<bpmn:incoming>SequenceFlow_2</bpmn:incoming>
</bpmn:task>
<bpmn:sequenceFlow id="SequenceFlow_2" sourceRef="InclusiveGateway_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="230" y="25" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1_di" bpmnElement="SequenceFlow_1">
<di:waypoint xsi:type="dc:Point" x="156" y="65" />
<di:waypoint xsi:type="dc:Point" x="230" y="65" />
<bpmndi:BPMNLabel>
<dc:Bounds x="168" y="55" width="90" height="20" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="InclusiveGateway_1_di" bpmnElement="InclusiveGateway_1">
<dc:Bounds x="106" y="40" width="50" height="50" />
<bpmndi:BPMNLabel>
<dc:Bounds x="86" y="90" width="90" height="20" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Task_2_di" bpmnElement="Task_2">
<dc:Bounds x="230" y="134" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_2_di" bpmnElement="SequenceFlow_2">
<di:waypoint xsi:type="dc:Point" x="131" y="90" />
<di:waypoint xsi:type="dc:Point" x="131" y="174" />
<di:waypoint xsi:type="dc:Point" x="230" y="174" />
<bpmndi:BPMNLabel>
<dc:Bounds x="86" y="122" width="90" height="20" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>

View File

@ -925,6 +925,37 @@ describe('features/replace', function() {
});
describe('default flows from inclusive gateways', function () {
var diagramXML = require('./BpmnReplace.defaultFlowsFromInclusiveGateways.bpmn');
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
it ('should show Default replace option', inject(function (elementRegistry, bpmnReplace) {
// given
var sequenceFlow = elementRegistry.get('SequenceFlow_2');
// when
var opts = bpmnReplace.getReplaceOptions(sequenceFlow);
// then
expect(opts).to.have.length(1);
}));
it ('should NOT show Default replace option', inject(function (elementRegistry, bpmnReplace) {
// given
var sequenceFlow = elementRegistry.get('SequenceFlow_1');
// when
var opts = bpmnReplace.getReplaceOptions(sequenceFlow);
// then
expect(opts).to.have.length(1);
}));
});
describe('default flows', function() {
var diagramXML = require('./BpmnReplace.defaultFlows.bpmn');