fix(modeling): hide labels on element create
This commit is contained in:
parent
08c2ebc78f
commit
a0bfc29482
|
@ -30,6 +30,7 @@ function LabelSupport(eventBus, modeling, bpmnFactory) {
|
|||
position = getExternalLabelMid(element);
|
||||
modeling.createLabel(element, position, {
|
||||
id: businessObject.id + '_label',
|
||||
hidden: true,
|
||||
businessObject: businessObject
|
||||
});
|
||||
}
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<?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" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn">
|
||||
<bpmn:process id="Process_1" isExecutable="false">
|
||||
<bpmn:startEvent id="StartEvent_1" />
|
||||
<bpmn:task id="Task_1" />
|
||||
</bpmn:process>
|
||||
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
|
||||
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
|
||||
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
|
||||
<dc:Bounds x="173" y="102" width="36" height="36" />
|
||||
</bpmndi:BPMNShape>
|
||||
<bpmndi:BPMNShape id="Task_1_di" bpmnElement="Task_1">
|
||||
<dc:Bounds x="353" y="80" width="100" height="80" />
|
||||
</bpmndi:BPMNShape>
|
||||
</bpmndi:BPMNPlane>
|
||||
</bpmndi:BPMNDiagram>
|
||||
</bpmn:definitions>
|
|
@ -0,0 +1,37 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
var modelingModule = require('../../../../lib/features/modeling'),
|
||||
coreModule = require('../../../../lib/core');
|
||||
|
||||
describe('features - bpmn-label-support', function() {
|
||||
|
||||
var diagramXML = require('../../../fixtures/bpmn/basic.bpmn');
|
||||
|
||||
var testModules = [ modelingModule, coreModule ];
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||
|
||||
describe('should not add a label on create', function() {
|
||||
|
||||
it('should not add a label on create', inject(function(elementFactory, elementRegistry, modeling, canvas) {
|
||||
// when
|
||||
var startEvent = elementRegistry.get('StartEvent_1'),
|
||||
task = elementRegistry.get('Task_1');
|
||||
|
||||
modeling.connect(startEvent, task);
|
||||
|
||||
var labels = elementRegistry.filter(function(element) {
|
||||
return element.type === 'label';
|
||||
});
|
||||
|
||||
// then
|
||||
expect(labels).to.have.length(2);
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
});
|
|
@ -39,7 +39,6 @@ describe('features/modeling/behavior - data objects -', function() {
|
|||
expect(dataObject).to.exist;
|
||||
expect(is(dataObject, 'bpmn:DataObject')).to.be.true;
|
||||
expect(dataObject.id).to.exist;
|
||||
|
||||
}));
|
||||
|
||||
|
||||
|
@ -60,7 +59,6 @@ describe('features/modeling/behavior - data objects -', function() {
|
|||
|
||||
expect(dataObject2.$parent.id).to.equal(subProcess1.id);
|
||||
expect(dataObjectRefShape2.parent.id).to.equal(subProcess1.id);
|
||||
|
||||
}));
|
||||
|
||||
});
|
||||
|
@ -75,11 +73,9 @@ describe('features/modeling/behavior - data objects -', function() {
|
|||
taskShape;
|
||||
|
||||
beforeEach(inject(function(canvas, elementRegistry) {
|
||||
|
||||
rootShape = canvas.getRootElement();
|
||||
dataObjectRefShape1 = elementRegistry.get('DataObjectReference_1');
|
||||
taskShape = elementRegistry.get('Task_1');
|
||||
|
||||
}));
|
||||
|
||||
describe('dataOutputAssociation', function() {
|
||||
|
@ -95,7 +91,6 @@ describe('features/modeling/behavior - data objects -', function() {
|
|||
expect(dataOutputAssociations[0].$parent).to.equal(taskShape.businessObject);
|
||||
expect(dataOutputAssociations).to.include(outputAssociation.businessObject);
|
||||
expect(taskShape.businessObject.get('dataInputAssociations')).to.be.empty;
|
||||
|
||||
}));
|
||||
|
||||
|
||||
|
@ -108,7 +103,6 @@ describe('features/modeling/behavior - data objects -', function() {
|
|||
// then
|
||||
expect(taskShape.businessObject.get('dataOutputAssociations')).to.be.empty;
|
||||
expect(taskShape.businessObject.get('dataInputAssociations')).to.be.empty;
|
||||
|
||||
}));
|
||||
|
||||
|
||||
|
@ -125,7 +119,6 @@ describe('features/modeling/behavior - data objects -', function() {
|
|||
expect(dataOutputAssociations[0].$parent).to.equal(taskShape.businessObject);
|
||||
expect(dataOutputAssociations).to.include(outputAssociation.businessObject);
|
||||
expect(taskShape.businessObject.get('dataInputAssociations')).to.be.empty;
|
||||
|
||||
}));
|
||||
|
||||
});
|
||||
|
@ -143,7 +136,6 @@ describe('features/modeling/behavior - data objects -', function() {
|
|||
expect(dataInputAssociations[0].$parent).to.equal(taskShape.businessObject);
|
||||
expect(dataInputAssociations).to.include(inputAssociation.businessObject);
|
||||
expect(taskShape.businessObject.get('dataOutputAssociations')).to.be.empty;
|
||||
|
||||
}));
|
||||
|
||||
|
||||
|
@ -156,7 +148,6 @@ describe('features/modeling/behavior - data objects -', function() {
|
|||
// then
|
||||
expect(taskShape.businessObject.get('dataOutputAssociations')).to.be.empty;
|
||||
expect(taskShape.businessObject.get('dataInputAssociations')).to.be.empty;
|
||||
|
||||
}));
|
||||
|
||||
|
||||
|
@ -173,7 +164,6 @@ describe('features/modeling/behavior - data objects -', function() {
|
|||
expect(dataInputAssociations[0].$parent).to.equal(taskShape.businessObject);
|
||||
expect(dataInputAssociations).to.include(inputAssociation.businessObject);
|
||||
expect(taskShape.businessObject.get('dataOutputAssociations')).to.be.empty;
|
||||
|
||||
}));
|
||||
|
||||
});
|
||||
|
@ -192,13 +182,13 @@ describe('features/modeling/behavior - data objects -', function() {
|
|||
inputAssociation;
|
||||
|
||||
beforeEach(inject(function(canvas, elementRegistry) {
|
||||
|
||||
rootShape = canvas.getRootElement();
|
||||
|
||||
task1Shape = elementRegistry.get('Task_1');
|
||||
task2Shape = elementRegistry.get('Task_2');
|
||||
|
||||
outputAssociation = elementRegistry.get('DataOutputAssociation_1');
|
||||
inputAssociation = elementRegistry.get('DataInputAssociation_1');
|
||||
|
||||
}));
|
||||
|
||||
describe('DataOutputAssociation', function() {
|
||||
|
@ -211,7 +201,6 @@ describe('features/modeling/behavior - data objects -', function() {
|
|||
// then
|
||||
expect(task1Shape.businessObject.get('dataOutputAssociations')).to.be.empty;
|
||||
expect(task1Shape.businessObject.get('dataInputAssociations')).to.be.empty;
|
||||
|
||||
}));
|
||||
|
||||
|
||||
|
@ -219,6 +208,7 @@ describe('features/modeling/behavior - data objects -', function() {
|
|||
|
||||
// when
|
||||
modeling.removeConnection(outputAssociation);
|
||||
|
||||
commandStack.undo();
|
||||
|
||||
var dataOutputAssociations = task1Shape.businessObject.get('dataOutputAssociations');
|
||||
|
@ -227,7 +217,6 @@ describe('features/modeling/behavior - data objects -', function() {
|
|||
expect(dataOutputAssociations[0].$parent).to.equal(task1Shape.businessObject);
|
||||
expect(dataOutputAssociations).to.be.include(outputAssociation.businessObject);
|
||||
expect(task1Shape.businessObject.get('dataInputAssociations')).to.be.empty;
|
||||
|
||||
}));
|
||||
|
||||
|
||||
|
@ -235,13 +224,13 @@ describe('features/modeling/behavior - data objects -', function() {
|
|||
|
||||
// when
|
||||
modeling.removeConnection(outputAssociation);
|
||||
|
||||
commandStack.undo();
|
||||
commandStack.redo();
|
||||
|
||||
// then
|
||||
expect(task1Shape.businessObject.get('dataOutputAssociations')).to.be.empty;
|
||||
expect(task1Shape.businessObject.get('dataInputAssociations')).to.be.empty;
|
||||
|
||||
}));
|
||||
|
||||
});
|
||||
|
@ -256,7 +245,6 @@ describe('features/modeling/behavior - data objects -', function() {
|
|||
// then
|
||||
expect(task2Shape.businessObject.get('dataInputAssociations')).to.be.empty;
|
||||
expect(task2Shape.businessObject.get('dataOutputAssociations')).to.be.empty;
|
||||
|
||||
}));
|
||||
|
||||
|
||||
|
@ -264,6 +252,7 @@ describe('features/modeling/behavior - data objects -', function() {
|
|||
|
||||
// when
|
||||
modeling.removeConnection(inputAssociation);
|
||||
|
||||
commandStack.undo();
|
||||
|
||||
var dataInputAssociations = task2Shape.businessObject.get('dataInputAssociations');
|
||||
|
@ -272,7 +261,6 @@ describe('features/modeling/behavior - data objects -', function() {
|
|||
expect(dataInputAssociations[0].$parent).to.equal(task2Shape.businessObject);
|
||||
expect(dataInputAssociations).to.include(inputAssociation.businessObject);
|
||||
expect(task2Shape.businessObject.get('dataOutputAssociations')).to.be.empty;
|
||||
|
||||
}));
|
||||
|
||||
|
||||
|
@ -280,21 +268,17 @@ describe('features/modeling/behavior - data objects -', function() {
|
|||
|
||||
// when
|
||||
modeling.removeConnection(inputAssociation);
|
||||
|
||||
commandStack.undo();
|
||||
commandStack.redo();
|
||||
|
||||
// then
|
||||
expect(task2Shape.businessObject.get('dataInputAssociations')).to.be.empty;
|
||||
expect(task2Shape.businessObject.get('dataOutputAssociations')).to.be.empty;
|
||||
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('reconnect', function() {
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -14,7 +14,7 @@ var modelingModule = require('../../../../../lib/features/modeling'),
|
|||
function getConnection(source, target, connectionOrType) {
|
||||
return find(source.outgoing, function(c) {
|
||||
return c.target === target &&
|
||||
(typeof connectionOrType === 'string' ? is(c, connectionOrType) : c === connectionOrType);
|
||||
(typeof connectionOrType === 'string' ? is(c, connectionOrType) : c === connectionOrType);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -54,14 +54,13 @@ describe('features/modeling - replace connection', function() {
|
|||
var task4Shape = element('Task_4');
|
||||
var connection = element('SequenceFlow_1');
|
||||
|
||||
var newWaypoints = [connection.waypoints[0], { x: task4Shape.x+30, y: task4Shape.y }];
|
||||
var newWaypoints = [ connection.waypoints[0], { x: task4Shape.x + 30, y: task4Shape.y }];
|
||||
|
||||
// when
|
||||
modeling.reconnectEnd(connection, task4Shape, newWaypoints);
|
||||
|
||||
// then
|
||||
expectConnected(element('Task_2'), task4Shape, 'bpmn:MessageFlow');
|
||||
|
||||
}));
|
||||
|
||||
|
||||
|
@ -71,14 +70,13 @@ describe('features/modeling - replace connection', function() {
|
|||
var task4Shape = element('Task_4');
|
||||
var connection = element('MessageFlow_1');
|
||||
|
||||
var newWaypoints = [connection.waypoints[0], { x: task4Shape.x, y: task4Shape.y+20 }];
|
||||
var newWaypoints = [ connection.waypoints[0], { x: task4Shape.x, y: task4Shape.y + 20 } ];
|
||||
|
||||
// when
|
||||
modeling.reconnectEnd(connection, task4Shape, newWaypoints);
|
||||
|
||||
// then
|
||||
expectConnected(element('Task_3'), task4Shape, 'bpmn:SequenceFlow');
|
||||
|
||||
}));
|
||||
|
||||
|
||||
|
@ -88,14 +86,13 @@ describe('features/modeling - replace connection', function() {
|
|||
var participant2 = element('Participant_2');
|
||||
var connection = element('SequenceFlow_1');
|
||||
|
||||
var newWaypoints = [connection.waypoints[0], { x: participant2.x, y: participant2.y }];
|
||||
var newWaypoints = [ connection.waypoints[0], { x: participant2.x, y: participant2.y }];
|
||||
|
||||
// when
|
||||
modeling.reconnectEnd(connection, participant2, newWaypoints);
|
||||
|
||||
// then
|
||||
expectConnected(element('Task_2'), participant2, 'bpmn:MessageFlow');
|
||||
|
||||
}));
|
||||
|
||||
|
||||
|
@ -107,8 +104,8 @@ describe('features/modeling - replace connection', function() {
|
|||
connection = element('SequenceFlow_1');
|
||||
|
||||
var newWaypoints = [
|
||||
{ x: participant2.x+200 , y: participant2.y },
|
||||
{ x: subProcess1.x, y: subProcess1.y+50 }
|
||||
{ x: participant2.x + 200, y: participant2.y },
|
||||
{ x: subProcess1.x, y: subProcess1.y + 50 }
|
||||
];
|
||||
|
||||
// when
|
||||
|
@ -116,7 +113,6 @@ describe('features/modeling - replace connection', function() {
|
|||
|
||||
// then
|
||||
expectConnected(participant2, subProcess1, 'bpmn:MessageFlow');
|
||||
|
||||
}));
|
||||
|
||||
});
|
||||
|
@ -263,7 +259,6 @@ describe('features/modeling - replace connection', function() {
|
|||
|
||||
beforeEach(bootstrapModeler(processDiagramXML, { modules: testModules }));
|
||||
|
||||
|
||||
var element;
|
||||
|
||||
beforeEach(inject(function(elementRegistry) {
|
||||
|
@ -272,7 +267,6 @@ describe('features/modeling - replace connection', function() {
|
|||
};
|
||||
}));
|
||||
|
||||
|
||||
describe('moving text-annotation to participant', function() {
|
||||
|
||||
it('execute', inject(function(modeling, elementRegistry) {
|
||||
|
@ -340,7 +334,6 @@ describe('features/modeling - replace connection', function() {
|
|||
|
||||
// then
|
||||
expectNotConnected(boundaryEvent, taskShape2 ,sequenceFlow);
|
||||
|
||||
}));
|
||||
|
||||
|
||||
|
@ -359,7 +352,6 @@ describe('features/modeling - replace connection', function() {
|
|||
|
||||
// then
|
||||
expectConnected(boundaryEvent, taskShape2, sequenceFlow);
|
||||
|
||||
}));
|
||||
|
||||
|
||||
|
@ -377,7 +369,6 @@ describe('features/modeling - replace connection', function() {
|
|||
|
||||
// then
|
||||
expectNotConnected(taskShape, targetShape, sequenceFlow);
|
||||
|
||||
}));
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue