test(modeling): verify tooltip shown on failed create

This commit is contained in:
Nico Rehwaldt 2020-11-03 14:34:00 +01:00 committed by fake-join[bot]
parent 3d84aa486e
commit 52c14a23d8
2 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="sid-38422fae-e03e-43a3-bef4-bd33b32041b2" targetNamespace="http://bpmn.io/bpmn" exporter="bpmn-js" exporterVersion="7.3.0">
<collaboration id="Collaboration_1">
<participant name="Participant_1" id="Participant_1" processRef="Process_1" />
</collaboration>
<process id="Process_1" />
<bpmndi:BPMNDiagram id="BpmnDiagram_1">
<bpmndi:BPMNPlane id="BpmnPlane_1" bpmnElement="Collaboration_1">
<bpmndi:BPMNShape id="Participant_1_di" bpmnElement="Participant_1" isHorizontal="true">
<omgdc:Bounds x="160" y="80" width="420" height="180" />
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>

View File

@ -0,0 +1,57 @@
import {
bootstrapModeler,
getBpmnJS,
inject
} from 'test/TestHelper';
import {
createCanvasEvent as canvasEvent
} from 'test/util/MockEvents';
import coreModule from 'lib/core';
import modelingModule from 'lib/features/modeling';
describe('features/modeling - ModelingFeedback', function() {
var collaborationDiagramXML = require('./ModelingFeedback.bpmn');
beforeEach(bootstrapModeler(collaborationDiagramXML, {
modules: [
coreModule,
modelingModule
]
}));
it('should indicate', inject(function(create, canvas, elementFactory, dragging) {
// given
var task = elementFactory.createShape({ type: 'bpmn:Task' });
var collaboration = canvas.getRootElement();
var collaborationGfx = canvas.getGraphics(collaboration);
create.start(canvasEvent({ x: 100, y: 100 }), task);
dragging.hover({ element: collaboration, gfx: collaborationGfx });
// when
dragging.end();
// then
expectTooltip('error', 'flow elements must be children of pools/participants');
}));
});
function expectTooltip(cls, message) {
return getBpmnJS().invoke(function(canvas) {
var tooltipEl = document.querySelector('[data-tooltip-id]', canvas.getContainer());
expect(tooltipEl.textContent).to.eql(message);
expect(tooltipEl.classList.contains(cls));
});
}