mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-02-23 06:08:19 +00:00
style(tests): reformat UpdatePropertiesSpec
* line width = 80
This commit is contained in:
parent
acb2d83856
commit
953574eefb
@ -35,23 +35,31 @@ describe('features/modeling - update properties', function() {
|
|||||||
|
|
||||||
describe('should execute', function() {
|
describe('should execute', function() {
|
||||||
|
|
||||||
it('setting loop characteristics', inject(function(elementRegistry, modeling, moddle) {
|
it('setting loop characteristics', inject(
|
||||||
|
function(elementRegistry, modeling, moddle) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
var loopCharacteristics = moddle.create('bpmn:MultiInstanceLoopCharacteristics');
|
var loopCharacteristics = moddle.create(
|
||||||
|
'bpmn:MultiInstanceLoopCharacteristics'
|
||||||
|
);
|
||||||
|
|
||||||
var taskShape = elementRegistry.get('ServiceTask_1');
|
var taskShape = elementRegistry.get('ServiceTask_1');
|
||||||
|
|
||||||
// when
|
// when
|
||||||
modeling.updateProperties(taskShape, { loopCharacteristics: loopCharacteristics });
|
modeling.updateProperties(taskShape, {
|
||||||
|
loopCharacteristics: loopCharacteristics
|
||||||
|
});
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(taskShape.businessObject.loopCharacteristics).to.eql(loopCharacteristics);
|
expect(
|
||||||
|
taskShape.businessObject.loopCharacteristics
|
||||||
|
).to.eql(loopCharacteristics);
|
||||||
|
|
||||||
|
|
||||||
// task shape got updated
|
// task shape got updated
|
||||||
expect(updatedElements).to.include(taskShape);
|
expect(updatedElements).to.include(taskShape);
|
||||||
}));
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
it('unsetting default flow', inject(function(elementRegistry, modeling) {
|
it('unsetting default flow', inject(function(elementRegistry, modeling) {
|
||||||
@ -87,8 +95,9 @@ describe('features/modeling - update properties', function() {
|
|||||||
expect(updatedElements).to.include(newDefaultFlowConnection);
|
expect(updatedElements).to.include(newDefaultFlowConnection);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it('should keep default flow when reconnecting another sequence flows start',
|
|
||||||
inject(function(elementRegistry, modeling) {
|
it('should keep unchanged default flow untouched', inject(
|
||||||
|
function(elementRegistry, modeling) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
var gatewayShape = elementRegistry.get('ExclusiveGateway_1'),
|
var gatewayShape = elementRegistry.get('ExclusiveGateway_1'),
|
||||||
@ -96,53 +105,66 @@ describe('features/modeling - update properties', function() {
|
|||||||
taskShape = elementRegistry.get('Task_1');
|
taskShape = elementRegistry.get('Task_1');
|
||||||
|
|
||||||
// when
|
// when
|
||||||
modeling.reconnectStart(sequenceFlow, taskShape,
|
modeling.reconnectStart(
|
||||||
{ x: taskShape.x + taskShape.width, y: taskShape.y + taskShape.height / 2 });
|
sequenceFlow,
|
||||||
|
taskShape,
|
||||||
|
{
|
||||||
|
x: taskShape.x + taskShape.width,
|
||||||
|
y: taskShape.y + taskShape.height / 2
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(gatewayShape.businessObject.default).not.to.be.undefined;
|
expect(gatewayShape.businessObject.default).to.exist;
|
||||||
|
}
|
||||||
}));
|
));
|
||||||
|
|
||||||
it('updating conditional flow on source replace', inject(function(bpmnReplace, elementRegistry) {
|
|
||||||
|
|
||||||
//given
|
|
||||||
var conditionalFlow = elementRegistry.get('SequenceFlow_3'),
|
|
||||||
serviceTask = elementRegistry.get('ServiceTask_1');
|
|
||||||
|
|
||||||
var conditionExpression = conditionalFlow.businessObject.conditionExpression;
|
|
||||||
|
|
||||||
var userTaskData = {
|
|
||||||
type: 'bpmn:UserTask'
|
|
||||||
};
|
|
||||||
|
|
||||||
// when
|
|
||||||
bpmnReplace.replaceElement(serviceTask, userTaskData);
|
|
||||||
|
|
||||||
// then
|
|
||||||
expect(conditionalFlow.businessObject.conditionExpression).to.eql(conditionExpression);
|
|
||||||
}));
|
|
||||||
|
|
||||||
|
|
||||||
it('updating conditional flow on target replace', inject(function(bpmnReplace, elementRegistry) {
|
it('updating conditional flow on source replace', inject(
|
||||||
|
function(bpmnReplace, elementRegistry) {
|
||||||
|
|
||||||
//given
|
//given
|
||||||
var conditionalFlow = elementRegistry.get('SequenceFlow_3'),
|
var conditionalFlow = elementRegistry.get('SequenceFlow_3'),
|
||||||
endEvent = elementRegistry.get('EndEvent_1');
|
conditionalBo = conditionalFlow.businessObject,
|
||||||
|
serviceTask = elementRegistry.get('ServiceTask_1');
|
||||||
|
|
||||||
var conditionExpression = conditionalFlow.businessObject.conditionExpression;
|
var conditionExpression = conditionalBo.conditionExpression;
|
||||||
|
|
||||||
var messageEndEventData = {
|
var userTaskData = {
|
||||||
type: 'bpmn:EndEvent',
|
type: 'bpmn:UserTask'
|
||||||
eventDefinitionType: 'bpmn:MessageEventDefinition'
|
};
|
||||||
};
|
|
||||||
|
|
||||||
// when
|
// when
|
||||||
bpmnReplace.replaceElement(endEvent, messageEndEventData);
|
bpmnReplace.replaceElement(serviceTask, userTaskData);
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(conditionalFlow.businessObject.conditionExpression).to.eql(conditionExpression);
|
expect(conditionalBo.conditionExpression).to.eql(conditionExpression);
|
||||||
}));
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
|
it('updating conditional flow on target replace', inject(
|
||||||
|
function(bpmnReplace, elementRegistry) {
|
||||||
|
|
||||||
|
//given
|
||||||
|
var conditionalFlow = elementRegistry.get('SequenceFlow_3'),
|
||||||
|
conditionalBo = conditionalFlow.businessObject,
|
||||||
|
endEvent = elementRegistry.get('EndEvent_1');
|
||||||
|
|
||||||
|
var conditionExpression = conditionalBo.conditionExpression;
|
||||||
|
|
||||||
|
var messageEndEventData = {
|
||||||
|
type: 'bpmn:EndEvent',
|
||||||
|
eventDefinitionType: 'bpmn:MessageEventDefinition'
|
||||||
|
};
|
||||||
|
|
||||||
|
// when
|
||||||
|
bpmnReplace.replaceElement(endEvent, messageEndEventData);
|
||||||
|
|
||||||
|
// then
|
||||||
|
expect(conditionalBo.conditionExpression).to.eql(conditionExpression);
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
it('setting name', inject(function(elementRegistry, modeling) {
|
it('setting name', inject(function(elementRegistry, modeling) {
|
||||||
@ -173,7 +195,7 @@ describe('features/modeling - update properties', function() {
|
|||||||
expect(flowConnection.businessObject.name).to.equal('FOO BAR');
|
expect(flowConnection.businessObject.name).to.equal('FOO BAR');
|
||||||
|
|
||||||
// flow label got updated, too
|
// flow label got updated, too
|
||||||
expect(updatedElements).to.include(elementRegistry.get('SequenceFlow_1_label'));
|
expect(updatedElements).to.include(flowConnection.label);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
@ -196,48 +218,58 @@ describe('features/modeling - update properties', function() {
|
|||||||
it('updating id', inject(function(elementRegistry, modeling) {
|
it('updating id', inject(function(elementRegistry, modeling) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
var flowConnection = elementRegistry.get('SequenceFlow_1');
|
var flowConnection = elementRegistry.get('SequenceFlow_1'),
|
||||||
var ids = flowConnection.businessObject.$model.ids;
|
flowBo = flowConnection.businessObject;
|
||||||
|
|
||||||
|
var ids = flowBo.$model.ids;
|
||||||
|
|
||||||
// when
|
// when
|
||||||
modeling.updateProperties(flowConnection, { id: 'FOO_BAR' });
|
modeling.updateProperties(flowConnection, { id: 'FOO_BAR' });
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(ids.assigned('FOO_BAR')).to.eql(flowConnection.businessObject);
|
expect(ids.assigned('FOO_BAR')).to.eql(flowBo);
|
||||||
expect(ids.assigned('SequenceFlow_1')).to.be.false;
|
expect(ids.assigned('SequenceFlow_1')).to.be.false;
|
||||||
|
|
||||||
expect(flowConnection.businessObject.id).to.equal('FOO_BAR');
|
expect(flowBo.id).to.equal('FOO_BAR');
|
||||||
expect(flowConnection.id).to.equal('FOO_BAR');
|
expect(flowConnection.id).to.equal('FOO_BAR');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
it('updating extension elements', inject(function(elementRegistry, modeling) {
|
it('updating extension elements', inject(
|
||||||
|
function(elementRegistry, modeling) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
var flowConnection = elementRegistry.get('SequenceFlow_1');
|
var flowConnection = elementRegistry.get('SequenceFlow_1'),
|
||||||
|
flowBo = flowConnection.businessObject;
|
||||||
|
|
||||||
// when
|
// when
|
||||||
modeling.updateProperties(flowConnection, {
|
modeling.updateProperties(flowConnection, {
|
||||||
'xmlns:foo': 'http://foo',
|
'xmlns:foo': 'http://foo',
|
||||||
'foo:customAttr': 'FOO'
|
'foo:customAttr': 'FOO'
|
||||||
});
|
});
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(flowConnection.businessObject.get('xmlns:foo')).to.equal('http://foo');
|
expect(flowBo.get('xmlns:foo')).to.equal('http://foo');
|
||||||
expect(flowConnection.businessObject.get('foo:customAttr')).to.equal('FOO');
|
expect(flowBo.get('foo:customAttr')).to.equal('FOO');
|
||||||
}));
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
it('setting di properties', inject(function(elementRegistry, modeling) {
|
it('setting di properties', inject(function(elementRegistry, modeling) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
var flowConnection = elementRegistry.get('SequenceFlow_1');
|
var flowConnection = elementRegistry.get('SequenceFlow_1'),
|
||||||
|
flowBo = flowConnection.businessObject;
|
||||||
|
|
||||||
// when
|
// when
|
||||||
modeling.updateProperties(flowConnection, { di: { fill: 'FUCHSIA' } });
|
modeling.updateProperties(flowConnection, {
|
||||||
|
di: {
|
||||||
|
fill: 'FUCHSIA'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(flowConnection.businessObject.di.fill).to.equal('FUCHSIA');
|
expect(flowBo.di.fill).to.equal('FUCHSIA');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
@ -259,99 +291,119 @@ describe('features/modeling - update properties', function() {
|
|||||||
|
|
||||||
describe('should undo', function() {
|
describe('should undo', function() {
|
||||||
|
|
||||||
it('setting loop characteristics', inject(function(elementRegistry, modeling, commandStack, moddle) {
|
it('setting loop characteristics', inject(
|
||||||
|
function(elementRegistry, modeling, commandStack, moddle) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
var loopCharactersistics = moddle.create('bpmn:MultiInstanceLoopCharacteristics');
|
var loopCharactersistics = moddle.create('bpmn:MultiInstanceLoopCharacteristics');
|
||||||
|
|
||||||
var taskShape = elementRegistry.get('ServiceTask_1');
|
var taskShape = elementRegistry.get('ServiceTask_1');
|
||||||
|
|
||||||
// when
|
// when
|
||||||
modeling.updateProperties(taskShape, { loopCharacteristics: loopCharactersistics });
|
modeling.updateProperties(taskShape, { loopCharacteristics: loopCharactersistics });
|
||||||
commandStack.undo();
|
commandStack.undo();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(taskShape.businessObject.loopCharactersistics).not.to.exist;
|
expect(taskShape.businessObject.loopCharactersistics).not.to.exist;
|
||||||
}));
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
it('unsetting default flow', inject(function(elementRegistry, commandStack, modeling) {
|
it('unsetting default flow', inject(
|
||||||
|
function(elementRegistry, commandStack, modeling) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
var gatewayShape = elementRegistry.get('ExclusiveGateway_1'),
|
var gatewayShape = elementRegistry.get('ExclusiveGateway_1'),
|
||||||
oldDefaultFlow = gatewayShape.businessObject['default'];
|
gatewayBo = gatewayShape.businessObject,
|
||||||
|
oldDefaultBo = gatewayShape.businessObject['default'],
|
||||||
|
oldDefaultConnection = elementRegistry.get(oldDefaultBo.id);
|
||||||
|
|
||||||
// when
|
// when
|
||||||
modeling.updateProperties(gatewayShape, { 'default': undefined });
|
modeling.updateProperties(gatewayShape, {
|
||||||
commandStack.undo();
|
'default': undefined
|
||||||
|
});
|
||||||
|
|
||||||
// then
|
commandStack.undo();
|
||||||
expect(gatewayShape.businessObject['default']).to.eql(oldDefaultFlow);
|
|
||||||
|
|
||||||
// flow got updated, too
|
// then
|
||||||
expect(updatedElements).to.include(elementRegistry.get(oldDefaultFlow.id));
|
expect(gatewayBo['default']).to.eql(oldDefaultBo);
|
||||||
}));
|
|
||||||
|
// flow got updated, too
|
||||||
|
expect(updatedElements).to.include(oldDefaultConnection);
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
it('updating default flow', inject(function(elementRegistry, commandStack, modeling) {
|
it('updating default flow', inject(
|
||||||
|
function(elementRegistry, commandStack, modeling) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
var gatewayShape = elementRegistry.get('ExclusiveGateway_1'),
|
var gatewayShape = elementRegistry.get('ExclusiveGateway_1'),
|
||||||
newDefaultFlowConnection = elementRegistry.get('SequenceFlow_2'),
|
gatewayBo = gatewayShape.businessObject,
|
||||||
newDefaultFlow = newDefaultFlowConnection.businessObject,
|
newDefaultFlowConnection = elementRegistry.get('SequenceFlow_2'),
|
||||||
oldDefaultFlowConnection = elementRegistry.get('SequenceFlow_1'),
|
newDefaultFlow = newDefaultFlowConnection.businessObject,
|
||||||
oldDefaultFlow = oldDefaultFlowConnection.businessObject;
|
oldDefaultFlowConnection = elementRegistry.get('SequenceFlow_1'),
|
||||||
|
oldDefaultFlow = oldDefaultFlowConnection.businessObject;
|
||||||
|
|
||||||
// when
|
// when
|
||||||
modeling.updateProperties(gatewayShape, { 'default': newDefaultFlow });
|
modeling.updateProperties(gatewayShape, {
|
||||||
commandStack.undo();
|
'default': newDefaultFlow
|
||||||
|
});
|
||||||
|
commandStack.undo();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(gatewayShape.businessObject['default']).to.eql(oldDefaultFlow);
|
expect(gatewayBo['default']).to.eql(oldDefaultFlow);
|
||||||
|
|
||||||
// flow got updated, too
|
// flow got updated, too
|
||||||
expect(updatedElements).to.include(newDefaultFlowConnection);
|
expect(updatedElements).to.include(newDefaultFlowConnection);
|
||||||
expect(updatedElements).to.include(oldDefaultFlowConnection);
|
expect(updatedElements).to.include(oldDefaultFlowConnection);
|
||||||
}));
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
it('updating name', inject(function(elementRegistry, commandStack, modeling) {
|
it('updating name', inject(
|
||||||
|
function(elementRegistry, commandStack, modeling) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
var flowConnection = elementRegistry.get('SequenceFlow_1');
|
var flowConnection = elementRegistry.get('SequenceFlow_1');
|
||||||
|
|
||||||
// when
|
// when
|
||||||
modeling.updateProperties(flowConnection, { name: 'FOO BAR' });
|
modeling.updateProperties(flowConnection, { name: 'FOO BAR' });
|
||||||
commandStack.undo();
|
commandStack.undo();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(flowConnection.businessObject.name).to.equal('default');
|
expect(flowConnection.businessObject.name).to.equal('default');
|
||||||
|
|
||||||
// flow got updated, too
|
// flow got updated, too
|
||||||
expect(updatedElements).to.include(elementRegistry.get('SequenceFlow_1_label'));
|
expect(updatedElements).to.include(flowConnection.label);
|
||||||
}));
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
it('unsetting name', inject(function(elementRegistry, commandStack, modeling) {
|
it('unsetting name', inject(
|
||||||
|
function(elementRegistry, commandStack, modeling) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
var flowConnection = elementRegistry.get('SequenceFlow_3');
|
var flowConnection = elementRegistry.get('SequenceFlow_3');
|
||||||
|
|
||||||
modeling.updateProperties(flowConnection, { name: undefined });
|
modeling.updateProperties(flowConnection, { name: undefined });
|
||||||
|
|
||||||
// when
|
// when
|
||||||
commandStack.undo();
|
commandStack.undo();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(flowConnection.businessObject.name).to.equal('conditional');
|
expect(flowConnection.businessObject.name).to.equal('conditional');
|
||||||
}));
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
it('updating id', inject(function(elementRegistry, commandStack, modeling) {
|
it('updating id', inject(function(elementRegistry, commandStack, modeling) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
var flowConnection = elementRegistry.get('SequenceFlow_1');
|
var flowConnection = elementRegistry.get('SequenceFlow_1'),
|
||||||
var ids = flowConnection.businessObject.$model.ids;
|
flowBo = flowConnection.businessObject;
|
||||||
|
|
||||||
|
var ids = flowBo.$model.ids;
|
||||||
|
|
||||||
// when
|
// when
|
||||||
modeling.updateProperties(flowConnection, { id: 'FOO_BAR' });
|
modeling.updateProperties(flowConnection, { id: 'FOO_BAR' });
|
||||||
@ -359,144 +411,172 @@ describe('features/modeling - update properties', function() {
|
|||||||
|
|
||||||
// then
|
// then
|
||||||
expect(ids.assigned('FOO_BAR')).to.be.false;
|
expect(ids.assigned('FOO_BAR')).to.be.false;
|
||||||
expect(ids.assigned('SequenceFlow_1')).to.eql(flowConnection.businessObject);
|
expect(ids.assigned('SequenceFlow_1')).to.eql(flowBo);
|
||||||
|
|
||||||
expect(flowConnection.businessObject.id).to.equal('SequenceFlow_1');
|
|
||||||
expect(flowConnection.id).to.equal('SequenceFlow_1');
|
expect(flowConnection.id).to.equal('SequenceFlow_1');
|
||||||
|
expect(flowBo.id).to.equal('SequenceFlow_1');
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
||||||
it('updating extension elements', inject(function(elementRegistry, commandStack, modeling) {
|
it('updating extension elements', inject(
|
||||||
|
function(elementRegistry, commandStack, modeling) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
var flowConnection = elementRegistry.get('SequenceFlow_1');
|
var flowConnection = elementRegistry.get('SequenceFlow_1'),
|
||||||
|
flowBo = flowConnection.businessObject;
|
||||||
|
|
||||||
modeling.updateProperties(flowConnection, {
|
modeling.updateProperties(flowConnection, {
|
||||||
'xmlns:foo': 'http://foo',
|
'xmlns:foo': 'http://foo',
|
||||||
'foo:customAttr': 'FOO'
|
'foo:customAttr': 'FOO'
|
||||||
});
|
});
|
||||||
|
|
||||||
// when
|
// when
|
||||||
commandStack.undo();
|
commandStack.undo();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(flowConnection.businessObject.get('xmlns:foo')).not.to.exist;
|
expect(flowBo.get('xmlns:foo')).not.to.exist;
|
||||||
expect(flowConnection.businessObject.get('foo:customAttr')).not.to.exist;
|
expect(flowBo.get('foo:customAttr')).not.to.exist;
|
||||||
}));
|
}
|
||||||
|
));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
describe('should redo', function() {
|
describe('should redo', function() {
|
||||||
|
|
||||||
it('setting loop characteristics', inject(function(elementRegistry, modeling, commandStack, moddle) {
|
it('setting loop characteristics', inject(
|
||||||
|
function(elementRegistry, modeling, commandStack, moddle) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
var loopCharacteristics = moddle.create('bpmn:MultiInstanceLoopCharacteristics');
|
var loopCharacteristics = moddle.create(
|
||||||
|
'bpmn:MultiInstanceLoopCharacteristics'
|
||||||
|
);
|
||||||
|
|
||||||
var taskShape = elementRegistry.get('ServiceTask_1');
|
var taskShape = elementRegistry.get('ServiceTask_1'),
|
||||||
|
taskBo = taskShape.businessObject;
|
||||||
|
|
||||||
// when
|
// when
|
||||||
modeling.updateProperties(taskShape, { loopCharacteristics: loopCharacteristics });
|
modeling.updateProperties(taskShape, {
|
||||||
commandStack.undo();
|
loopCharacteristics: loopCharacteristics
|
||||||
commandStack.redo();
|
});
|
||||||
|
commandStack.undo();
|
||||||
|
commandStack.redo();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(taskShape.businessObject.loopCharacteristics).to.eql(loopCharacteristics);
|
expect(taskBo.loopCharacteristics).to.eql(loopCharacteristics);
|
||||||
}));
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
it('updating default flow', inject(function(elementRegistry, commandStack, modeling) {
|
it('updating default flow', inject(
|
||||||
|
function(elementRegistry, commandStack, modeling) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
var gatewayShape = elementRegistry.get('ExclusiveGateway_1');
|
var gatewayShape = elementRegistry.get('ExclusiveGateway_1');
|
||||||
|
|
||||||
// when
|
// when
|
||||||
modeling.updateProperties(gatewayShape, { 'default': undefined });
|
modeling.updateProperties(gatewayShape, { 'default': undefined });
|
||||||
commandStack.undo();
|
commandStack.undo();
|
||||||
commandStack.redo();
|
commandStack.redo();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(gatewayShape.businessObject['default']).not.to.exist;
|
expect(gatewayShape.businessObject['default']).not.to.exist;
|
||||||
|
|
||||||
// flow got updated, too
|
// flow got updated, too
|
||||||
expect(updatedElements).to.include(elementRegistry.get('SequenceFlow_1'));
|
expect(updatedElements).to.include(
|
||||||
}));
|
elementRegistry.get('SequenceFlow_1')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
it('updating name', inject(function(elementRegistry, commandStack, modeling) {
|
it('updating name', inject(
|
||||||
|
function(elementRegistry, commandStack, modeling) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
var flowConnection = elementRegistry.get('SequenceFlow_1');
|
var flowConnection = elementRegistry.get('SequenceFlow_1');
|
||||||
|
|
||||||
// when
|
// when
|
||||||
modeling.updateProperties(flowConnection, { name: 'FOO BAR' });
|
modeling.updateProperties(flowConnection, { name: 'FOO BAR' });
|
||||||
commandStack.undo();
|
commandStack.undo();
|
||||||
commandStack.redo();
|
commandStack.redo();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(flowConnection.businessObject.name).to.equal('FOO BAR');
|
expect(flowConnection.businessObject.name).to.equal('FOO BAR');
|
||||||
|
|
||||||
// flow got updated, too
|
// flow got updated, too
|
||||||
expect(updatedElements).to.include(elementRegistry.get('SequenceFlow_1_label'));
|
expect(updatedElements).to.include(flowConnection.label);
|
||||||
}));
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
|
||||||
it('unsetting name', inject(function(elementRegistry, commandStack, modeling) {
|
it('unsetting name', inject(
|
||||||
|
function(elementRegistry, commandStack, modeling) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
var flowConnection = elementRegistry.get('SequenceFlow_3');
|
var flowConnection = elementRegistry.get('SequenceFlow_3');
|
||||||
|
|
||||||
modeling.updateProperties(flowConnection, { name: undefined });
|
modeling.updateProperties(flowConnection, { name: undefined });
|
||||||
|
|
||||||
// when
|
// when
|
||||||
commandStack.undo();
|
commandStack.undo();
|
||||||
commandStack.redo();
|
commandStack.redo();
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(flowConnection.businessObject.name).not.to.exist;
|
expect(flowConnection.businessObject.name).not.to.exist;
|
||||||
}));
|
}
|
||||||
|
));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
describe('unwrap diagram elements', function() {
|
describe('unwrap diagram elements', function() {
|
||||||
|
|
||||||
it('updating default flow with connection', inject(function(elementRegistry, modeling) {
|
it('updating default flow with connection', inject(
|
||||||
|
function(elementRegistry, modeling) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
var gatewayShape = elementRegistry.get('ExclusiveGateway_1'),
|
var gatewayShape = elementRegistry.get('ExclusiveGateway_1'),
|
||||||
newDefaultFlowConnection = elementRegistry.get('SequenceFlow_2');
|
newDefaultFlowConnection = elementRegistry.get('SequenceFlow_2');
|
||||||
|
|
||||||
// when
|
// when
|
||||||
modeling.updateProperties(gatewayShape, { 'default': newDefaultFlowConnection });
|
modeling.updateProperties(gatewayShape, {
|
||||||
|
'default': newDefaultFlowConnection
|
||||||
|
});
|
||||||
|
|
||||||
// then
|
// then
|
||||||
expect(gatewayShape.businessObject['default']).to.eql(newDefaultFlowConnection.businessObject);
|
expect(gatewayShape.businessObject['default']).to.eql(
|
||||||
|
newDefaultFlowConnection.businessObject
|
||||||
|
);
|
||||||
|
|
||||||
// flow got updated, too
|
// flow got updated, too
|
||||||
expect(updatedElements).to.include(newDefaultFlowConnection);
|
expect(updatedElements).to.include(newDefaultFlowConnection);
|
||||||
}));
|
}
|
||||||
|
));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
describe('error handling', function() {
|
describe('error handling', function() {
|
||||||
|
|
||||||
it('should ignore unchanged id', inject(function(elementRegistry, modeling) {
|
it('should ignore unchanged id', inject(
|
||||||
|
function(elementRegistry, modeling) {
|
||||||
|
|
||||||
// given
|
// given
|
||||||
var flowConnection = elementRegistry.get('SequenceFlow_1');
|
var flowConnection = elementRegistry.get('SequenceFlow_1'),
|
||||||
var ids = flowConnection.businessObject.$model.ids;
|
flowBo = flowConnection.businessObject;
|
||||||
|
|
||||||
// when
|
var ids = flowBo.$model.ids;
|
||||||
modeling.updateProperties(flowConnection, { id: 'SequenceFlow_1' });
|
|
||||||
|
|
||||||
// then
|
// when
|
||||||
expect(ids.assigned('SequenceFlow_1')).to.eql(flowConnection.businessObject);
|
modeling.updateProperties(flowConnection, { id: 'SequenceFlow_1' });
|
||||||
|
|
||||||
expect(flowConnection.businessObject.id).to.equal('SequenceFlow_1');
|
// then
|
||||||
}));
|
expect(ids.assigned('SequenceFlow_1')).to.eql(flowBo);
|
||||||
|
|
||||||
|
expect(flowBo.id).to.equal('SequenceFlow_1');
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user