mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-01-11 17:44:12 +00:00
parent
35564d1bea
commit
d344e679fd
@ -28,9 +28,10 @@ function LabelSupport(eventBus, modeling, bpmnFactory) {
|
|||||||
|
|
||||||
if (hasExternalLabel(businessObject)) {
|
if (hasExternalLabel(businessObject)) {
|
||||||
position = getExternalLabelMid(element);
|
position = getExternalLabelMid(element);
|
||||||
|
|
||||||
modeling.createLabel(element, position, {
|
modeling.createLabel(element, position, {
|
||||||
id: businessObject.id + '_label',
|
id: businessObject.id + '_label',
|
||||||
hidden: true,
|
hidden: !businessObject.name,
|
||||||
businessObject: businessObject
|
businessObject: businessObject
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?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" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn">
|
<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" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn">
|
||||||
<bpmn:process id="Process_1" isExecutable="false">
|
<bpmn:process id="Process_1" isExecutable="false">
|
||||||
<bpmn:startEvent id="StartEvent_1">
|
<bpmn:startEvent id="StartEvent_1" name="KEEP ME">
|
||||||
<bpmn:outgoing>SequenceFlow_1</bpmn:outgoing>
|
<bpmn:outgoing>SequenceFlow_1</bpmn:outgoing>
|
||||||
</bpmn:startEvent>
|
</bpmn:startEvent>
|
||||||
<bpmn:task id="Task_1" name="Task Caption">
|
<bpmn:task id="Task_1" name="Task Caption">
|
||||||
|
@ -245,7 +245,7 @@ describe('features/replace', function() {
|
|||||||
|
|
||||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||||
|
|
||||||
it('should keep copy label',
|
it('should keep interior labels',
|
||||||
inject(function(elementRegistry, bpmnReplace) {
|
inject(function(elementRegistry, bpmnReplace) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
@ -262,6 +262,26 @@ describe('features/replace', function() {
|
|||||||
expect(newElement.businessObject.name).to.equal('Task Caption');
|
expect(newElement.businessObject.name).to.equal('Task Caption');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
it('should keep exterior labels',
|
||||||
|
inject(function(elementRegistry, bpmnReplace) {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var startEvent = elementRegistry.get('StartEvent_1');
|
||||||
|
|
||||||
|
var newElementData = {
|
||||||
|
type: 'bpmn:EndEvent'
|
||||||
|
};
|
||||||
|
|
||||||
|
// when
|
||||||
|
var newElement = bpmnReplace.replaceElement(startEvent, newElementData);
|
||||||
|
|
||||||
|
// then
|
||||||
|
expect(newElement.label.hidden).to.equal(false);
|
||||||
|
expect(newElement.label.labelTarget).to.equal(newElement);
|
||||||
|
expect(newElement.businessObject.name).to.equal('KEEP ME');
|
||||||
|
}));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user