fix(replace menu): prevent morphing data stores outside participants
Added tests to handle the edge case Added a new test diagram Closes #1508
This commit is contained in:
parent
143603a26d
commit
c4cbc7821a
|
@ -83,7 +83,7 @@ ReplaceMenuProvider.prototype.getEntries = function(element) {
|
|||
return this._createEntries(element, replaceOptions.DATA_OBJECT_REFERENCE);
|
||||
}
|
||||
|
||||
if (is(businessObject, 'bpmn:DataStoreReference')) {
|
||||
if (is(businessObject, 'bpmn:DataStoreReference') && !is(element.parent, 'bpmn:Collaboration')) {
|
||||
return this._createEntries(element, replaceOptions.DATA_STORE_REFERENCE);
|
||||
}
|
||||
|
||||
|
|
27
test/fixtures/bpmn/features/replace/data-stores-positioned-against-participant.bpmn
vendored
Normal file
27
test/fixtures/bpmn/features/replace/data-stores-positioned-against-participant.bpmn
vendored
Normal file
|
@ -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:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_19f4rsu" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0">
|
||||
<bpmn:collaboration id="Collaboration_0jl6l17">
|
||||
<bpmn:participant id="Participant_1d4xc0j" processRef="Process_07mbex6" />
|
||||
</bpmn:collaboration>
|
||||
<bpmn:process id="Process_07mbex6" isExecutable="true">
|
||||
<bpmn:startEvent id="StartEvent_1" />
|
||||
<bpmn:dataStoreReference id="DataStoreReference_0" />
|
||||
<bpmn:dataStoreReference id="DataStoreReference_1" />
|
||||
</bpmn:process>
|
||||
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
||||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_0jl6l17">
|
||||
<bpmndi:BPMNShape id="Participant_1d4xc0j_di" bpmnElement="Participant_1d4xc0j" isHorizontal="true">
|
||||
<dc:Bounds x="129" y="52" width="600" height="250" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
|
||||
<dc:Bounds x="179" y="159" width="36" height="36" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="DataStoreReference_0_di" bpmnElement="DataStoreReference_0">
|
||||
<dc:Bounds x="275" y="152" width="50" height="50" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="DataStoreReference_1_di" bpmnElement="DataStoreReference_1">
|
||||
<dc:Bounds x="805" y="152" width="50" height="50" />
|
||||
</bpmndi:BPMNShape>
|
||||
</bpmndi:BPMNPlane>
|
||||
</bpmndi:BPMNDiagram>
|
||||
</bpmn:definitions>
|
|
@ -30,6 +30,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
var diagramXMLMarkers = require('../../../fixtures/bpmn/draw/activity-markers-simple.bpmn'),
|
||||
diagramXMLReplace = require('../../../fixtures/bpmn/features/replace/01_replace.bpmn'),
|
||||
diagramXMLDataElements = require('../../../fixtures/bpmn/features/replace/data-elements.bpmn'),
|
||||
diagramXMLDataStoresPositionedAgainstParticipant = require('../../../fixtures/bpmn/features/replace/data-stores-positioned-against-participant.bpmn'),
|
||||
diagramXMLParticipants = require('../../../fixtures/bpmn/features/replace/participants.bpmn');
|
||||
|
||||
var testModules = [
|
||||
|
@ -1429,6 +1430,41 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
});
|
||||
|
||||
|
||||
describe('data store positioned against participant', function() {
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXMLDataStoresPositionedAgainstParticipant, { modules: testModules }));
|
||||
|
||||
|
||||
it('should only contain data object reference', inject(function(elementRegistry) {
|
||||
|
||||
// given
|
||||
var dataStoreReferenceWithinParticipant = elementRegistry.get('DataStoreReference_0');
|
||||
|
||||
// when
|
||||
openPopup(dataStoreReferenceWithinParticipant);
|
||||
|
||||
// then
|
||||
expect(queryEntries()).to.have.length(1);
|
||||
expect(queryEntry('replace-with-data-object-reference')).to.exist;
|
||||
}));
|
||||
|
||||
|
||||
it('should contain no reference', inject(function(elementRegistry) {
|
||||
|
||||
// given
|
||||
var dataStoreReferenceOutsideParticipant = elementRegistry.get('DataStoreReference_1');
|
||||
|
||||
// when
|
||||
openPopup(dataStoreReferenceOutsideParticipant);
|
||||
|
||||
// then
|
||||
expect(queryEntries()).to.have.length(0);
|
||||
expect(queryEntry('replace-with-data-object-reference')).to.be.null;
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue