test: verify label wiring
* import * label updating (creation) * label paste
This commit is contained in:
parent
68375a93f1
commit
aceeea7c97
|
@ -389,6 +389,47 @@ describe('features/copy-paste', function() {
|
|||
);
|
||||
|
||||
|
||||
it('should copy label', inject(
|
||||
function(canvas, copyPaste, elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var startEvent = elementRegistry.get('StartEvent_1'),
|
||||
rootElement = canvas.getRootElement();
|
||||
|
||||
copyPaste.copy(startEvent);
|
||||
|
||||
// when
|
||||
var elements = copyPaste.paste({
|
||||
element: rootElement,
|
||||
point: {
|
||||
x: 50,
|
||||
y: 50
|
||||
}
|
||||
});
|
||||
|
||||
// then
|
||||
expect(elements).to.have.length(2);
|
||||
|
||||
var startEventCopy = find(elements, function(element) {
|
||||
return is(element, 'bpmn:StartEvent');
|
||||
});
|
||||
|
||||
var startEventCopyBo = getBusinessObject(startEventCopy);
|
||||
var startEventCopyDi = getDi(startEventCopy);
|
||||
var startEventCopyLabel = startEventCopy.label;
|
||||
|
||||
expect(startEventCopyBo).to.exist;
|
||||
expect(startEventCopyBo.name).to.equal('hello');
|
||||
|
||||
expect(startEventCopyDi).to.exist;
|
||||
expect(startEventCopyLabel).to.exist;
|
||||
|
||||
expect(startEventCopyLabel.di).to.equal(startEventCopyDi);
|
||||
expect(startEventCopyLabel.businessObject).to.equal(startEventCopyBo);
|
||||
}
|
||||
));
|
||||
|
||||
|
||||
it('should copy name property', inject(
|
||||
function(canvas, copyPaste, elementRegistry, modeling) {
|
||||
|
||||
|
|
|
@ -24,12 +24,13 @@ describe('features/modeling - update label', function() {
|
|||
|
||||
// given
|
||||
var startEvent_1 = elementRegistry.get('StartEvent_1');
|
||||
var businessObject = startEvent_1.businessObject;
|
||||
|
||||
// when
|
||||
modeling.updateLabel(startEvent_1, 'bar');
|
||||
|
||||
// then
|
||||
expect(startEvent_1.businessObject.name).to.equal('bar');
|
||||
expect(businessObject.name).to.equal('bar');
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -39,13 +40,20 @@ describe('features/modeling - update label', function() {
|
|||
|
||||
// given
|
||||
var startEvent_2 = elementRegistry.get('StartEvent_2');
|
||||
var businessObject = startEvent_2.businessObject;
|
||||
|
||||
// when
|
||||
modeling.updateLabel(startEvent_2, 'bar');
|
||||
|
||||
// then
|
||||
expect(startEvent_2.businessObject.name).to.equal('bar');
|
||||
expect(startEvent_2.label).to.exist;
|
||||
var label = startEvent_2.label;
|
||||
var di = startEvent_2.di;
|
||||
|
||||
expect(businessObject.name).to.equal('bar');
|
||||
|
||||
expect(label).to.exist;
|
||||
expect(label.businessObject).to.equal(businessObject);
|
||||
expect(label.di).to.equal(di);
|
||||
}
|
||||
));
|
||||
|
||||
|
|
|
@ -106,6 +106,29 @@ describe('import - model wiring', function() {
|
|||
expect(sequenceFlowDi.bpmnElement).to.eql(sequenceFlow);
|
||||
}));
|
||||
|
||||
|
||||
it('should wire label di', inject(function(elementRegistry) {
|
||||
|
||||
// when
|
||||
var eventShape = elementRegistry.get('StartEvent_2');
|
||||
var eventLabel = elementRegistry.get('StartEvent_2_label');
|
||||
|
||||
// assume
|
||||
expect(eventShape).to.exist;
|
||||
expect(eventLabel).to.exist;
|
||||
|
||||
// label relationship wired
|
||||
expect(eventShape.label).to.eql(eventLabel);
|
||||
expect(eventLabel.labelTarget).to.eql(eventShape);
|
||||
|
||||
// moddle relationships wired
|
||||
expect(eventShape.di).to.exist;
|
||||
expect(eventShape.businessObject).to.exist;
|
||||
|
||||
expect(eventShape.di).to.eql(eventLabel.di);
|
||||
expect(eventShape.businessObject).to.eql(eventLabel.businessObject);
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue