test: adjust to use `getDi` utility function
Related to https://github.com/bpmn-io/bpmn-js/issues/1472
This commit is contained in:
parent
6a5e1e9f7d
commit
1551bd47a6
|
@ -3,7 +3,7 @@ import {
|
|||
} from 'min-dash';
|
||||
|
||||
import {
|
||||
getBusinessObject
|
||||
getDi
|
||||
} from 'lib/util/ModelUtil';
|
||||
|
||||
var BOUNDS_ATTRS = [ 'x', 'y', 'width', 'height' ],
|
||||
|
@ -82,11 +82,11 @@ export default function(chai, utils) {
|
|||
Assertion.addMethod('diBounds', function(exp) {
|
||||
var obj = this._obj;
|
||||
|
||||
var bo = getBusinessObject(obj);
|
||||
var di = getDi(obj);
|
||||
|
||||
expect(bo).to.have.property('di');
|
||||
expect(di).to.exist;
|
||||
|
||||
assertBounds(this, bo.id + '#di', getBounds(bo.di), getBounds(exp));
|
||||
assertBounds(this, di.id, getBounds(di), getBounds(exp));
|
||||
});
|
||||
|
||||
/**
|
||||
|
@ -125,11 +125,11 @@ export default function(chai, utils) {
|
|||
|
||||
var obj = this._obj;
|
||||
|
||||
var bo = getBusinessObject(obj);
|
||||
var di = getDi(obj);
|
||||
|
||||
expect(bo).to.have.property('di');
|
||||
expect(di).to.exist;
|
||||
|
||||
assertDimensions(this, bo.id + '#di', getDimensions(bo.di), getDimensions(exp));
|
||||
assertDimensions(this, di.id, getDimensions(di), getDimensions(exp));
|
||||
});
|
||||
|
||||
|
||||
|
@ -169,11 +169,11 @@ export default function(chai, utils) {
|
|||
|
||||
var obj = this._obj;
|
||||
|
||||
var bo = getBusinessObject(obj);
|
||||
var di = getDi(obj);
|
||||
|
||||
expect(bo).to.have.property('di');
|
||||
expect(di).to.exist;
|
||||
|
||||
assertPosition(this, bo.id + '#di', getPosition(bo.di), getPosition(exp));
|
||||
assertPosition(this, di.id, getPosition(di), getPosition(exp));
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ import {
|
|||
} from 'min-dash';
|
||||
|
||||
import {
|
||||
getBusinessObject
|
||||
getDi
|
||||
} from 'lib/util/ModelUtil';
|
||||
|
||||
var POSITION_ATTRS = [ 'x', 'y' ];
|
||||
|
@ -61,13 +61,13 @@ export default function(chai, utils) {
|
|||
Assertion.addMethod('diWaypoints', function(exp) {
|
||||
var obj = this._obj;
|
||||
|
||||
var bo = getBusinessObject(obj);
|
||||
var di = getDi(obj);
|
||||
|
||||
expect(bo).to.have.property('di');
|
||||
expect(di).to.exist;
|
||||
|
||||
expect(bo.di).to.have.property('waypoint');
|
||||
expect(di).to.have.property('waypoint');
|
||||
|
||||
assertWaypoints(this, obj.id + '#di#waypoint', getPoints(bo.di.waypoint), getPoints(exp));
|
||||
assertWaypoints(this, di + '#waypoint', getPoints(di.waypoint), getPoints(exp));
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -14,6 +14,8 @@ import {
|
|||
collectTranslations
|
||||
} from 'test/TestHelper';
|
||||
|
||||
import { getDi } from 'lib/util/ModelUtil';
|
||||
|
||||
|
||||
var singleStart = window.__env__ && window.__env__.SINGLE_START === 'modeler';
|
||||
|
||||
|
@ -413,7 +415,7 @@ describe('Modeler', function() {
|
|||
return modeler.importXML(xml).then(function() {
|
||||
|
||||
var subProcess = elementRegistry.get('SubProcess_1').businessObject;
|
||||
var bpmnEdge = elementRegistry.get('SequenceFlow_3').businessObject.di;
|
||||
var bpmnEdge = getDi(elementRegistry.get('SequenceFlow_3'));
|
||||
|
||||
// then
|
||||
expect(moddle.ids.assigned('SubProcess_1')).to.eql(subProcess);
|
||||
|
|
|
@ -12,6 +12,8 @@ import {
|
|||
createViewer
|
||||
} from 'test/TestHelper';
|
||||
|
||||
import { getDi } from 'lib/util/ModelUtil';
|
||||
|
||||
var singleStart = window.__env__ && window.__env__.SINGLE_START === 'viewer';
|
||||
|
||||
|
||||
|
@ -960,13 +962,13 @@ describe('Viewer', function() {
|
|||
|
||||
expect(err).not.to.exist;
|
||||
|
||||
renderedDiagram = viewer.get('canvas').getRootElement().businessObject.di;
|
||||
renderedDiagram = getDi(viewer.get('canvas').getRootElement());
|
||||
|
||||
return viewer.open();
|
||||
}).then(function() {
|
||||
|
||||
// then
|
||||
expect(viewer.get('canvas').getRootElement().businessObject.di).to.equal(renderedDiagram);
|
||||
expect(getDi(viewer.get('canvas').getRootElement())).to.equal(renderedDiagram);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -1715,28 +1717,6 @@ describe('Viewer', function() {
|
|||
expect(clearDiagram).to.not.throw();
|
||||
});
|
||||
|
||||
|
||||
it('should remove di property', function() {
|
||||
|
||||
var xml = require('../fixtures/bpmn/simple.bpmn');
|
||||
|
||||
var viewer = new Viewer({ container: container }),
|
||||
elementRegistry = viewer.get('elementRegistry');
|
||||
|
||||
return viewer.importXML(xml).then(function(result) {
|
||||
|
||||
var elements = elementRegistry.getAll();
|
||||
|
||||
// when
|
||||
viewer.clear();
|
||||
|
||||
// then
|
||||
expect(elements.some(function(el) {
|
||||
return el && el.businessObject && el.businessObject.di;
|
||||
}), 'at least one element still has di').to.be.false;
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
@ -1976,11 +1956,11 @@ describe('Viewer', function() {
|
|||
|
||||
expect(err).not.to.exist;
|
||||
|
||||
renderedDiagram = viewer.get('canvas').getRootElement().businessObject.di;
|
||||
renderedDiagram = getDi(viewer.get('canvas').getRootElement());
|
||||
|
||||
viewer.open(function(err) {
|
||||
|
||||
expect(viewer.get('canvas').getRootElement().businessObject.di).to.equal(renderedDiagram);
|
||||
expect(getDi(viewer.get('canvas').getRootElement())).to.equal(renderedDiagram);
|
||||
|
||||
done(err);
|
||||
});
|
||||
|
|
|
@ -24,6 +24,7 @@ import {
|
|||
|
||||
import {
|
||||
getBusinessObject,
|
||||
getDi,
|
||||
is
|
||||
} from 'lib/util/ModelUtil';
|
||||
|
||||
|
@ -376,14 +377,14 @@ describe('features/copy-paste', function() {
|
|||
return is(element, 'bpmn:Task');
|
||||
});
|
||||
|
||||
var taskBo = getBusinessObject(task);
|
||||
var di = getDi(task);
|
||||
|
||||
expect(taskBo.di.get('background-color')).to.equal(fill);
|
||||
expect(taskBo.di.get('border-color')).to.equal(stroke);
|
||||
expect(di.get('background-color')).to.equal(fill);
|
||||
expect(di.get('border-color')).to.equal(stroke);
|
||||
|
||||
// TODO @barmac: remove when we drop bpmn.io properties
|
||||
expect(taskBo.di.fill).to.equal(fill);
|
||||
expect(taskBo.di.stroke).to.equal(stroke);
|
||||
expect(di.fill).to.equal(fill);
|
||||
expect(di.stroke).to.equal(stroke);
|
||||
})
|
||||
);
|
||||
|
||||
|
|
|
@ -7,6 +7,10 @@ import {
|
|||
find
|
||||
} from 'min-dash';
|
||||
|
||||
import {
|
||||
getDi
|
||||
} from 'lib/util/ModelUtil';
|
||||
|
||||
import modelingModule from 'lib/features/modeling';
|
||||
import coreModule from 'lib/core';
|
||||
|
||||
|
@ -41,17 +45,17 @@ describe('features/modeling - append shape', function() {
|
|||
// given
|
||||
var startEventShape = elementRegistry.get('StartEvent_1');
|
||||
|
||||
var startEvent = startEventShape.businessObject;
|
||||
var startEventDi = getDi(startEventShape);
|
||||
|
||||
// when
|
||||
var targetShape = modeling.appendShape(startEventShape, { type: 'bpmn:Task' }),
|
||||
target = targetShape.businessObject;
|
||||
targetDi = getDi(targetShape);
|
||||
|
||||
// then
|
||||
expect(target.di).to.exist;
|
||||
expect(target.di.$parent).to.eql(startEvent.di.$parent);
|
||||
expect(targetDi).to.exist;
|
||||
expect(targetDi.$parent).to.eql(startEventDi.$parent);
|
||||
|
||||
expect(target.di).to.have.bounds(targetShape);
|
||||
expect(targetDi).to.have.bounds(targetShape);
|
||||
}));
|
||||
|
||||
|
||||
|
@ -105,17 +109,19 @@ describe('features/modeling - append shape', function() {
|
|||
var startEventShape = elementRegistry.get('StartEvent_1'),
|
||||
subProcessShape = elementRegistry.get('SubProcess_1');
|
||||
|
||||
var subProcess = subProcessShape.businessObject;
|
||||
var subProcess = subProcessShape.businessObject,
|
||||
subProcessDi = getDi(subProcessShape);
|
||||
|
||||
var targetShape = modeling.appendShape(startEventShape, { type: 'bpmn:Task' }),
|
||||
target = targetShape.businessObject;
|
||||
target = targetShape.businessObject,
|
||||
targetDi = getDi(targetShape);
|
||||
|
||||
// when
|
||||
commandStack.undo();
|
||||
|
||||
// then
|
||||
expect(subProcess.get('flowElements')).not.to.include(target);
|
||||
expect(subProcess.di.$parent.get('planeElement')).not.to.include(target.di);
|
||||
expect(subProcessDi.$parent.get('planeElement')).not.to.include(targetDi);
|
||||
}));
|
||||
|
||||
|
||||
|
@ -126,14 +132,17 @@ describe('features/modeling - append shape', function() {
|
|||
subProcessShape = elementRegistry.get('SubProcess_1');
|
||||
|
||||
var startEvent = startEventShape.businessObject,
|
||||
startEventDi = getDi(startEventShape),
|
||||
subProcess = subProcessShape.businessObject;
|
||||
|
||||
var targetShape = modeling.appendShape(startEventShape, { type: 'bpmn:EndEvent' }),
|
||||
target = targetShape.businessObject;
|
||||
|
||||
var connection = find(subProcess.get('flowElements'), function(e) {
|
||||
return e.sourceRef === startEvent && e.targetRef === target;
|
||||
});
|
||||
return e.sourceRef === startEvent && e.targetRef === target;
|
||||
}),
|
||||
connectionDi = getDi(connection);
|
||||
|
||||
|
||||
// when
|
||||
commandStack.undo();
|
||||
|
@ -142,7 +151,7 @@ describe('features/modeling - append shape', function() {
|
|||
expect(connection.sourceRef).to.be.null;
|
||||
expect(connection.targetRef).to.be.null;
|
||||
expect(connection.$parent).to.be.null;
|
||||
expect(subProcess.di.$parent.get('planeElement')).not.to.include(connection.di);
|
||||
expect(startEventDi.$parent.get('planeElement')).not.to.include(connectionDi);
|
||||
|
||||
expect(targetShape.label).not.to.exist;
|
||||
expect(elementRegistry.get(target.id + '_label')).not.to.exist;
|
||||
|
@ -156,14 +165,16 @@ describe('features/modeling - append shape', function() {
|
|||
var subProcessShape = elementRegistry.get('SubProcess_1');
|
||||
|
||||
var startEvent = startEventShape.businessObject,
|
||||
subProcess = subProcessShape.businessObject;
|
||||
subProcess = subProcessShape.businessObject,
|
||||
subProcessDi = getDi(subProcessShape);
|
||||
|
||||
var targetShape = modeling.appendShape(startEventShape, { type: 'bpmn:Task' }),
|
||||
target = targetShape.businessObject;
|
||||
|
||||
var connection = find(subProcess.get('flowElements'), function(e) {
|
||||
return e.sourceRef === startEvent && e.targetRef === target;
|
||||
});
|
||||
return e.sourceRef === startEvent && e.targetRef === target;
|
||||
}),
|
||||
connectionDi = getDi(connection);
|
||||
|
||||
// when
|
||||
commandStack.undo();
|
||||
|
@ -176,7 +187,7 @@ describe('features/modeling - append shape', function() {
|
|||
expect(target.get('incoming')).not.to.include(connection);
|
||||
|
||||
expect(connection.$parent).to.be.null;
|
||||
expect(subProcess.di.$parent.get('planeElement')).not.to.include(connection.di);
|
||||
expect(subProcessDi.$parent.get('planeElement')).not.to.include(connectionDi);
|
||||
|
||||
expect(elementRegistry.get(targetShape.id)).not.to.exist;
|
||||
}));
|
||||
|
@ -189,14 +200,16 @@ describe('features/modeling - append shape', function() {
|
|||
var subProcessShape = elementRegistry.get('SubProcess_1');
|
||||
|
||||
var startEvent = startEventShape.businessObject,
|
||||
subProcess = subProcessShape.businessObject;
|
||||
subProcess = subProcessShape.businessObject,
|
||||
subProcessDi = getDi(subProcessShape);
|
||||
|
||||
var targetShape = modeling.appendShape(startEventShape, { type: 'bpmn:Task' }),
|
||||
target = targetShape.businessObject;
|
||||
|
||||
var connection = find(subProcess.get('flowElements'), function(e) {
|
||||
return e.sourceRef === startEvent && e.targetRef === target;
|
||||
});
|
||||
return e.sourceRef === startEvent && e.targetRef === target;
|
||||
}),
|
||||
connectionDi = getDi(connection);
|
||||
|
||||
// when
|
||||
commandStack.undo();
|
||||
|
@ -205,7 +218,7 @@ describe('features/modeling - append shape', function() {
|
|||
expect(connection.sourceRef).to.be.null;
|
||||
expect(connection.targetRef).to.be.null;
|
||||
expect(connection.$parent).to.be.null;
|
||||
expect(subProcess.di.$parent.get('planeElement')).not.to.include(connection.di);
|
||||
expect(subProcessDi.$parent.get('planeElement')).not.to.include(connectionDi);
|
||||
|
||||
expect(elementRegistry.get(connection.id + '_label')).not.to.exist;
|
||||
}));
|
||||
|
@ -248,14 +261,16 @@ describe('features/modeling - append shape', function() {
|
|||
var subProcessShape = elementRegistry.get('SubProcess_1');
|
||||
|
||||
var startEvent = startEventShape.businessObject,
|
||||
subProcess = subProcessShape.businessObject;
|
||||
subProcess = subProcessShape.businessObject,
|
||||
subProcessDi = getDi(subProcessShape);
|
||||
|
||||
var targetShape = modeling.appendShape(startEventShape, { type: 'bpmn:Task' }),
|
||||
target = targetShape.businessObject;
|
||||
|
||||
var connection = find(subProcess.get('flowElements'), function(e) {
|
||||
return e.sourceRef === startEvent && e.targetRef === target;
|
||||
});
|
||||
return e.sourceRef === startEvent && e.targetRef === target;
|
||||
}),
|
||||
connectionDi = getDi(connection);
|
||||
|
||||
// when
|
||||
commandStack.undo();
|
||||
|
@ -267,7 +282,7 @@ describe('features/modeling - append shape', function() {
|
|||
expect(connection.targetRef).to.be.null;
|
||||
expect(connection.$parent).to.be.null;
|
||||
|
||||
expect(subProcess.di.$parent.get('planeElement')).not.to.include(connection.di);
|
||||
expect(subProcessDi.$parent.get('planeElement')).not.to.include(connectionDi);
|
||||
}));
|
||||
|
||||
});
|
||||
|
@ -315,17 +330,19 @@ describe('features/modeling - append shape', function() {
|
|||
var startEventShape = elementRegistry.get('StartEvent_1');
|
||||
var subProcessShape = elementRegistry.get('SubProcess_1');
|
||||
|
||||
var subProcess = subProcessShape.businessObject;
|
||||
var subProcess = subProcessShape.businessObject,
|
||||
subProcessDi = getDi(subProcessShape);
|
||||
|
||||
var targetShape = modeling.appendShape(startEventShape, { type: 'bpmn:ExclusiveGateway' }),
|
||||
target = targetShape.businessObject;
|
||||
target = targetShape.businessObject,
|
||||
targetDi = getDi(targetShape);
|
||||
|
||||
// when
|
||||
commandStack.undo();
|
||||
|
||||
// then
|
||||
expect(subProcess.get('flowElements')).not.to.include(target);
|
||||
expect(subProcess.di.$parent.get('planeElement')).not.to.include(target.di);
|
||||
expect(subProcessDi.$parent.get('planeElement')).not.to.include(targetDi);
|
||||
}));
|
||||
|
||||
});
|
||||
|
|
|
@ -3,6 +3,8 @@ import {
|
|||
inject
|
||||
} from 'test/TestHelper';
|
||||
|
||||
import { getDi } from 'lib/util/ModelUtil';
|
||||
|
||||
import modelingModule from 'lib/features/modeling';
|
||||
import coreModule from 'lib/core';
|
||||
|
||||
|
@ -26,9 +28,9 @@ describe('features - bpmn-updater', function() {
|
|||
// given
|
||||
// sequence flow with existing sourceElement and targetElement di information
|
||||
var task = elementRegistry.get('Task_1'),
|
||||
sequenceFlowDi = elementRegistry.get('SequenceFlow_1').businessObject.di,
|
||||
startEventDi = elementRegistry.get('StartEvent_1').businessObject.di,
|
||||
endEventDi = elementRegistry.get('EndEvent_1').businessObject.di;
|
||||
sequenceFlowDi = getDi(elementRegistry.get('SequenceFlow_1')),
|
||||
startEventDi = getDi(elementRegistry.get('StartEvent_1')),
|
||||
endEventDi = getDi(elementRegistry.get('EndEvent_1'));
|
||||
|
||||
// when
|
||||
modeling.removeElements([ task ]);
|
||||
|
@ -46,7 +48,8 @@ describe('features - bpmn-updater', function() {
|
|||
// given
|
||||
// sequence flow with existing sourceElement and targetElement di information
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
||||
startEventDi = elementRegistry.get('StartEvent_2').businessObject.di;
|
||||
startEventDi = getDi(elementRegistry.get('StartEvent_2')),
|
||||
sequenceFlowDi = getDi(sequenceFlow);
|
||||
|
||||
var intermediateThrowEvent = elementFactory.createShape({
|
||||
type: 'bpmn:IntermediateThrowEvent'
|
||||
|
@ -58,8 +61,8 @@ describe('features - bpmn-updater', function() {
|
|||
var event = modeling.createShape(intermediateThrowEvent, dropPosition, sequenceFlow);
|
||||
|
||||
// then
|
||||
expect(sequenceFlow.businessObject.di.sourceElement).to.equal(startEventDi);
|
||||
expect(sequenceFlow.businessObject.di.targetElement).to.equal(event.businessObject.di);
|
||||
expect(sequenceFlowDi.sourceElement).to.equal(startEventDi);
|
||||
expect(sequenceFlowDi.targetElement).to.equal(getDi(event));
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -69,7 +72,8 @@ describe('features - bpmn-updater', function() {
|
|||
|
||||
// given
|
||||
// sequence flow without any sourceElement and targetElement di information
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_4');
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_4'),
|
||||
sequenceFlowDi = getDi(sequenceFlow);
|
||||
|
||||
var intermediateThrowEvent = elementFactory.createShape({
|
||||
type: 'bpmn:IntermediateThrowEvent'
|
||||
|
@ -81,8 +85,8 @@ describe('features - bpmn-updater', function() {
|
|||
modeling.createShape(intermediateThrowEvent, dropPosition, sequenceFlow);
|
||||
|
||||
// then
|
||||
expect(sequenceFlow.businessObject.di.sourceElement).not.to.exist;
|
||||
expect(sequenceFlow.businessObject.di.targetElement).not.to.exist;
|
||||
expect(sequenceFlowDi.sourceElement).not.to.exist;
|
||||
expect(sequenceFlowDi.targetElement).not.to.exist;
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -163,7 +167,7 @@ describe('features - bpmn-updater', function() {
|
|||
// given
|
||||
var event = elementRegistry.get('StartEvent'),
|
||||
label = event.label,
|
||||
di = event.businessObject.di;
|
||||
di = getDi(event);
|
||||
|
||||
// when
|
||||
modeling.moveElements([ label ], { x: 20, y: 20 });
|
||||
|
@ -187,7 +191,7 @@ describe('features - bpmn-updater', function() {
|
|||
// given
|
||||
var event = elementRegistry.get('StartEvent_2'),
|
||||
label = event.label,
|
||||
di = event.businessObject.di;
|
||||
di = getDi(event);
|
||||
|
||||
// when
|
||||
modeling.moveElements([ label ], { x: 20, y: 20 });
|
||||
|
|
|
@ -3,6 +3,10 @@ import {
|
|||
inject
|
||||
} from 'test/TestHelper';
|
||||
|
||||
import {
|
||||
getDi
|
||||
} from 'lib/util/ModelUtil';
|
||||
|
||||
import modelingModule from 'lib/features/modeling';
|
||||
import coreModule from 'lib/core';
|
||||
|
||||
|
@ -21,6 +25,7 @@ describe('features/modeling - create connection', function() {
|
|||
// given
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
task = taskShape.businessObject,
|
||||
taskDi = getDi(taskShape),
|
||||
gatewayShape = elementRegistry.get('Gateway_1'),
|
||||
gateway = gatewayShape.businessObject;
|
||||
|
||||
|
@ -29,7 +34,8 @@ describe('features/modeling - create connection', function() {
|
|||
type: 'bpmn:SequenceFlow'
|
||||
}, taskShape.parent);
|
||||
|
||||
var sequenceFlow = sequenceFlowConnection.businessObject;
|
||||
var sequenceFlow = sequenceFlowConnection.businessObject,
|
||||
sequenceFlowDi = getDi(sequenceFlowConnection);
|
||||
|
||||
// then
|
||||
expect(sequenceFlowConnection).to.exist;
|
||||
|
@ -41,8 +47,8 @@ describe('features/modeling - create connection', function() {
|
|||
expect(task.outgoing).to.include(sequenceFlow);
|
||||
expect(gateway.incoming).to.include(sequenceFlow);
|
||||
|
||||
expect(sequenceFlow.di.$parent).to.eql(task.di.$parent);
|
||||
expect(sequenceFlow.di.$parent.planeElement).to.include(sequenceFlow.di);
|
||||
expect(sequenceFlowDi.$parent).to.eql(taskDi.$parent);
|
||||
expect(sequenceFlowDi.$parent.planeElement).to.include(sequenceFlowDi);
|
||||
|
||||
// expect cropped connection
|
||||
expect(sequenceFlowConnection.waypoints).eql([
|
||||
|
@ -60,7 +66,7 @@ describe('features/modeling - create connection', function() {
|
|||
]);
|
||||
|
||||
// expect cropped waypoints in di
|
||||
expect(sequenceFlow.di.waypoint).eql(diWaypoints);
|
||||
expect(sequenceFlowDi.waypoint).eql(diWaypoints);
|
||||
}));
|
||||
|
||||
|
||||
|
@ -132,6 +138,7 @@ describe('features/modeling - create connection', function() {
|
|||
// given
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
task = taskShape.businessObject,
|
||||
taskDi = getDi(taskShape),
|
||||
gatewayShape = elementRegistry.get('Gateway_1'),
|
||||
gateway = gatewayShape.businessObject;
|
||||
|
||||
|
@ -140,10 +147,11 @@ describe('features/modeling - create connection', function() {
|
|||
type: 'bpmn:SequenceFlow'
|
||||
}, taskShape.parent);
|
||||
|
||||
var sequenceFlow = sequenceFlowConnection.businessObject;
|
||||
var sequenceFlow = sequenceFlowConnection.businessObject,
|
||||
sequenceFlowDi = getDi(sequenceFlowConnection);
|
||||
|
||||
var newWaypoints = sequenceFlowConnection.waypoints,
|
||||
newDiWaypoints = sequenceFlow.di.waypoint;
|
||||
newDiWaypoints = sequenceFlowDi.waypoint;
|
||||
|
||||
// when
|
||||
commandStack.undo();
|
||||
|
@ -156,14 +164,14 @@ describe('features/modeling - create connection', function() {
|
|||
expect(task.outgoing).to.include(sequenceFlow);
|
||||
expect(gateway.incoming).to.include(sequenceFlow);
|
||||
|
||||
expect(sequenceFlow.di.$parent).to.eql(task.di.$parent);
|
||||
expect(sequenceFlow.di.$parent.planeElement).to.include(sequenceFlow.di);
|
||||
expect(sequenceFlowDi.$parent).to.eql(taskDi.$parent);
|
||||
expect(sequenceFlowDi.$parent.planeElement).to.include(sequenceFlowDi);
|
||||
|
||||
// expect cropped connection
|
||||
expect(sequenceFlowConnection.waypoints).eql(newWaypoints);
|
||||
|
||||
// expect cropped waypoints in di
|
||||
expect(sequenceFlow.di.waypoint).eql(newDiWaypoints);
|
||||
expect(sequenceFlowDi.waypoint).eql(newDiWaypoints);
|
||||
}));
|
||||
|
||||
});
|
||||
|
|
|
@ -3,6 +3,8 @@ import {
|
|||
inject
|
||||
} from 'test/TestHelper';
|
||||
|
||||
import { getDi } from 'lib/util/ModelUtil';
|
||||
|
||||
import modelingModule from 'lib/features/modeling';
|
||||
import coreModule from 'lib/core';
|
||||
|
||||
|
@ -26,11 +28,11 @@ describe('features/modeling - delete participant', function() {
|
|||
// given
|
||||
var participantShape = elementRegistry.get('_Participant_2'),
|
||||
participant = participantShape.businessObject,
|
||||
participantDi = participant.di,
|
||||
participantDi = getDi(participantShape),
|
||||
process = participant.processRef,
|
||||
collaborationElement = participantShape.parent,
|
||||
collaboration = collaborationElement.businessObject,
|
||||
diPlane = collaboration.di,
|
||||
diPlane = getDi(collaborationElement),
|
||||
bpmnDefinitions = collaboration.$parent;
|
||||
|
||||
// when
|
||||
|
@ -46,14 +48,14 @@ describe('features/modeling - delete participant', function() {
|
|||
|
||||
// collaboration DI is unwired
|
||||
expect(participantDi.$parent).not.to.be.ok;
|
||||
expect(collaboration.di).not.to.be.ok;
|
||||
expect(collaborationElement.di).not.to.be.ok;
|
||||
|
||||
expect(bpmnDefinitions.rootElements).not.to.include(process);
|
||||
expect(bpmnDefinitions.rootElements).not.to.include(collaboration);
|
||||
|
||||
// process DI is wired
|
||||
expect(diPlane.bpmnElement).to.eql(newRootBusinessObject);
|
||||
expect(newRootBusinessObject.di).to.eql(diPlane);
|
||||
expect(newRootShape.di).to.eql(diPlane);
|
||||
|
||||
expect(bpmnDefinitions.rootElements).to.include(newRootBusinessObject);
|
||||
}));
|
||||
|
@ -67,7 +69,7 @@ describe('features/modeling - delete participant', function() {
|
|||
originalRootElement = participantShape.parent,
|
||||
originalRootElementBo = originalRootElement.businessObject,
|
||||
bpmnDefinitions = originalRootElementBo.$parent,
|
||||
participantDi = participant.di,
|
||||
participantDi = getDi(participantShape),
|
||||
diPlane = participantDi.$parent;
|
||||
|
||||
modeling.removeShape(participantShape);
|
||||
|
@ -82,7 +84,7 @@ describe('features/modeling - delete participant', function() {
|
|||
expect(canvas.getRootElement()).to.eql(originalRootElement);
|
||||
|
||||
// di is unwired
|
||||
expect(participantDi.$parent).to.eql(originalRootElementBo.di);
|
||||
expect(participantDi.$parent).to.eql(getDi(originalRootElement));
|
||||
|
||||
// new di is wired
|
||||
expect(diPlane.bpmnElement).to.eql(originalRootElementBo);
|
||||
|
|
|
@ -5,6 +5,7 @@ import {
|
|||
|
||||
import modelingModule from 'lib/features/modeling';
|
||||
import coreModule from 'lib/core';
|
||||
import { getDi } from 'lib/util/ModelUtil';
|
||||
|
||||
|
||||
describe('features/modeling - move connection', function() {
|
||||
|
@ -25,7 +26,7 @@ describe('features/modeling - move connection', function() {
|
|||
|
||||
// given
|
||||
var sequenceFlowConnection = elementRegistry.get('SequenceFlow_1'),
|
||||
sequenceFlow = sequenceFlowConnection.businessObject;
|
||||
sequenceFlowDi = getDi(sequenceFlowConnection);
|
||||
|
||||
// when
|
||||
modeling.moveConnection(sequenceFlowConnection, { x: 20, y: 10 });
|
||||
|
@ -45,7 +46,7 @@ describe('features/modeling - move connection', function() {
|
|||
// expect cropped waypoints in di
|
||||
var diWaypoints = bpmnFactory.createDiWaypoints(expectedWaypoints);
|
||||
|
||||
expect(sequenceFlow.di.waypoint).eql(diWaypoints);
|
||||
expect(sequenceFlowDi.waypoint).eql(diWaypoints);
|
||||
}));
|
||||
|
||||
|
||||
|
@ -53,10 +54,10 @@ describe('features/modeling - move connection', function() {
|
|||
|
||||
// given
|
||||
var sequenceFlowConnection = elementRegistry.get('SequenceFlow_1'),
|
||||
sequenceFlow = sequenceFlowConnection.businessObject;
|
||||
sequenceFlowDi = getDi(sequenceFlowConnection);
|
||||
|
||||
var oldWaypoints = sequenceFlowConnection.waypoints,
|
||||
oldDiWaypoints = sequenceFlow.di.waypoint;
|
||||
oldDiWaypoints = sequenceFlowDi.waypoint;
|
||||
|
||||
modeling.moveConnection(sequenceFlowConnection, { x: 20, y: 10 });
|
||||
|
||||
|
@ -65,7 +66,7 @@ describe('features/modeling - move connection', function() {
|
|||
|
||||
// then
|
||||
expect(sequenceFlowConnection.waypoints).eql(oldWaypoints);
|
||||
expect(sequenceFlow.di.waypoint).eql(oldDiWaypoints);
|
||||
expect(sequenceFlowDi.waypoint).eql(oldDiWaypoints);
|
||||
}));
|
||||
|
||||
|
||||
|
@ -73,12 +74,12 @@ describe('features/modeling - move connection', function() {
|
|||
|
||||
// given
|
||||
var sequenceFlowConnection = elementRegistry.get('SequenceFlow_1'),
|
||||
sequenceFlow = sequenceFlowConnection.businessObject;
|
||||
sequenceFlowDi = getDi(sequenceFlowConnection);
|
||||
|
||||
modeling.moveConnection(sequenceFlowConnection, { x: 20, y: 10 });
|
||||
|
||||
var newWaypoints = sequenceFlowConnection.waypoints,
|
||||
newDiWaypoints = sequenceFlow.di.waypoint;
|
||||
newDiWaypoints = sequenceFlowDi.waypoint;
|
||||
|
||||
// when
|
||||
commandStack.undo();
|
||||
|
@ -86,7 +87,7 @@ describe('features/modeling - move connection', function() {
|
|||
|
||||
// then
|
||||
expect(sequenceFlowConnection.waypoints).eql(newWaypoints);
|
||||
expect(sequenceFlow.di.waypoint).eql(newDiWaypoints);
|
||||
expect(sequenceFlowDi.waypoint).eql(newDiWaypoints);
|
||||
}));
|
||||
|
||||
});
|
||||
|
|
|
@ -5,6 +5,7 @@ import {
|
|||
|
||||
import modelingModule from 'lib/features/modeling';
|
||||
import coreModule from 'lib/core';
|
||||
import { getDi } from 'lib/util/ModelUtil';
|
||||
|
||||
|
||||
describe('features/modeling - move shape', function() {
|
||||
|
@ -22,10 +23,10 @@ describe('features/modeling - move shape', function() {
|
|||
|
||||
// given
|
||||
var startEventElement = elementRegistry.get('StartEvent_1'),
|
||||
startEvent = startEventElement.businessObject;
|
||||
startEventDi = getDi(startEventElement);
|
||||
|
||||
var sequenceFlowElement = elementRegistry.get('SequenceFlow_1'),
|
||||
sequenceFlow = sequenceFlowElement.businessObject;
|
||||
sequenceFlowDi = getDi(sequenceFlowElement);
|
||||
|
||||
var oldPosition = {
|
||||
x: startEventElement.x,
|
||||
|
@ -36,7 +37,7 @@ describe('features/modeling - move shape', function() {
|
|||
modeling.moveShape(startEventElement, { x: 0, y: 50 });
|
||||
|
||||
// then
|
||||
expect(startEvent.di).to.have.position({
|
||||
expect(startEventDi).to.have.position({
|
||||
x: oldPosition.x,
|
||||
y: oldPosition.y + 50
|
||||
});
|
||||
|
@ -50,7 +51,7 @@ describe('features/modeling - move shape', function() {
|
|||
// see LayoutSpec for actual connection layouting tests
|
||||
|
||||
// expect di waypoints update
|
||||
expect(sequenceFlow.di.waypoint).to.eql(expectedDiWaypoints);
|
||||
expect(sequenceFlowDi.waypoint).to.eql(expectedDiWaypoints);
|
||||
}));
|
||||
|
||||
|
||||
|
@ -58,7 +59,7 @@ describe('features/modeling - move shape', function() {
|
|||
|
||||
// given
|
||||
var labelElement = elementRegistry.get('StartEvent_1_label'),
|
||||
startEvent = labelElement.businessObject;
|
||||
startEventDi = getDi(elementRegistry.get('StartEvent_1'));
|
||||
|
||||
var oldPosition = {
|
||||
x: labelElement.x,
|
||||
|
@ -69,7 +70,7 @@ describe('features/modeling - move shape', function() {
|
|||
modeling.moveShape(labelElement, { x: 0, y: 50 });
|
||||
|
||||
// then
|
||||
expect(startEvent.di.label).to.have.position({
|
||||
expect(startEventDi.label).to.have.position({
|
||||
x: oldPosition.x,
|
||||
y: oldPosition.y + 50
|
||||
});
|
||||
|
@ -103,21 +104,21 @@ describe('features/modeling - move shape', function() {
|
|||
it('should undo', inject(function(elementRegistry, commandStack, modeling) {
|
||||
|
||||
// given
|
||||
var startEventElement = elementRegistry.get('StartEvent_1'),
|
||||
startEvent = startEventElement.businessObject;
|
||||
var startEvent = elementRegistry.get('StartEvent_1'),
|
||||
startEventDi = getDi(startEvent);
|
||||
|
||||
var oldPosition = {
|
||||
x: startEventElement.x,
|
||||
y: startEventElement.y
|
||||
x: startEvent.x,
|
||||
y: startEvent.y
|
||||
};
|
||||
|
||||
modeling.moveShape(startEventElement, { x: 0, y: 50 });
|
||||
modeling.moveShape(startEvent, { x: 0, y: 50 });
|
||||
|
||||
// when
|
||||
commandStack.undo();
|
||||
|
||||
// then
|
||||
expect(startEvent.di).to.have.position(oldPosition);
|
||||
expect(startEventDi).to.have.position(oldPosition);
|
||||
}));
|
||||
|
||||
|
||||
|
@ -125,7 +126,8 @@ describe('features/modeling - move shape', function() {
|
|||
|
||||
// given
|
||||
var labelElement = elementRegistry.get('StartEvent_1_label'),
|
||||
startEvent = labelElement.businessObject;
|
||||
startEvent = elementRegistry.get('StartEvent_1'),
|
||||
startEventDi = getDi(startEvent);
|
||||
|
||||
var oldPosition = {
|
||||
x: labelElement.x,
|
||||
|
@ -138,7 +140,7 @@ describe('features/modeling - move shape', function() {
|
|||
commandStack.undo();
|
||||
|
||||
// then
|
||||
expect(startEvent.di.label).to.have.position(oldPosition);
|
||||
expect(startEventDi.label).to.have.position(oldPosition);
|
||||
}));
|
||||
|
||||
});
|
||||
|
@ -150,7 +152,7 @@ describe('features/modeling - move shape', function() {
|
|||
|
||||
// given
|
||||
var startEventElement = elementRegistry.get('StartEvent_1'),
|
||||
startEvent = startEventElement.businessObject;
|
||||
startEventDi = getDi(startEventElement);
|
||||
|
||||
|
||||
modeling.moveShape(startEventElement, { x: 0, y: 50 });
|
||||
|
@ -165,7 +167,7 @@ describe('features/modeling - move shape', function() {
|
|||
commandStack.redo();
|
||||
|
||||
// then
|
||||
expect(startEvent.di).to.have.position(newPosition);
|
||||
expect(startEventDi).to.have.position(newPosition);
|
||||
}));
|
||||
|
||||
|
||||
|
@ -173,7 +175,8 @@ describe('features/modeling - move shape', function() {
|
|||
|
||||
// given
|
||||
var labelElement = elementRegistry.get('StartEvent_1_label'),
|
||||
startEvent = labelElement.businessObject;
|
||||
startEvent = elementRegistry.get('StartEvent_1'),
|
||||
startEventDi = getDi(startEvent);
|
||||
|
||||
modeling.moveShape(labelElement, { x: 0, y: 50 });
|
||||
|
||||
|
@ -187,7 +190,7 @@ describe('features/modeling - move shape', function() {
|
|||
commandStack.redo();
|
||||
|
||||
// then
|
||||
expect(startEvent.di.label).to.have.position(newPosition);
|
||||
expect(startEventDi.label).to.have.position(newPosition);
|
||||
}));
|
||||
|
||||
});
|
||||
|
|
|
@ -6,7 +6,7 @@ import {
|
|||
import { pick } from 'min-dash';
|
||||
|
||||
import {
|
||||
getBusinessObject
|
||||
getDi
|
||||
} from 'lib/util/ModelUtil';
|
||||
|
||||
import modelingModule from 'lib/features/modeling';
|
||||
|
@ -51,8 +51,8 @@ describe('features/modeling - resize shape', function() {
|
|||
modeling.resizeShape(subProcessElement, { x: 339, y: 142, width: 250, height: 200 });
|
||||
|
||||
// then
|
||||
var bo = getBusinessObject(subProcessElement);
|
||||
expect(bo.di.bounds.width).to.equal(250);
|
||||
var di = getDi(subProcessElement);
|
||||
expect(di.bounds.width).to.equal(250);
|
||||
}));
|
||||
|
||||
|
||||
|
@ -65,8 +65,8 @@ describe('features/modeling - resize shape', function() {
|
|||
modeling.resizeShape(subProcessElement, { x: 250, y: 250, width: 550, height: 400 });
|
||||
|
||||
// then
|
||||
var bo = getBusinessObject(subProcessElement);
|
||||
expect(bo.di.bounds.width).to.equal(550);
|
||||
var di = getDi(subProcessElement);
|
||||
expect(di.bounds.width).to.equal(550);
|
||||
}));
|
||||
|
||||
});
|
||||
|
@ -80,7 +80,7 @@ describe('features/modeling - resize shape', function() {
|
|||
var subProcessElement = elementRegistry.get('SubProcess_1');
|
||||
|
||||
var sequenceFlowElement = elementRegistry.get('SequenceFlow_2'),
|
||||
sequenceFlow = sequenceFlowElement.businessObject;
|
||||
sequenceFlowDi = getDi(sequenceFlowElement);
|
||||
|
||||
// when
|
||||
|
||||
|
@ -95,7 +95,7 @@ describe('features/modeling - resize shape', function() {
|
|||
{ x: 821, y: 242 }
|
||||
]);
|
||||
|
||||
expect(sequenceFlow.di.waypoint).eql(diWaypoints);
|
||||
expect(sequenceFlowDi.waypoint).eql(diWaypoints);
|
||||
}));
|
||||
|
||||
|
||||
|
@ -105,7 +105,7 @@ describe('features/modeling - resize shape', function() {
|
|||
var subProcessElement = elementRegistry.get('SubProcess_1');
|
||||
|
||||
var sequenceFlowElement = elementRegistry.get('SequenceFlow_2'),
|
||||
sequenceFlow = sequenceFlowElement.businessObject;
|
||||
sequenceFlowDi = getDi(sequenceFlowElement);
|
||||
|
||||
// when
|
||||
modeling.moveShape(subProcessElement, { x: -50, y: 0 });
|
||||
|
@ -118,7 +118,7 @@ describe('features/modeling - resize shape', function() {
|
|||
{ x: 821, y: 242 }
|
||||
]);
|
||||
|
||||
expect(sequenceFlow.di.waypoint).eql(diWaypoints);
|
||||
expect(sequenceFlowDi.waypoint).eql(diWaypoints);
|
||||
}));
|
||||
|
||||
});
|
||||
|
|
|
@ -3,6 +3,8 @@ import {
|
|||
inject
|
||||
} from 'test/TestHelper';
|
||||
|
||||
import { getDi } from 'lib/util/ModelUtil';
|
||||
|
||||
import modelingModule from 'lib/features/modeling';
|
||||
import coreModule from 'lib/core';
|
||||
|
||||
|
@ -26,27 +28,29 @@ describe('features/modeling - set color', function() {
|
|||
it('setting fill color', inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
|
||||
// when
|
||||
modeling.setColor(taskShape, { fill: 'FUCHSIA' });
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('background-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(taskDi.get('background-color')).to.equal(FUCHSIA_HEX);
|
||||
}));
|
||||
|
||||
|
||||
it('unsetting fill color', inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
modeling.setColor(taskShape, { fill: 'FUCHSIA' });
|
||||
|
||||
// when
|
||||
modeling.setColor(taskShape);
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('background-color')).not.to.exist;
|
||||
expect(taskDi.get('background-color')).not.to.exist;
|
||||
}));
|
||||
|
||||
|
||||
|
@ -54,15 +58,16 @@ describe('features/modeling - set color', function() {
|
|||
function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
modeling.setColor(taskShape, { fill: 'FUCHSIA', stroke: 'YELLOW' });
|
||||
|
||||
// when
|
||||
modeling.setColor(taskShape, { fill: 'YELLOW' });
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('background-color')).to.equal(YELLOW_HEX);
|
||||
expect(taskShape.businessObject.di.get('border-color')).to.equal(YELLOW_HEX);
|
||||
expect(taskDi.get('background-color')).to.equal(YELLOW_HEX);
|
||||
expect(taskDi.get('border-color')).to.equal(YELLOW_HEX);
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -71,15 +76,16 @@ describe('features/modeling - set color', function() {
|
|||
function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
modeling.setColor(taskShape, { fill: 'FUCHSIA', stroke: 'YELLOW' });
|
||||
|
||||
// when
|
||||
modeling.setColor(taskShape, { fill: undefined });
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('background-color')).not.to.exist;
|
||||
expect(taskShape.businessObject.di.get('border-color')).to.equal(YELLOW_HEX);
|
||||
expect(taskDi.get('background-color')).not.to.exist;
|
||||
expect(taskDi.get('border-color')).to.equal(YELLOW_HEX);
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -88,15 +94,16 @@ describe('features/modeling - set color', function() {
|
|||
function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
modeling.setColor(taskShape, { fill: 'FUCHSIA' });
|
||||
|
||||
// when
|
||||
modeling.setColor(taskShape);
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('background-color')).not.to.exist;
|
||||
expect(taskShape.businessObject.di.get('border-color')).not.to.exist;
|
||||
expect(taskDi.get('background-color')).not.to.exist;
|
||||
expect(taskDi.get('border-color')).not.to.exist;
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -104,29 +111,31 @@ describe('features/modeling - set color', function() {
|
|||
it('setting stroke color', inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
|
||||
// when
|
||||
modeling.setColor(taskShape, { stroke: 'FUCHSIA' });
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('border-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(taskShape.businessObject.di.get('background-color')).not.to.exist;
|
||||
expect(taskDi.get('border-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(taskDi.get('background-color')).not.to.exist;
|
||||
}));
|
||||
|
||||
|
||||
it('unsetting stroke color', inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
modeling.setColor(taskShape, { stroke: 'FUCHSIA' });
|
||||
|
||||
// when
|
||||
modeling.setColor(taskShape);
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('border-color')).not.to.exist;
|
||||
expect(taskShape.businessObject.di.get('background-color')).not.to.exist;
|
||||
expect(taskDi.get('border-color')).not.to.exist;
|
||||
expect(taskDi.get('background-color')).not.to.exist;
|
||||
}));
|
||||
|
||||
|
||||
|
@ -134,17 +143,19 @@ describe('features/modeling - set color', function() {
|
|||
function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var startEventShape = elementRegistry.get('StartEvent_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
var startEventShape = elementRegistry.get('StartEvent_1'),
|
||||
startEventDi = getDi(startEventShape);
|
||||
|
||||
// when
|
||||
modeling.setColor([ taskShape, startEventShape ], { fill: 'FUCHSIA' });
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('background-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(startEventShape.businessObject.di.get('background-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(taskShape.businessObject.di.get('border-color')).not.to.exist;
|
||||
expect(startEventShape.businessObject.di.get('border-color')).not.to.exist;
|
||||
expect(taskDi.get('background-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(startEventDi.get('background-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(taskDi.get('border-color')).not.to.exist;
|
||||
expect(startEventDi.get('border-color')).not.to.exist;
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -153,16 +164,18 @@ describe('features/modeling - set color', function() {
|
|||
function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var startEventShape = elementRegistry.get('StartEvent_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
var startEventShape = elementRegistry.get('StartEvent_1'),
|
||||
startEventDi = getDi(startEventShape);
|
||||
modeling.setColor([ taskShape, startEventShape ], { fill: 'FUCHSIA' });
|
||||
|
||||
// when
|
||||
modeling.setColor([ taskShape, startEventShape ]);
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('background-color')).not.to.exist;
|
||||
expect(startEventShape.businessObject.di.get('background-color')).not.to.exist;
|
||||
expect(taskDi.get('background-color')).not.to.exist;
|
||||
expect(startEventDi.get('background-color')).not.to.exist;
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -171,8 +184,10 @@ describe('features/modeling - set color', function() {
|
|||
function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var startEventShape = elementRegistry.get('StartEvent_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
var startEventShape = elementRegistry.get('StartEvent_1'),
|
||||
startEventDi = getDi(startEventShape);
|
||||
|
||||
// when
|
||||
modeling.setColor([
|
||||
|
@ -181,10 +196,10 @@ describe('features/modeling - set color', function() {
|
|||
], { stroke: 'FUCHSIA' });
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('border-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(startEventShape.businessObject.di.get('border-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(taskShape.businessObject.di.get('background-color')).not.to.exist;
|
||||
expect(startEventShape.businessObject.di.get('background-color')).not.to.exist;
|
||||
expect(taskDi.get('border-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(startEventDi.get('border-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(taskDi.get('background-color')).not.to.exist;
|
||||
expect(startEventDi.get('background-color')).not.to.exist;
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -193,8 +208,11 @@ describe('features/modeling - set color', function() {
|
|||
function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var startEventShape = elementRegistry.get('StartEvent_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
var startEventShape = elementRegistry.get('StartEvent_1'),
|
||||
startEventDi = getDi(startEventShape);
|
||||
|
||||
modeling.setColor([
|
||||
taskShape,
|
||||
startEventShape
|
||||
|
@ -204,8 +222,8 @@ describe('features/modeling - set color', function() {
|
|||
modeling.setColor([ taskShape, startEventShape ]);
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('border-color')).not.to.exist;
|
||||
expect(startEventShape.businessObject.di.get('border-color')).not.to.exist;
|
||||
expect(taskDi.get('border-color')).not.to.exist;
|
||||
expect(startEventDi.get('border-color')).not.to.exist;
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -213,13 +231,14 @@ describe('features/modeling - set color', function() {
|
|||
it('should not set background-color on BPMNEdge', inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_1');
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_1'),
|
||||
sequenceFlowDi = getDi(sequenceFlow);
|
||||
|
||||
// when
|
||||
modeling.setColor(sequenceFlow, { fill: 'FUCHSIA' });
|
||||
|
||||
// then
|
||||
expect(sequenceFlow.businessObject.di.get('background-color')).not.to.exist;
|
||||
expect(sequenceFlowDi.get('background-color')).not.to.exist;
|
||||
}));
|
||||
|
||||
|
||||
|
@ -260,14 +279,15 @@ describe('features/modeling - set color', function() {
|
|||
function(elementRegistry, commandStack, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
|
||||
// when
|
||||
modeling.setColor(taskShape, { fill: 'FUCHSIA' });
|
||||
commandStack.undo();
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('background-color')).not.to.exist;
|
||||
expect(taskDi.get('background-color')).not.to.exist;
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -276,7 +296,9 @@ describe('features/modeling - set color', function() {
|
|||
function(elementRegistry, commandStack, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
|
||||
modeling.setColor(taskShape, { fill: 'FUCHSIA' });
|
||||
|
||||
// when
|
||||
|
@ -284,7 +306,7 @@ describe('features/modeling - set color', function() {
|
|||
commandStack.undo();
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('background-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(taskDi.get('background-color')).to.equal(FUCHSIA_HEX);
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -293,14 +315,15 @@ describe('features/modeling - set color', function() {
|
|||
function(elementRegistry, commandStack, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
|
||||
// when
|
||||
modeling.setColor(taskShape, { stroke: 'FUCHSIA' });
|
||||
commandStack.undo();
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('border-color')).not.to.exist;
|
||||
expect(taskDi.get('border-color')).not.to.exist;
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -309,7 +332,8 @@ describe('features/modeling - set color', function() {
|
|||
function(elementRegistry, commandStack, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
modeling.setColor(taskShape, { stroke: 'FUCHSIA' });
|
||||
|
||||
// when
|
||||
|
@ -317,7 +341,7 @@ describe('features/modeling - set color', function() {
|
|||
commandStack.undo();
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('border-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(taskDi.get('border-color')).to.equal(FUCHSIA_HEX);
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -326,16 +350,18 @@ describe('features/modeling - set color', function() {
|
|||
function(elementRegistry, commandStack, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var startEventShape = elementRegistry.get('StartEvent_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
var startEventShape = elementRegistry.get('StartEvent_1'),
|
||||
startEventDi = getDi(startEventShape);
|
||||
|
||||
// when
|
||||
modeling.setColor([ taskShape, startEventShape ], { fill: 'FUCHSIA' });
|
||||
commandStack.undo();
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('background-color')).not.to.exist;
|
||||
expect(startEventShape.businessObject.di.get('background-color')).not.to.exist;
|
||||
expect(taskDi.get('background-color')).not.to.exist;
|
||||
expect(startEventDi.get('background-color')).not.to.exist;
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -344,8 +370,10 @@ describe('features/modeling - set color', function() {
|
|||
function(elementRegistry, commandStack, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var startEventShape = elementRegistry.get('StartEvent_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
var startEventShape = elementRegistry.get('StartEvent_1'),
|
||||
startEventDi = getDi(startEventShape);
|
||||
modeling.setColor([ taskShape, startEventShape ], { fill: 'FUCHSIA' });
|
||||
|
||||
// when
|
||||
|
@ -353,8 +381,8 @@ describe('features/modeling - set color', function() {
|
|||
commandStack.undo();
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('background-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(startEventShape.businessObject.di.get('background-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(taskDi.get('background-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(startEventDi.get('background-color')).to.equal(FUCHSIA_HEX);
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -363,8 +391,10 @@ describe('features/modeling - set color', function() {
|
|||
function(elementRegistry, commandStack, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var startEventShape = elementRegistry.get('StartEvent_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
var startEventShape = elementRegistry.get('StartEvent_1'),
|
||||
startEventDi = getDi(startEventShape);
|
||||
|
||||
// when
|
||||
modeling.setColor([
|
||||
|
@ -374,8 +404,8 @@ describe('features/modeling - set color', function() {
|
|||
commandStack.undo();
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('border-color')).not.to.exist;
|
||||
expect(startEventShape.businessObject.di.get('border-color')).not.to.exist;
|
||||
expect(taskDi.get('border-color')).not.to.exist;
|
||||
expect(startEventDi.get('border-color')).not.to.exist;
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -384,8 +414,10 @@ describe('features/modeling - set color', function() {
|
|||
function(elementRegistry, commandStack, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var startEventShape = elementRegistry.get('StartEvent_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
var startEventShape = elementRegistry.get('StartEvent_1'),
|
||||
startEventDi = getDi(startEventShape);
|
||||
modeling.setColor([ taskShape, startEventShape ], { stroke: 'FUCHSIA' });
|
||||
|
||||
// when
|
||||
|
@ -393,8 +425,8 @@ describe('features/modeling - set color', function() {
|
|||
commandStack.undo();
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('border-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(startEventShape.businessObject.di.get('border-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(taskDi.get('border-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(startEventDi.get('border-color')).to.equal(FUCHSIA_HEX);
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -407,7 +439,8 @@ describe('features/modeling - set color', function() {
|
|||
function(elementRegistry, commandStack, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
|
||||
// when
|
||||
modeling.setColor(taskShape, { fill: 'FUCHSIA' });
|
||||
|
@ -415,7 +448,7 @@ describe('features/modeling - set color', function() {
|
|||
commandStack.redo();
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('background-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(taskDi.get('background-color')).to.equal(FUCHSIA_HEX);
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -424,7 +457,8 @@ describe('features/modeling - set color', function() {
|
|||
function(elementRegistry, commandStack, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
modeling.setColor(taskShape, { fill: 'FUCHSIA' });
|
||||
|
||||
// when
|
||||
|
@ -433,7 +467,7 @@ describe('features/modeling - set color', function() {
|
|||
commandStack.redo();
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('background-color')).not.to.exist;
|
||||
expect(taskDi.get('background-color')).not.to.exist;
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -442,7 +476,8 @@ describe('features/modeling - set color', function() {
|
|||
function(elementRegistry, commandStack, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
|
||||
// when
|
||||
modeling.setColor(taskShape, { stroke: 'FUCHSIA' });
|
||||
|
@ -450,7 +485,7 @@ describe('features/modeling - set color', function() {
|
|||
commandStack.redo();
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('border-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(taskDi.get('border-color')).to.equal(FUCHSIA_HEX);
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -459,7 +494,8 @@ describe('features/modeling - set color', function() {
|
|||
function(elementRegistry, commandStack, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
modeling.setColor(taskShape, { stroke: 'FUCHSIA' });
|
||||
|
||||
// when
|
||||
|
@ -468,7 +504,7 @@ describe('features/modeling - set color', function() {
|
|||
commandStack.redo();
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('border-color')).not.to.exist;
|
||||
expect(taskDi.get('border-color')).not.to.exist;
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -477,8 +513,10 @@ describe('features/modeling - set color', function() {
|
|||
function(elementRegistry, commandStack, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var startEventShape = elementRegistry.get('StartEvent_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
var startEventShape = elementRegistry.get('StartEvent_1'),
|
||||
startEventDi = getDi(startEventShape);
|
||||
|
||||
// when
|
||||
modeling.setColor([ taskShape, startEventShape ], { fill: 'FUCHSIA' });
|
||||
|
@ -486,8 +524,8 @@ describe('features/modeling - set color', function() {
|
|||
commandStack.redo();
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('background-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(startEventShape.businessObject.di.get('background-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(taskDi.get('background-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(startEventDi.get('background-color')).to.equal(FUCHSIA_HEX);
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -496,8 +534,10 @@ describe('features/modeling - set color', function() {
|
|||
function(elementRegistry, commandStack, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var startEventShape = elementRegistry.get('StartEvent_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
var startEventShape = elementRegistry.get('StartEvent_1'),
|
||||
startEventDi = getDi(startEventShape);
|
||||
modeling.setColor([ taskShape, startEventShape ], { fill: 'FUCHSIA' });
|
||||
|
||||
// when
|
||||
|
@ -506,8 +546,8 @@ describe('features/modeling - set color', function() {
|
|||
commandStack.redo();
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('background-color')).not.to.exist;
|
||||
expect(startEventShape.businessObject.di.get('background-color')).not.to.exist;
|
||||
expect(taskDi.get('background-color')).not.to.exist;
|
||||
expect(startEventDi.get('background-color')).not.to.exist;
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -516,8 +556,10 @@ describe('features/modeling - set color', function() {
|
|||
function(elementRegistry, commandStack, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var startEventShape = elementRegistry.get('StartEvent_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
var startEventShape = elementRegistry.get('StartEvent_1'),
|
||||
startEventDi = getDi(startEventShape);
|
||||
|
||||
// when
|
||||
modeling.setColor([ taskShape, startEventShape ], { stroke: 'FUCHSIA' });
|
||||
|
@ -525,8 +567,8 @@ describe('features/modeling - set color', function() {
|
|||
commandStack.redo();
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('border-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(startEventShape.businessObject.di.get('border-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(taskDi.get('border-color')).to.equal(FUCHSIA_HEX);
|
||||
expect(startEventDi.get('border-color')).to.equal(FUCHSIA_HEX);
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -535,8 +577,10 @@ describe('features/modeling - set color', function() {
|
|||
function(elementRegistry, commandStack, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var startEventShape = elementRegistry.get('StartEvent_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
var startEventShape = elementRegistry.get('StartEvent_1'),
|
||||
startEventDi = getDi(startEventShape);
|
||||
modeling.setColor([
|
||||
taskShape,
|
||||
startEventShape
|
||||
|
@ -548,8 +592,8 @@ describe('features/modeling - set color', function() {
|
|||
commandStack.redo();
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('border-color')).not.to.exist;
|
||||
expect(startEventShape.businessObject.di.get('border-color')).not.to.exist;
|
||||
expect(taskDi.get('border-color')).not.to.exist;
|
||||
expect(startEventDi.get('border-color')).not.to.exist;
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -563,16 +607,17 @@ describe('features/modeling - set color', function() {
|
|||
function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var taskShape = elementRegistry.get('Task_1');
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
taskDi = getDi(taskShape);
|
||||
|
||||
// when
|
||||
modeling.setColor(taskShape, { stroke: '#abcdef', fill: '#fedcba' });
|
||||
|
||||
// then
|
||||
expect(taskShape.businessObject.di.get('border-color')).to.eql('#abcdef');
|
||||
expect(taskShape.businessObject.di.get('stroke')).to.eql('#abcdef');
|
||||
expect(taskShape.businessObject.di.get('background-color')).to.eql('#fedcba');
|
||||
expect(taskShape.businessObject.di.get('fill')).to.eql('#fedcba');
|
||||
expect(taskDi.get('border-color')).to.eql('#abcdef');
|
||||
expect(taskDi.get('stroke')).to.eql('#abcdef');
|
||||
expect(taskDi.get('background-color')).to.eql('#fedcba');
|
||||
expect(taskDi.get('fill')).to.eql('#fedcba');
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -581,14 +626,15 @@ describe('features/modeling - set color', function() {
|
|||
function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_1');
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_1'),
|
||||
sequenceFlowDi = getDi(sequenceFlow);
|
||||
|
||||
// when
|
||||
modeling.setColor(sequenceFlow, { stroke: '#abcdef' });
|
||||
|
||||
// then
|
||||
expect(sequenceFlow.businessObject.di.get('border-color')).to.eql('#abcdef');
|
||||
expect(sequenceFlow.businessObject.di.get('stroke')).to.eql('#abcdef');
|
||||
expect(sequenceFlowDi.get('border-color')).to.eql('#abcdef');
|
||||
expect(sequenceFlowDi.get('stroke')).to.eql('#abcdef');
|
||||
}
|
||||
));
|
||||
});
|
||||
|
|
|
@ -3,6 +3,8 @@ import {
|
|||
inject
|
||||
} from 'test/TestHelper';
|
||||
|
||||
import { getDi } from 'lib/util/ModelUtil';
|
||||
|
||||
import modelingModule from 'lib/features/modeling';
|
||||
import coreModule from 'lib/core';
|
||||
|
||||
|
@ -238,7 +240,8 @@ describe('features/modeling - update properties', function() {
|
|||
|
||||
// given
|
||||
var flowConnection = elementRegistry.get('SequenceFlow_1'),
|
||||
flowBo = flowConnection.businessObject;
|
||||
flowBo = flowConnection.businessObject,
|
||||
flowDi = getDi(flowConnection);
|
||||
|
||||
// when
|
||||
modeling.updateProperties(flowConnection, {
|
||||
|
@ -248,7 +251,7 @@ describe('features/modeling - update properties', function() {
|
|||
});
|
||||
|
||||
// then
|
||||
expect(flowBo.di.fill).to.equal('FUCHSIA');
|
||||
expect(flowDi.fill).to.equal('FUCHSIA');
|
||||
|
||||
expect(flowBo.get('di')).not.to.exist;
|
||||
}));
|
||||
|
@ -257,14 +260,16 @@ describe('features/modeling - update properties', function() {
|
|||
it('unsetting di properties', inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var flowConnection = elementRegistry.get('SequenceFlow_1');
|
||||
var flowConnection = elementRegistry.get('SequenceFlow_1'),
|
||||
flowDi = getDi(flowConnection);
|
||||
|
||||
modeling.updateProperties(flowConnection, { di: { fill: 'FUCHSIA' } });
|
||||
|
||||
// when
|
||||
modeling.updateProperties(flowConnection, { di: { fill: undefined } });
|
||||
|
||||
// then
|
||||
expect(flowConnection.businessObject.di.fill).not.to.exist;
|
||||
expect(flowDi.fill).not.to.exist;
|
||||
}));
|
||||
|
||||
});
|
||||
|
@ -560,11 +565,11 @@ describe('features/modeling - update properties', function() {
|
|||
));
|
||||
|
||||
|
||||
it('should ignore setting color on root', inject(
|
||||
function(canvas, modeling) {
|
||||
it('should ignore setting color on elements without di', inject(
|
||||
function(modeling, bpmnFactory) {
|
||||
|
||||
// given
|
||||
var rootElement = canvas.getRootElement();
|
||||
var rootElement = bpmnFactory.create('bpmn:RootElement');
|
||||
|
||||
// when
|
||||
modeling.updateProperties(rootElement, {
|
||||
|
@ -574,7 +579,7 @@ describe('features/modeling - update properties', function() {
|
|||
});
|
||||
|
||||
// then
|
||||
expect(rootElement.di).not.to.exist;
|
||||
expect(getDi(rootElement)).not.to.exist;
|
||||
}
|
||||
));
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ import {
|
|||
inject
|
||||
} from 'test/TestHelper';
|
||||
|
||||
import { getDi } from 'lib/util/ModelUtil';
|
||||
|
||||
import modelingModule from 'lib/features/modeling';
|
||||
import coreModule from 'lib/core';
|
||||
|
||||
|
@ -11,7 +13,7 @@ describe('features/modeling/behavior - update semantic parent', function() {
|
|||
|
||||
var diagramXML = require('./UpdateSemanticParent.bpmn');
|
||||
|
||||
var participant1Bo, participant2Bo, dataStoreBo;
|
||||
var participant1Bo, participant1Di, participant2Bo, participant2Di, dataStoreBo, dataStoreDi;
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, {
|
||||
modules: [
|
||||
|
@ -26,14 +28,18 @@ describe('features/modeling/behavior - update semantic parent', function() {
|
|||
dataStore = elementRegistry.get('DataStoreReference');
|
||||
|
||||
participant1Bo = participant1.businessObject;
|
||||
participant1Di = getDi(participant1);
|
||||
participant2Bo = participant2.businessObject;
|
||||
participant2Di = getDi(participant2);
|
||||
dataStoreBo = dataStore.businessObject;
|
||||
dataStoreDi = getDi(dataStore);
|
||||
|
||||
// when
|
||||
commandStack.execute('dataStore.updateContainment', {
|
||||
dataStoreBo: dataStoreBo,
|
||||
dataStoreDi: dataStoreDi,
|
||||
newSemanticParent: participant2Bo.processRef,
|
||||
newDiParent: participant2Bo.di
|
||||
newDiParent: participant2Di
|
||||
});
|
||||
}));
|
||||
|
||||
|
@ -42,7 +48,7 @@ describe('features/modeling/behavior - update semantic parent', function() {
|
|||
|
||||
// then
|
||||
expect(dataStoreBo.$parent).to.eql(participant2Bo.processRef);
|
||||
expect(dataStoreBo.di.$parent).to.eql(participant2Bo.di.$parent);
|
||||
expect(dataStoreDi.$parent).to.eql(participant2Di.$parent);
|
||||
});
|
||||
|
||||
|
||||
|
@ -53,7 +59,7 @@ describe('features/modeling/behavior - update semantic parent', function() {
|
|||
|
||||
// then
|
||||
expect(dataStoreBo.$parent).to.eql(participant1Bo.processRef);
|
||||
expect(dataStoreBo.di.$parent).to.eql(participant1Bo.di.$parent);
|
||||
expect(dataStoreDi.$parent).to.eql(participant1Di.$parent);
|
||||
}));
|
||||
|
||||
|
||||
|
@ -65,7 +71,7 @@ describe('features/modeling/behavior - update semantic parent', function() {
|
|||
|
||||
// then
|
||||
expect(dataStoreBo.$parent).to.eql(participant2Bo.processRef);
|
||||
expect(dataStoreBo.di.$parent).to.eql(participant2Bo.di.$parent);
|
||||
expect(dataStoreDi.$parent).to.eql(participant2Di.$parent);
|
||||
}));
|
||||
|
||||
});
|
|
@ -12,6 +12,7 @@ import {
|
|||
} from 'diagram-js/lib/util/Elements';
|
||||
|
||||
import { asTRBL } from 'diagram-js/lib/layout/LayoutUtil';
|
||||
import { getDi } from 'lib/util/ModelUtil';
|
||||
|
||||
import {
|
||||
createCanvasEvent as canvasEvent
|
||||
|
@ -54,17 +55,17 @@ describe('features/modeling - create participant', function() {
|
|||
// given
|
||||
process = canvas.getRootElement();
|
||||
processBo = process.businessObject;
|
||||
processDi = processBo.di;
|
||||
processDi = getDi(process);
|
||||
|
||||
diRoot = processBo.di.$parent;
|
||||
diRoot = processDi.$parent;
|
||||
|
||||
participant = elementFactory.createParticipantShape({ x: 100, y: 100 });
|
||||
participantBo = participant.businessObject;
|
||||
participantDi = participantBo.di;
|
||||
participantDi = getDi(participant);
|
||||
|
||||
participant2 = elementFactory.createParticipantShape({ x: 100, y: 400 });
|
||||
participant2Bo = participant2.businessObject;
|
||||
participant2Di = participant2Bo.di;
|
||||
participant2Di = getDi(participant2);
|
||||
|
||||
participants = [ participant, participant2 ];
|
||||
}));
|
||||
|
@ -79,7 +80,7 @@ describe('features/modeling - create participant', function() {
|
|||
|
||||
collaboration = canvas.getRootElement();
|
||||
collaborationBo = collaboration.businessObject;
|
||||
collaborationDi = collaborationBo.di;
|
||||
collaborationDi = getDi(collaboration);
|
||||
}));
|
||||
|
||||
|
||||
|
@ -125,7 +126,7 @@ describe('features/modeling - create participant', function() {
|
|||
|
||||
collaboration = canvas.getRootElement();
|
||||
collaborationBo = collaboration.businessObject;
|
||||
collaborationDi = collaborationBo.di;
|
||||
collaborationDi = getDi(collaboration);
|
||||
}));
|
||||
|
||||
|
||||
|
@ -179,19 +180,16 @@ describe('features/modeling - create participant', function() {
|
|||
beforeEach(bootstrapModeler(processDiagramXML, { modules: testModules }));
|
||||
|
||||
var collaboration,
|
||||
collaborationBo,
|
||||
collaborationDi,
|
||||
participant,
|
||||
process,
|
||||
processBo,
|
||||
processDi;
|
||||
|
||||
beforeEach(inject(function(canvas, elementFactory, modeling) {
|
||||
|
||||
// given
|
||||
process = canvas.getRootElement();
|
||||
processBo = process.businessObject;
|
||||
processDi = processBo.di;
|
||||
processDi = getDi(process);
|
||||
|
||||
participant = elementFactory.createParticipantShape();
|
||||
|
||||
|
@ -199,8 +197,7 @@ describe('features/modeling - create participant', function() {
|
|||
modeling.createShape(participant, { x: 350, y: 200 }, process);
|
||||
|
||||
collaboration = canvas.getRootElement();
|
||||
collaborationBo = collaboration.businessObject;
|
||||
collaborationDi = collaborationBo.di;
|
||||
collaborationDi = getDi(collaboration);
|
||||
}));
|
||||
|
||||
|
||||
|
@ -210,8 +207,7 @@ describe('features/modeling - create participant', function() {
|
|||
expect(collaboration.children).to.have.length(4);
|
||||
|
||||
collaboration.children.forEach(function(child) {
|
||||
var childBo = child.businessObject,
|
||||
childDi = childBo.di;
|
||||
var childDi = getDi(child);
|
||||
|
||||
expect(childDi.$parent).to.eql(collaborationDi);
|
||||
expect(collaborationDi.planeElement).to.include(childDi);
|
||||
|
@ -220,8 +216,7 @@ describe('features/modeling - create participant', function() {
|
|||
expect(participant.children).to.have.length(5);
|
||||
|
||||
participant.children.forEach(function(child) {
|
||||
var childBo = child.businessObject,
|
||||
childDi = childBo.di;
|
||||
var childDi = getDi(child);
|
||||
|
||||
expect(childDi.$parent).to.eql(collaborationDi);
|
||||
expect(collaborationDi.planeElement).to.include(childDi);
|
||||
|
@ -237,8 +232,8 @@ describe('features/modeling - create participant', function() {
|
|||
expect(process.children).to.have.length(8);
|
||||
|
||||
process.children.forEach(function(child) {
|
||||
var childBo = child.businessObject,
|
||||
childDi = childBo.di;
|
||||
var childDi = getDi(child);
|
||||
|
||||
|
||||
expect(childDi.$parent).to.eql(processDi);
|
||||
expect(processDi.planeElement).to.include(childDi);
|
||||
|
@ -255,8 +250,8 @@ describe('features/modeling - create participant', function() {
|
|||
|
||||
// then
|
||||
process.children.forEach(function(child) {
|
||||
var childBo = child.businessObject,
|
||||
childDi = childBo.di;
|
||||
var childDi = getDi(child);
|
||||
|
||||
|
||||
expect(childDi.$parent).not.to.exist;
|
||||
expect(processDi.planeElement).not.to.include(childDi);
|
||||
|
|
|
@ -6,7 +6,7 @@ import {
|
|||
import modelingModule from 'lib/features/modeling';
|
||||
import coreModule from 'lib/core';
|
||||
|
||||
import { getBusinessObject } from 'lib/util/ModelUtil';
|
||||
import { getDi } from 'lib/util/ModelUtil';
|
||||
|
||||
|
||||
describe('features/modeling/behavior - IsHorizontalFix', function() {
|
||||
|
@ -37,7 +37,7 @@ describe('features/modeling/behavior - IsHorizontalFix', function() {
|
|||
var participant = modeling.createShape(participantShape, { x: 350, y: 200 }, processShape);
|
||||
|
||||
// then
|
||||
var isHorizontal = getBusinessObject(participant).di.get('isHorizontal');
|
||||
var isHorizontal = getDi(participant).get('isHorizontal');
|
||||
|
||||
expect(isHorizontal).to.be.true;
|
||||
})
|
||||
|
@ -56,7 +56,7 @@ describe('features/modeling/behavior - IsHorizontalFix', function() {
|
|||
var lane = modeling.addLane(participant, 'bottom');
|
||||
|
||||
// then
|
||||
var isHorizontal = getBusinessObject(lane).di.get('isHorizontal');
|
||||
var isHorizontal = getDi(lane).get('isHorizontal');
|
||||
|
||||
expect(isHorizontal).to.be.true;
|
||||
})
|
||||
|
@ -87,7 +87,7 @@ describe('features/modeling/behavior - IsHorizontalFix', function() {
|
|||
modeling.moveElements([ participant ], { x: 0, y: 0 });
|
||||
|
||||
// then
|
||||
var isHorizontal = getBusinessObject(participant).di.get('isHorizontal');
|
||||
var isHorizontal = getDi(participant).get('isHorizontal');
|
||||
|
||||
expect(isHorizontal).to.be.true;
|
||||
})
|
||||
|
@ -104,7 +104,7 @@ describe('features/modeling/behavior - IsHorizontalFix', function() {
|
|||
modeling.moveElements([ lane ], { x: 0, y: 0 });
|
||||
|
||||
// then
|
||||
var isHorizontal = getBusinessObject(lane).di.get('isHorizontal');
|
||||
var isHorizontal = getDi(lane).get('isHorizontal');
|
||||
|
||||
expect(isHorizontal).to.be.true;
|
||||
})
|
||||
|
@ -121,7 +121,7 @@ describe('features/modeling/behavior - IsHorizontalFix', function() {
|
|||
modeling.resizeShape(participant, { x: 0, y: 0, width: 10, height: 10 });
|
||||
|
||||
// then
|
||||
var isHorizontal = getBusinessObject(participant).di.get('isHorizontal');
|
||||
var isHorizontal = getDi(participant).get('isHorizontal');
|
||||
|
||||
expect(isHorizontal).to.be.true;
|
||||
})
|
||||
|
@ -138,7 +138,7 @@ describe('features/modeling/behavior - IsHorizontalFix', function() {
|
|||
modeling.resizeLane(lane, { x: 0, y: 0, width: 10, height: 10 });
|
||||
|
||||
// then
|
||||
var isHorizontal = getBusinessObject(lane).di.get('isHorizontal');
|
||||
var isHorizontal = getDi(lane).get('isHorizontal');
|
||||
|
||||
expect(isHorizontal).to.be.true;
|
||||
})
|
||||
|
@ -171,7 +171,7 @@ describe('features/modeling/behavior - IsHorizontalFix', function() {
|
|||
commandStack.undo();
|
||||
|
||||
// then
|
||||
var isHorizontal = getBusinessObject(participant).di.get('isHorizontal');
|
||||
var isHorizontal = getDi(participant).get('isHorizontal');
|
||||
|
||||
expect(isHorizontal).to.be.true;
|
||||
})
|
||||
|
@ -190,7 +190,7 @@ describe('features/modeling/behavior - IsHorizontalFix', function() {
|
|||
commandStack.undo();
|
||||
|
||||
// then
|
||||
var isHorizontal = getBusinessObject(lane).di.get('isHorizontal');
|
||||
var isHorizontal = getDi(lane).get('isHorizontal');
|
||||
|
||||
expect(isHorizontal).to.be.true;
|
||||
})
|
||||
|
@ -209,7 +209,7 @@ describe('features/modeling/behavior - IsHorizontalFix', function() {
|
|||
commandStack.undo();
|
||||
|
||||
// then
|
||||
var isHorizontal = getBusinessObject(participant).di.get('isHorizontal');
|
||||
var isHorizontal = getDi(participant).get('isHorizontal');
|
||||
|
||||
expect(isHorizontal).to.be.true;
|
||||
})
|
||||
|
@ -228,7 +228,7 @@ describe('features/modeling/behavior - IsHorizontalFix', function() {
|
|||
commandStack.undo();
|
||||
|
||||
// then
|
||||
var isHorizontal = getBusinessObject(lane).di.get('isHorizontal');
|
||||
var isHorizontal = getDi(lane).get('isHorizontal');
|
||||
|
||||
expect(isHorizontal).to.be.true;
|
||||
})
|
||||
|
|
|
@ -12,6 +12,8 @@ import {
|
|||
getExternalLabelMid
|
||||
} from 'lib/util/LabelUtil';
|
||||
|
||||
import { getDi } from 'lib/util/ModelUtil';
|
||||
|
||||
import {
|
||||
assign,
|
||||
map,
|
||||
|
@ -287,12 +289,12 @@ describe('behavior - LabelBehavior', function() {
|
|||
type: 'bpmn:EndEvent',
|
||||
businessObject: businessObject
|
||||
}),
|
||||
target = targetShape.businessObject;
|
||||
targetDi = getDi(targetShape);
|
||||
|
||||
// then
|
||||
expect(target.di.label).to.exist;
|
||||
expect(targetDi.label).to.exist;
|
||||
|
||||
expect(target.di.label).to.have.bounds(targetShape.label);
|
||||
expect(targetDi.label).to.have.bounds(targetShape.label);
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -313,12 +315,12 @@ describe('behavior - LabelBehavior', function() {
|
|||
type: 'bpmn:EndEvent',
|
||||
businessObject: businessObject
|
||||
}),
|
||||
target = targetShape.businessObject;
|
||||
targetDi = getDi(targetShape);
|
||||
|
||||
// then
|
||||
expect(target.di.label).to.exist;
|
||||
expect(targetDi.label).to.exist;
|
||||
|
||||
expect(target.di.label).to.have.bounds(targetShape.label);
|
||||
expect(targetDi.label).to.have.bounds(targetShape.label);
|
||||
}
|
||||
));
|
||||
|
||||
|
@ -354,7 +356,7 @@ describe('behavior - LabelBehavior', function() {
|
|||
|
||||
// given
|
||||
var startEventShape = elementRegistry.get('StartEvent_1'),
|
||||
startEvent = startEventShape.businessObject,
|
||||
startEventDi = getDi(startEventShape),
|
||||
labelShape = startEventShape.label;
|
||||
|
||||
// when
|
||||
|
@ -363,8 +365,8 @@ describe('behavior - LabelBehavior', function() {
|
|||
// then
|
||||
expect(labelShape.x).to.be.within(193, 194);
|
||||
expect(labelShape.y).to.equal(128);
|
||||
expect(startEvent.di.label.bounds.x).to.be.within(193, 194);
|
||||
expect(startEvent.di.label.bounds.y).to.equal(128);
|
||||
expect(startEventDi.label.bounds.x).to.be.within(193, 194);
|
||||
expect(startEventDi.label.bounds.y).to.equal(128);
|
||||
}));
|
||||
|
||||
|
||||
|
|
|
@ -3,7 +3,10 @@ import {
|
|||
inject
|
||||
} from 'test/TestHelper';
|
||||
|
||||
import { is } from 'lib/util/ModelUtil';
|
||||
import {
|
||||
getDi,
|
||||
is
|
||||
} from 'lib/util/ModelUtil';
|
||||
|
||||
import modelingModule from 'lib/features/modeling';
|
||||
import coreModule from 'lib/core';
|
||||
|
@ -56,11 +59,11 @@ describe('features/modeling - remove participant behavior', function() {
|
|||
// given
|
||||
var participantShape = elementRegistry.get('_Participant_2'),
|
||||
participant = participantShape.businessObject,
|
||||
participantDi = participant.di,
|
||||
participantDi = getDi(participantShape),
|
||||
process = participant.processRef,
|
||||
collaborationElement = participantShape.parent,
|
||||
collaboration = collaborationElement.businessObject,
|
||||
diPlane = collaboration.di,
|
||||
diPlane = getDi(collaborationElement),
|
||||
bpmnDefinitions = collaboration.$parent;
|
||||
|
||||
// when
|
||||
|
@ -76,14 +79,14 @@ describe('features/modeling - remove participant behavior', function() {
|
|||
|
||||
// collaboration DI is unwired
|
||||
expect(participantDi.$parent).not.to.be.ok;
|
||||
expect(collaboration.di).not.to.be.ok;
|
||||
expect(getDi(collaborationElement)).not.to.be.ok;
|
||||
|
||||
expect(bpmnDefinitions.rootElements).not.to.include(process);
|
||||
expect(bpmnDefinitions.rootElements).not.to.include(collaboration);
|
||||
|
||||
// process DI is wired
|
||||
expect(diPlane.bpmnElement).to.eql(newRootBusinessObject);
|
||||
expect(newRootBusinessObject.di).to.eql(diPlane);
|
||||
expect(getDi(newRootShape)).to.eql(diPlane);
|
||||
|
||||
expect(bpmnDefinitions.rootElements).to.include(newRootBusinessObject);
|
||||
}));
|
||||
|
@ -96,8 +99,9 @@ describe('features/modeling - remove participant behavior', function() {
|
|||
participant = participantShape.businessObject,
|
||||
originalRootElement = participantShape.parent,
|
||||
originalRootElementBo = originalRootElement.businessObject,
|
||||
originalRootElementDi = getDi(originalRootElement),
|
||||
bpmnDefinitions = originalRootElementBo.$parent,
|
||||
participantDi = participant.di,
|
||||
participantDi = getDi(participantShape),
|
||||
diPlane = participantDi.$parent;
|
||||
|
||||
modeling.removeShape(participantShape);
|
||||
|
@ -112,7 +116,7 @@ describe('features/modeling - remove participant behavior', function() {
|
|||
expect(canvas.getRootElement()).to.eql(originalRootElement);
|
||||
|
||||
// di is unwired
|
||||
expect(participantDi.$parent).to.eql(originalRootElementBo.di);
|
||||
expect(participantDi.$parent).to.eql(originalRootElementDi);
|
||||
|
||||
// new di is wired
|
||||
expect(diPlane.bpmnElement).to.eql(originalRootElementBo);
|
||||
|
|
|
@ -6,7 +6,10 @@ import {
|
|||
import modelingModule from 'lib/features/modeling';
|
||||
import coreModule from 'lib/core';
|
||||
|
||||
import { is } from 'lib/util/ModelUtil';
|
||||
import {
|
||||
is,
|
||||
getDi
|
||||
} from 'lib/util/ModelUtil';
|
||||
|
||||
var testModules = [
|
||||
modelingModule,
|
||||
|
@ -44,10 +47,9 @@ describe('features/modeling - collapse and expand elements', function() {
|
|||
isExpanded: true
|
||||
}
|
||||
);
|
||||
var businessObject = expandedSubProcess.businessObject;
|
||||
|
||||
// then +-marker is removed
|
||||
expect(businessObject.di.isExpanded).to.eql(true);
|
||||
expect(getDi(expandedSubProcess).isExpanded).to.eql(true);
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -242,10 +244,9 @@ describe('features/modeling - collapse and expand elements', function() {
|
|||
|
||||
// when
|
||||
commandStack.undo();
|
||||
var businessObject = expandedSubProcess.businessObject;
|
||||
|
||||
// then +-marker is placed
|
||||
expect(businessObject.di.isExpanded).to.eql(false);
|
||||
expect(getDi(expandedSubProcess).isExpanded).to.eql(false);
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -331,10 +332,9 @@ describe('features/modeling - collapse and expand elements', function() {
|
|||
isExpanded: false
|
||||
}
|
||||
);
|
||||
var businessObject = collapsedSubProcess.businessObject;
|
||||
|
||||
// then +-marker is set
|
||||
expect(businessObject.di.isExpanded).to.eql(false);
|
||||
expect(getDi(collapsedSubProcess).isExpanded).to.eql(false);
|
||||
})
|
||||
);
|
||||
|
||||
|
@ -439,10 +439,9 @@ describe('features/modeling - collapse and expand elements', function() {
|
|||
|
||||
// when
|
||||
commandStack.undo();
|
||||
var businessObject = collapsedSubProcess.businessObject;
|
||||
|
||||
// then +-marker is placed
|
||||
expect(businessObject.di.isExpanded).to.eql(true);
|
||||
expect(getDi(collapsedSubProcess).isExpanded).to.eql(true);
|
||||
})
|
||||
);
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ import {
|
|||
inject
|
||||
} from 'test/TestHelper';
|
||||
|
||||
import { getDi } from 'lib/util/ModelUtil';
|
||||
|
||||
import modelingModule from 'lib/features/modeling';
|
||||
import coreModule from 'lib/core';
|
||||
|
||||
|
@ -41,7 +43,7 @@ describe('features/modeling - layout connection', function() {
|
|||
|
||||
// given
|
||||
var sequenceFlowConnection = elementRegistry.get('SequenceFlow_1'),
|
||||
sequenceFlow = sequenceFlowConnection.businessObject;
|
||||
sequenceFlowDi = getDi(sequenceFlowConnection);
|
||||
|
||||
var expectedWaypoints = sequenceFlowConnection.waypoints;
|
||||
|
||||
|
@ -58,7 +60,7 @@ describe('features/modeling - layout connection', function() {
|
|||
// expect cropped waypoints in di
|
||||
var diWaypoints = bpmnFactory.createDiWaypoints(expectedWaypoints);
|
||||
|
||||
expect(sequenceFlow.di.waypoint).eql(diWaypoints);
|
||||
expect(sequenceFlowDi.waypoint).eql(diWaypoints);
|
||||
}));
|
||||
|
||||
|
||||
|
@ -66,10 +68,10 @@ describe('features/modeling - layout connection', function() {
|
|||
|
||||
// given
|
||||
var sequenceFlowConnection = elementRegistry.get('SequenceFlow_1'),
|
||||
sequenceFlow = sequenceFlowConnection.businessObject;
|
||||
sequenceFlowDi = getDi(sequenceFlowConnection);
|
||||
|
||||
var oldWaypoints = sequenceFlowConnection.waypoints,
|
||||
oldDiWaypoints = sequenceFlow.di.waypoint;
|
||||
oldDiWaypoints = sequenceFlowDi.waypoint;
|
||||
|
||||
modeling.layoutConnection(sequenceFlowConnection);
|
||||
|
||||
|
@ -78,7 +80,7 @@ describe('features/modeling - layout connection', function() {
|
|||
|
||||
// then
|
||||
expect(sequenceFlowConnection.waypoints).eql(oldWaypoints);
|
||||
expect(sequenceFlow.di.waypoint).eql(oldDiWaypoints);
|
||||
expect(sequenceFlowDi.waypoint).eql(oldDiWaypoints);
|
||||
}));
|
||||
|
||||
|
||||
|
@ -86,12 +88,13 @@ describe('features/modeling - layout connection', function() {
|
|||
|
||||
// given
|
||||
var sequenceFlowConnection = elementRegistry.get('SequenceFlow_1'),
|
||||
sequenceFlow = sequenceFlowConnection.businessObject;
|
||||
sequenceFlowDi = getDi(sequenceFlowConnection);
|
||||
|
||||
|
||||
modeling.layoutConnection(sequenceFlowConnection);
|
||||
|
||||
var newWaypoints = sequenceFlowConnection.waypoints,
|
||||
newDiWaypoints = sequenceFlow.di.waypoint;
|
||||
newDiWaypoints = sequenceFlowDi.waypoint;
|
||||
|
||||
// when
|
||||
commandStack.undo();
|
||||
|
@ -99,7 +102,7 @@ describe('features/modeling - layout connection', function() {
|
|||
|
||||
// then
|
||||
expect(sequenceFlowConnection.waypoints).eql(newWaypoints);
|
||||
expect(sequenceFlow.di.waypoint).eql(newDiWaypoints);
|
||||
expect(sequenceFlowDi.waypoint).eql(newDiWaypoints);
|
||||
}));
|
||||
|
||||
});
|
||||
|
|
|
@ -17,7 +17,8 @@ import camundaModdleModule from 'camunda-bpmn-moddle/lib';
|
|||
import camundaPackage from 'camunda-bpmn-moddle/resources/camunda.json';
|
||||
|
||||
import {
|
||||
is
|
||||
is,
|
||||
getDi
|
||||
} from 'lib/util/ModelUtil';
|
||||
|
||||
import {
|
||||
|
@ -1640,14 +1641,14 @@ describe('features/replace - bpmn replace', function() {
|
|||
var newElement = bpmnReplace.replaceElement(task, newElementData);
|
||||
|
||||
// then
|
||||
var businessObject = newElement.businessObject;
|
||||
var di = getDi(newElement);
|
||||
|
||||
expect(businessObject.di.get('background-color')).to.equal(fill);
|
||||
expect(businessObject.di.get('border-color')).to.equal(stroke);
|
||||
expect(di.get('background-color')).to.equal(fill);
|
||||
expect(di.get('border-color')).to.equal(stroke);
|
||||
|
||||
// TODO @barmac: remove when we drop bpmn.io properties
|
||||
expect(businessObject.di.fill).to.equal(fill);
|
||||
expect(businessObject.di.stroke).to.equal(stroke);
|
||||
expect(di.fill).to.equal(fill);
|
||||
expect(di.stroke).to.equal(stroke);
|
||||
}));
|
||||
|
||||
});
|
||||
|
|
|
@ -139,7 +139,7 @@ describe('import - BpmnTreeWalker', function() {
|
|||
var element = findElementWithId(definitions, 'SubProcess_1');
|
||||
|
||||
// will error
|
||||
element.di = 'DI';
|
||||
definitions.diagrams[0].plane.planeElement.push({ bpmnElement: element });
|
||||
|
||||
// when
|
||||
walker.handleDefinitions(definitions);
|
||||
|
|
|
@ -131,7 +131,7 @@ describe('import - Importer', function() {
|
|||
events.push({
|
||||
type: 'add',
|
||||
semantic: e.element.businessObject.id,
|
||||
di: e.element.businessObject.di.id,
|
||||
di: e.element.di.id,
|
||||
diagramElement: e.element && e.element.id
|
||||
});
|
||||
});
|
||||
|
@ -167,7 +167,7 @@ describe('import - Importer', function() {
|
|||
events.push({
|
||||
type: 'add',
|
||||
semantic: e.element.businessObject.id,
|
||||
di: e.element.businessObject.di.id,
|
||||
di: e.element.di.id,
|
||||
diagramElement: e.element && e.element.id
|
||||
});
|
||||
});
|
||||
|
@ -293,7 +293,7 @@ describe('import - Importer', function() {
|
|||
events.push({
|
||||
type: 'add',
|
||||
semantic: e.element.businessObject.id,
|
||||
di: e.element.businessObject.di.id,
|
||||
di: e.element.di.id,
|
||||
diagramElement: e.element && e.element.id
|
||||
});
|
||||
});
|
||||
|
@ -404,7 +404,7 @@ describe('import - Importer', function() {
|
|||
events.push({
|
||||
type: 'add',
|
||||
semantic: e.element.businessObject.id,
|
||||
di: e.element.businessObject.di.id,
|
||||
di: e.element.di.id,
|
||||
diagramElement: e.element && e.element.id
|
||||
});
|
||||
});
|
||||
|
@ -438,7 +438,7 @@ describe('import - Importer', function() {
|
|||
events.push({
|
||||
type: 'add',
|
||||
semantic: e.element.businessObject.id,
|
||||
di: e.element.businessObject.di.id,
|
||||
di: e.element.di.id,
|
||||
diagramElement: e.element && e.element.id
|
||||
});
|
||||
});
|
||||
|
@ -474,7 +474,7 @@ describe('import - Importer', function() {
|
|||
events.push({
|
||||
type: 'add',
|
||||
semantic: e.element.businessObject.id,
|
||||
di: e.element.businessObject.di.id,
|
||||
di: e.element.di.id,
|
||||
diagramElement: e.element && e.element.id,
|
||||
isFrame: e.element && e.element.isFrame
|
||||
});
|
||||
|
|
|
@ -3,7 +3,10 @@ import {
|
|||
inject
|
||||
} from 'test/TestHelper';
|
||||
|
||||
import { is } from 'lib/util/ModelUtil';
|
||||
import {
|
||||
is,
|
||||
getDi
|
||||
} from 'lib/util/ModelUtil';
|
||||
|
||||
|
||||
describe('import - model wiring', function() {
|
||||
|
@ -82,7 +85,7 @@ describe('import - model wiring', function() {
|
|||
var subProcessShape = elementRegistry.get('SubProcess_1');
|
||||
|
||||
var subProcess = subProcessShape.businessObject;
|
||||
var subProcessDi = subProcess.di;
|
||||
var subProcessDi = getDi(subProcessShape);
|
||||
|
||||
// then
|
||||
expect(subProcessDi).to.exist;
|
||||
|
@ -96,7 +99,7 @@ describe('import - model wiring', function() {
|
|||
var sequenceFlowElement = elementRegistry.get('SequenceFlow_1');
|
||||
|
||||
var sequenceFlow = sequenceFlowElement.businessObject;
|
||||
var sequenceFlowDi = sequenceFlow.di;
|
||||
var sequenceFlowDi = getDi(sequenceFlowElement);
|
||||
|
||||
// then
|
||||
expect(sequenceFlowDi).to.exist;
|
||||
|
|
|
@ -7,7 +7,8 @@ import coreModule from 'lib/core';
|
|||
import modelingModule from 'lib/features/modeling';
|
||||
|
||||
import {
|
||||
is
|
||||
is,
|
||||
getDi
|
||||
} from 'lib/util/ModelUtil';
|
||||
|
||||
|
||||
|
@ -69,4 +70,28 @@ describe('util/ModelUtil', function() {
|
|||
expect(is(foo, 'FOO')).to.be.false;
|
||||
}));
|
||||
|
||||
|
||||
describe('#getDi', function() {
|
||||
|
||||
it('return a di', inject(function() {
|
||||
|
||||
// given
|
||||
var element = { di: 'foo' };
|
||||
|
||||
// then
|
||||
expect(getDi(element)).to.equal('foo');
|
||||
}));
|
||||
|
||||
|
||||
it('should ignore element without di', inject(function() {
|
||||
|
||||
// given
|
||||
var element = { };
|
||||
|
||||
// then
|
||||
expect(getDi(element)).to.be.undefined;
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
});
|
Loading…
Reference in New Issue