fix(keyboard-move-selection): ensure moving lanes is not possible
Closes #943
This commit is contained in:
parent
2f001e1f4a
commit
ddaa3f0b03
|
@ -0,0 +1,78 @@
|
|||
import {
|
||||
bootstrapModeler,
|
||||
inject
|
||||
} from 'test/TestHelper';
|
||||
|
||||
import coreModule from 'lib/core';
|
||||
import keyboardMoveSelectionModule from 'diagram-js/lib/features/keyboard-move-selection';
|
||||
import modelingModule from 'lib/features/modeling';
|
||||
import rulesModule from 'lib/features/rules';
|
||||
|
||||
import { getMid } from 'diagram-js/lib/layout/LayoutUtil';
|
||||
|
||||
|
||||
describe('features/keyboard-move-selection', function() {
|
||||
|
||||
var diagramXML = require('./keyboard-move-selection.bpmn');
|
||||
|
||||
var testModules = [
|
||||
coreModule,
|
||||
keyboardMoveSelectionModule,
|
||||
modelingModule,
|
||||
rulesModule
|
||||
];
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||
|
||||
|
||||
it('should move task', inject(function(elementRegistry, keyboardMoveSelection, selection) {
|
||||
|
||||
// given
|
||||
var task = elementRegistry.get('Task_1');
|
||||
|
||||
selection.select(task);
|
||||
|
||||
var mid = getMid(task);
|
||||
|
||||
// when
|
||||
keyboardMoveSelection.moveSelection('right');
|
||||
|
||||
// then
|
||||
expect(getMid(task)).not.to.eql(mid);
|
||||
}));
|
||||
|
||||
|
||||
it('should move participant', inject(function(elementRegistry, keyboardMoveSelection, selection) {
|
||||
|
||||
// given
|
||||
var participant = elementRegistry.get('Participant_1');
|
||||
|
||||
selection.select(participant);
|
||||
|
||||
var mid = getMid(participant);
|
||||
|
||||
// when
|
||||
keyboardMoveSelection.moveSelection('right');
|
||||
|
||||
// then
|
||||
expect(getMid(participant)).not.to.eql(mid);
|
||||
}));
|
||||
|
||||
|
||||
it('should NOT move lane', inject(function(elementRegistry, keyboardMoveSelection, selection) {
|
||||
|
||||
// given
|
||||
var lane = elementRegistry.get('Lane_1');
|
||||
|
||||
selection.select(lane);
|
||||
|
||||
var mid = getMid(lane);
|
||||
|
||||
// when
|
||||
keyboardMoveSelection.moveSelection('right');
|
||||
|
||||
// then
|
||||
expect(getMid(lane)).to.eql(mid);
|
||||
}));
|
||||
|
||||
});
|
|
@ -0,0 +1,31 @@
|
|||
<?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_03kbt0n" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.3.0">
|
||||
<bpmn:collaboration id="Collaboration_1">
|
||||
<bpmn:participant id="Participant_1" processRef="Process_1" />
|
||||
</bpmn:collaboration>
|
||||
<bpmn:process id="Process_1" isExecutable="true">
|
||||
<bpmn:laneSet id="LaneSet_1618key">
|
||||
<bpmn:lane id="Lane_1">
|
||||
<bpmn:flowNodeRef>Task_1</bpmn:flowNodeRef>
|
||||
</bpmn:lane>
|
||||
<bpmn:lane id="Lane_2" />
|
||||
</bpmn:laneSet>
|
||||
<bpmn:task id="Task_1" />
|
||||
</bpmn:process>
|
||||
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
||||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_1">
|
||||
<bpmndi:BPMNShape id="Participant_0g0r0vr_di" bpmnElement="Participant_1" isHorizontal="true">
|
||||
<dc:Bounds x="-200" y="-25" width="600" height="370" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Lane_10hsezb_di" bpmnElement="Lane_1" isHorizontal="true">
|
||||
<dc:Bounds x="-170" y="-25" width="570" height="250" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Lane_0mzf3d4_di" bpmnElement="Lane_2" isHorizontal="true">
|
||||
<dc:Bounds x="-170" y="225" width="570" height="120" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Task_1y7dv59_di" bpmnElement="Task_1">
|
||||
<dc:Bounds x="50" y="60" width="100" height="80" />
|
||||
</bpmndi:BPMNShape>
|
||||
</bpmndi:BPMNPlane>
|
||||
</bpmndi:BPMNDiagram>
|
||||
</bpmn:definitions>
|
Loading…
Reference in New Issue