test(popup-menu): verify if linked events have name

This commit is contained in:
Maciej Barelkowski 2020-03-27 07:57:56 +01:00 committed by fake-join[bot]
parent 95b50f08a7
commit c2ded3952f
2 changed files with 97 additions and 0 deletions

View File

@ -0,0 +1,29 @@
<?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" id="Definitions_0yl4vso" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.7.1">
<bpmn:process id="Process_07klzkj" isExecutable="true">
<bpmn:startEvent id="StartEvent" />
<bpmn:intermediateThrowEvent id="IntermediateEvent" />
<bpmn:endEvent id="EndEvent" />
<bpmn:subProcess id="Activity_0vmnap0" />
<bpmn:boundaryEvent id="BoundaryEvent" attachedToRef="Activity_0vmnap0" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_07klzkj">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent">
<dc:Bounds x="179" y="79" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_1nfgnhx_di" bpmnElement="IntermediateEvent">
<dc:Bounds x="342" y="79" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0bbnae8_di" bpmnElement="EndEvent">
<dc:Bounds x="502" y="79" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0vmnap0_di" bpmnElement="Activity_0vmnap0" isExpanded="true">
<dc:Bounds x="185" y="200" width="350" height="200" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_0so9mwz_di" bpmnElement="BoundaryEvent">
<dc:Bounds x="332" y="382" width="36" height="36" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>

View File

@ -1750,6 +1750,74 @@ describe('features/popup-menu - replace menu provider', function() {
});
describe('events', function() {
var diagramXML = require('./ReplaceMenuProvider.events.bpmn');
beforeEach(bootstrapModeler(diagramXML, {
modules: testModules
}));
it('should set default link name for a link catch event', inject(function(elementRegistry) {
// given
var event = elementRegistry.get('IntermediateEvent');
// when
openPopup(event);
triggerAction('replace-with-link-intermediate-catch');
// then
event = elementRegistry.get('IntermediateEvent');
expect(event).to.exist;
expect(is(event, 'bpmn:IntermediateCatchEvent'), 'is not a catch event').to.be.true;
var eventBo = event.businessObject,
eventDefinitions = eventBo.eventDefinitions;
expect(eventDefinitions).to.exist;
expect(eventDefinitions).to.have.length(1);
var eventDefinition = eventDefinitions[ 0 ];
expect(is(eventDefinition, 'bpmn:LinkEventDefinition')).to.be.true;
expect(eventDefinition.name, 'name is not set').to.eql('');
}));
it('should set default link name for a link throw event', inject(function(elementRegistry) {
// given
var event = elementRegistry.get('IntermediateEvent');
// when
openPopup(event);
triggerAction('replace-with-link-intermediate-throw');
// then
event = elementRegistry.get('IntermediateEvent');
expect(event).to.exist;
expect(is(event, 'bpmn:IntermediateThrowEvent'), 'is not a throw event').to.be.true;
var eventBo = event.businessObject,
eventDefinitions = eventBo.eventDefinitions;
expect(eventDefinitions).to.exist;
expect(eventDefinitions).to.have.length(1);
var eventDefinition = eventDefinitions[ 0 ];
expect(is(eventDefinition, 'bpmn:LinkEventDefinition')).to.be.true;
expect(eventDefinition.name, 'name is not set').to.eql('');
}));
});
});