chore(project): fix linting errors
This commit is contained in:
parent
7d08b98c0f
commit
33156e43be
|
@ -197,6 +197,7 @@ Modeler.prototype._collectIds = function(definitions, context) {
|
|||
};
|
||||
|
||||
Modeler.prototype._interactionModules = [
|
||||
|
||||
// non-modeling components
|
||||
KeyboardMoveModule,
|
||||
MoveCanvasModule,
|
||||
|
@ -205,6 +206,7 @@ Modeler.prototype._interactionModules = [
|
|||
];
|
||||
|
||||
Modeler.prototype._modelingModules = [
|
||||
|
||||
// modeling components
|
||||
AlignElementsModule,
|
||||
AutoPlaceModule,
|
||||
|
|
|
@ -1154,6 +1154,7 @@ export default function BpmnRenderer(
|
|||
var text = getSemantic(element).name;
|
||||
renderLaneLabel(parentGfx, text, element);
|
||||
} else {
|
||||
|
||||
// Collapsed pool draw text inline
|
||||
var text2 = getSemantic(element).name;
|
||||
renderLabel(parentGfx, text2, {
|
||||
|
|
|
@ -151,6 +151,7 @@ export function getFlowNodeDistance(source, element) {
|
|||
getTargets(source, isReference).map(toTargetNode(5)),
|
||||
getSources(source, isReference).map(toSourceNode(1))
|
||||
), function(nodes, node) {
|
||||
|
||||
// filter out shapes connected twice via source or target
|
||||
nodes[node.shape.id + '__weight_' + node.weight] = node;
|
||||
|
||||
|
|
|
@ -185,6 +185,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|||
function splitLaneHandler(count) {
|
||||
|
||||
return function(event, element) {
|
||||
|
||||
// actual split
|
||||
modeling.splitLane(element, count);
|
||||
|
||||
|
@ -338,6 +339,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|||
}
|
||||
|
||||
if (!popupMenu.isEmpty(element, 'bpmn-replace')) {
|
||||
|
||||
// Replace menu entry
|
||||
assign(actions, {
|
||||
'replace': {
|
||||
|
@ -400,6 +402,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|||
var deleteAllowed = rules.allowed('elements.delete', { elements: [ element ] });
|
||||
|
||||
if (isArray(deleteAllowed)) {
|
||||
|
||||
// was the element returned as a deletion candidate?
|
||||
deleteAllowed = deleteAllowed[0] === element;
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ BpmnEditorActions.prototype._registerDefaultActions = function(injector) {
|
|||
|
||||
if (canvas && elementRegistry && selection) {
|
||||
this._registerAction('selectElements', function() {
|
||||
|
||||
// select all elements except for the invisible
|
||||
// root element
|
||||
var rootElement = canvas.getRootElement();
|
||||
|
|
|
@ -352,6 +352,7 @@ function getBoundaryEventTargetLayout(attachOrientation, targetOrientation, atta
|
|||
// attached to either top, right, bottom or left side
|
||||
if (attachedToSide) {
|
||||
if (isHorizontalOrientation(attachOrientation)) {
|
||||
|
||||
// orientation is 'right' or 'left'
|
||||
|
||||
// opposite horizontal orientation or same orientation
|
||||
|
@ -365,6 +366,7 @@ function getBoundaryEventTargetLayout(attachOrientation, targetOrientation, atta
|
|||
// fallback
|
||||
return 'v';
|
||||
} else {
|
||||
|
||||
// orientation is 'top' or 'bottom'
|
||||
|
||||
// opposite vertical orientation or same orientation
|
||||
|
@ -379,6 +381,7 @@ function getBoundaryEventTargetLayout(attachOrientation, targetOrientation, atta
|
|||
return 'h';
|
||||
}
|
||||
}
|
||||
|
||||
// attached to either top-right, top-left, bottom-right or bottom-left corner
|
||||
|
||||
// orientation is 'right', 'left'
|
||||
|
|
|
@ -77,6 +77,7 @@ export default function BpmnUpdater(
|
|||
var context = e.context;
|
||||
|
||||
var element = context.shape || context.connection,
|
||||
|
||||
// oldParent is the (old) new parent, because we are undoing
|
||||
oldParent = context.parent || context.newParent;
|
||||
|
||||
|
@ -310,6 +311,7 @@ BpmnUpdater.prototype.updateAttachment = function(context) {
|
|||
};
|
||||
|
||||
BpmnUpdater.prototype.updateParent = function(element, oldParent) {
|
||||
|
||||
// do not update BPMN 2.0 label parent
|
||||
if (element instanceof Label) {
|
||||
return;
|
||||
|
@ -517,6 +519,7 @@ BpmnUpdater.prototype.updateSemanticParent = function(businessObject, newParent,
|
|||
|
||||
if (is(newParent, 'bpmn:Lane')) {
|
||||
do {
|
||||
|
||||
// unwrap Lane -> LaneSet -> (Lane | FlowElementsContainer)
|
||||
newParent = newParent.$parent.$parent;
|
||||
} while (is(newParent, 'bpmn:Lane'));
|
||||
|
@ -596,6 +599,7 @@ BpmnUpdater.prototype.updateSemanticParent = function(businessObject, newParent,
|
|||
var children;
|
||||
|
||||
if (businessObject.$parent) {
|
||||
|
||||
// remove from old parent
|
||||
children = businessObject.$parent.get(containment);
|
||||
collectionRemove(children, businessObject);
|
||||
|
@ -604,6 +608,7 @@ BpmnUpdater.prototype.updateSemanticParent = function(businessObject, newParent,
|
|||
if (!newParent) {
|
||||
businessObject.$parent = null;
|
||||
} else {
|
||||
|
||||
// add to new parent
|
||||
children = newParent.get(containment);
|
||||
children.push(businessObject);
|
||||
|
@ -671,6 +676,7 @@ BpmnUpdater.prototype.updateConnection = function(context) {
|
|||
} else
|
||||
|
||||
if (is(businessObject, 'bpmn:DataInputAssociation')) {
|
||||
|
||||
// handle obnoxious isMsome sourceRef
|
||||
businessObject.get('sourceRef')[0] = newSource;
|
||||
|
||||
|
|
|
@ -41,6 +41,7 @@ ElementFactory.$inject = [
|
|||
ElementFactory.prototype.baseCreate = BaseElementFactory.prototype.create;
|
||||
|
||||
ElementFactory.prototype.create = function(elementType, attrs) {
|
||||
|
||||
// no special magic for labels,
|
||||
// we assume their businessObjects have already been created
|
||||
// and wired via attrs
|
||||
|
|
|
@ -62,6 +62,7 @@ export default function DropOnFlowBehavior(eventBus, bpmnRules, modeling) {
|
|||
target = targetFlow.target;
|
||||
|
||||
if (bpmnRules.canConnect(source, shape, targetFlow)) {
|
||||
|
||||
// reconnect source -> inserted shape
|
||||
modeling.reconnectEnd(targetFlow, shape, waypointsBefore || position);
|
||||
|
||||
|
@ -71,6 +72,7 @@ export default function DropOnFlowBehavior(eventBus, bpmnRules, modeling) {
|
|||
if (bpmnRules.canConnect(shape, target, targetFlow)) {
|
||||
|
||||
if (!incomingConnection) {
|
||||
|
||||
// reconnect inserted shape -> end
|
||||
modeling.reconnectStart(targetFlow, shape, waypointsAfter || position);
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ export default function IsHorizontalFix(eventBus) {
|
|||
var bo = getBusinessObject(event.context.shape);
|
||||
|
||||
if (isAny(bo, elementTypesToUpdate) && !bo.di.get('isHorizontal')) {
|
||||
|
||||
// set attribute directly to avoid modeling#updateProperty side effects
|
||||
bo.di.set('isHorizontal', true);
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@ export default function RemoveParticipantBehavior(eventBus, modeling) {
|
|||
var collaborationRoot = context.collaborationRoot;
|
||||
|
||||
if (collaborationRoot && !collaborationRoot.businessObject.participants.length) {
|
||||
|
||||
// replace empty collaboration with process diagram
|
||||
modeling.makeProcess();
|
||||
}
|
||||
|
|
|
@ -42,6 +42,7 @@ export default function ResizeLaneBehavior(eventBus, modeling) {
|
|||
if (is(shape, 'bpmn:Lane') || is(shape, 'bpmn:Participant')) {
|
||||
|
||||
if (canExecute) {
|
||||
|
||||
// ensure we have actual pixel values for new bounds
|
||||
// (important when zoom level was > 1 during move)
|
||||
newBounds = roundBounds(newBounds);
|
||||
|
|
|
@ -43,6 +43,7 @@ export default function ToggleElementCollapseBehaviour(
|
|||
visibleBBox = computeChildrenBBox(visibleElements);
|
||||
|
||||
if (visibleBBox) {
|
||||
|
||||
// center to visibleBBox with max(defaultSize, childrenBounds)
|
||||
newBounds.width = Math.max(visibleBBox.width, newBounds.width);
|
||||
newBounds.height = Math.max(visibleBBox.height, newBounds.height);
|
||||
|
@ -50,6 +51,7 @@ export default function ToggleElementCollapseBehaviour(
|
|||
newBounds.x = visibleBBox.x + (visibleBBox.width - newBounds.width) / 2;
|
||||
newBounds.y = visibleBBox.y + (visibleBBox.height - newBounds.height) / 2;
|
||||
} else {
|
||||
|
||||
// center to collapsed shape with defaultSize
|
||||
newBounds.x = shape.x + (shape.width - newBounds.width) / 2;
|
||||
newBounds.y = shape.y + (shape.height - newBounds.height) / 2;
|
||||
|
@ -78,12 +80,14 @@ export default function ToggleElementCollapseBehaviour(
|
|||
}
|
||||
|
||||
if (!shape.collapsed) {
|
||||
|
||||
// all children got made visible through djs, hide empty labels
|
||||
hideEmptyLables(shape.children);
|
||||
|
||||
// remove collapsed marker
|
||||
getBusinessObject(shape).di.isExpanded = true;
|
||||
} else {
|
||||
|
||||
// place collapsed marker
|
||||
getBusinessObject(shape).di.isExpanded = false;
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ export function vectorLength(v) {
|
|||
* @return {Float}
|
||||
*/
|
||||
export function getAngle(line) {
|
||||
|
||||
// return value is between 0, 180 and -180, -0
|
||||
// @janstuemmel: maybe replace return a/b with b/a
|
||||
return Math.atan((line[1].y - line[0].y) / (line[1].x - line[0].x));
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
* @return {Point}
|
||||
*/
|
||||
export default function lineIntersect(l1s, l1e, l2s, l2e) {
|
||||
|
||||
// if the lines intersect, the result contains the x and y of the
|
||||
// intersection (treating the lines as infinite) and booleans for
|
||||
// whether line segment 1 or line segment 2 contain the point
|
||||
|
|
|
@ -69,9 +69,11 @@ SplitLaneHandler.prototype.preExecute = function(context) {
|
|||
};
|
||||
|
||||
if (idx < existingLanesCount) {
|
||||
|
||||
// resize existing lane
|
||||
modeling.resizeShape(childLanes[idx], laneBounds);
|
||||
} else {
|
||||
|
||||
// create a new lane at position
|
||||
newLaneAttrs = {
|
||||
type: 'bpmn:Lane'
|
||||
|
|
|
@ -193,6 +193,7 @@ function setProperties(businessObject, properties) {
|
|||
if (key !== DI) {
|
||||
businessObject.set(key, value);
|
||||
} else {
|
||||
|
||||
// only update, if businessObject.di exists
|
||||
if (businessObject.di) {
|
||||
setDiProperties(businessObject.di, value);
|
||||
|
|
|
@ -34,6 +34,7 @@ export default function BpmnOrderingProvider(eventBus, canvas, translate) {
|
|||
]
|
||||
}
|
||||
},
|
||||
|
||||
// handle DataAssociation(s) like message flows and render them always on top
|
||||
{
|
||||
type: 'bpmn:DataAssociation',
|
||||
|
|
|
@ -327,12 +327,14 @@ ReplaceMenuProvider.prototype._createSequenceFlowEntries = function(element, rep
|
|||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
// default flows
|
||||
if (is(businessObject.sourceRef, 'bpmn:Activity') && businessObject.conditionExpression) {
|
||||
return menuEntries.push(self._createMenuEntry(entry, element, function() {
|
||||
modeling.updateProperties(element, { conditionExpression: undefined });
|
||||
}));
|
||||
}
|
||||
|
||||
// conditional flows
|
||||
if ((is(businessObject.sourceRef, 'bpmn:ExclusiveGateway') ||
|
||||
is(businessObject.sourceRef, 'bpmn:InclusiveGateway') ||
|
||||
|
|
|
@ -54,11 +54,13 @@ function toggeling(element, target) {
|
|||
var targetCollapsed;
|
||||
|
||||
if (target && (has(target, 'collapsed') || has(target, 'isExpanded'))) {
|
||||
|
||||
// property is explicitly set so use it
|
||||
targetCollapsed = (
|
||||
has(target, 'collapsed') ? target.collapsed : !target.isExpanded
|
||||
);
|
||||
} else {
|
||||
|
||||
// keep old state
|
||||
targetCollapsed = oldCollapsed;
|
||||
}
|
||||
|
@ -105,6 +107,7 @@ export default function BpmnReplace(
|
|||
if (isSubProcess(oldBusinessObject)) {
|
||||
if (type === 'bpmn:SubProcess') {
|
||||
if (toggeling(element, target)) {
|
||||
|
||||
// expanding or collapsing process
|
||||
modeling.toggleCollapse(element);
|
||||
|
||||
|
@ -176,9 +179,11 @@ export default function BpmnReplace(
|
|||
if (is(oldBusinessObject, 'bpmn:Activity')) {
|
||||
|
||||
if (isSubProcess(oldBusinessObject)) {
|
||||
|
||||
// no toggeling, so keep old state
|
||||
newElement.isExpanded = isExpanded(oldBusinessObject);
|
||||
}
|
||||
|
||||
// else if property is explicitly set, use it
|
||||
else if (target && has(target, 'isExpanded')) {
|
||||
newElement.isExpanded = target.isExpanded;
|
||||
|
@ -205,6 +210,7 @@ export default function BpmnReplace(
|
|||
if (target.isExpanded === true) {
|
||||
newBusinessObject.processRef = bpmnFactory.create('bpmn:Process');
|
||||
} else {
|
||||
|
||||
// remove children when transforming to collapsed pool
|
||||
hints.moveChildren = false;
|
||||
}
|
||||
|
|
|
@ -311,6 +311,7 @@ export var GATEWAY = [
|
|||
eventGatewayType: 'Exclusive'
|
||||
}
|
||||
}
|
||||
|
||||
// Gateways deactivated until https://github.com/bpmn-io/bpmn-js/issues/194
|
||||
// {
|
||||
// label: 'Event based instantiating Gateway',
|
||||
|
@ -775,6 +776,7 @@ export var PARTICIPANT = [
|
|||
{
|
||||
label: 'Collapsed Pool',
|
||||
actionName: 'replace-with-collapsed-pool',
|
||||
|
||||
// TODO(@janstuemmel): maybe design new icon
|
||||
className: 'bpmn-icon-lane',
|
||||
target: {
|
||||
|
|
|
@ -79,6 +79,7 @@ BpmnRules.prototype.init = function() {
|
|||
try {
|
||||
return canConnect(source, target);
|
||||
} finally {
|
||||
|
||||
// unset temporary target parent
|
||||
if (targetParent) {
|
||||
target.parent = null;
|
||||
|
|
|
@ -185,6 +185,7 @@ BpmnImporter.prototype.add = function(semantic, parentElement) {
|
|||
semantic: elementToString(semantic)
|
||||
}));
|
||||
}
|
||||
|
||||
// (optional) LABEL
|
||||
if (isLabelExternal(semantic) && getLabel(element)) {
|
||||
this.addLabel(semantic, element);
|
||||
|
@ -246,6 +247,7 @@ BpmnImporter.prototype.addLabel = function(semantic, element) {
|
|||
text = getLabel(element);
|
||||
|
||||
if (text) {
|
||||
|
||||
// get corrected bounds from actual layouted text
|
||||
bounds = this._textRenderer.getExternalLabelBounds(bounds, text);
|
||||
}
|
||||
|
|
|
@ -156,6 +156,7 @@ export default function BpmnTreeWalker(handler, translate) {
|
|||
* @throws {Error} if no diagram to display could be found
|
||||
*/
|
||||
function handleDefinitions(definitions, diagram) {
|
||||
|
||||
// make sure we walk the correct bpmnElement
|
||||
|
||||
var diagrams = definitions.diagrams;
|
||||
|
@ -399,6 +400,7 @@ export default function BpmnTreeWalker(handler, translate) {
|
|||
} else if (is(e, 'bpmn:FlowNode')) {
|
||||
handleFlowNode(e, context);
|
||||
} else if (is(e, 'bpmn:DataObject')) {
|
||||
|
||||
// SKIP (assume correct referencing via DataObjectReference)
|
||||
} else if (is(e, 'bpmn:DataStoreReference')) {
|
||||
handleDataElement(e, context);
|
||||
|
@ -439,6 +441,7 @@ export default function BpmnTreeWalker(handler, translate) {
|
|||
|
||||
|
||||
function wireFlowNodeRefs(lane) {
|
||||
|
||||
// wire the virtual flowNodeRefs <-> relationship
|
||||
forEach(lane.flowNodeRef, function(flowNode) {
|
||||
var lanes = flowNode.get('lanes');
|
||||
|
|
|
@ -57,6 +57,7 @@ export function bootstrapBpmnJS(BpmnJS, diagram, options, locals) {
|
|||
// This is needed if other libraries rely on this helper for testing
|
||||
// while not adding the mocha-test-container-support as a dependency.
|
||||
try {
|
||||
|
||||
// 'this' is the current test context
|
||||
testContainer = TestContainer.get(this);
|
||||
} catch (e) {
|
||||
|
|
|
@ -54,6 +54,7 @@ describe('custom elements', function() {
|
|||
|
||||
|
||||
it('should render custom elements', inject(function(elementRegistry) {
|
||||
|
||||
// when
|
||||
|
||||
// then
|
||||
|
@ -63,6 +64,7 @@ describe('custom elements', function() {
|
|||
|
||||
|
||||
it('should get the correct custom elements path', inject(function(graphicsFactory) {
|
||||
|
||||
// when
|
||||
var trianglePath = graphicsFactory.getShapePath(triangle),
|
||||
circlePath = graphicsFactory.getShapePath(circle);
|
||||
|
@ -74,6 +76,7 @@ describe('custom elements', function() {
|
|||
|
||||
|
||||
it('should still render bpmn elements', inject(function(elementFactory) {
|
||||
|
||||
// when
|
||||
var startEvent = elementFactory.createShape({ type: 'bpmn:StartEvent' });
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@ CustomRules.prototype.init = function() {
|
|||
});
|
||||
|
||||
this.addRule('connection.updateWaypoints', HIGH_PRIORITY, function(context) {
|
||||
|
||||
// OK! but visually ignore
|
||||
return null;
|
||||
});
|
||||
|
|
|
@ -644,6 +644,7 @@ describe('Viewer', function() {
|
|||
'import.render.complete',
|
||||
'import.done'
|
||||
], function(e) {
|
||||
|
||||
// log event type + event arguments
|
||||
events.push([
|
||||
e.type,
|
||||
|
@ -812,6 +813,7 @@ describe('Viewer', function() {
|
|||
'import.render.complete',
|
||||
'import.done'
|
||||
], function(e) {
|
||||
|
||||
// log event type + event arguments
|
||||
events.push([
|
||||
e.type,
|
||||
|
@ -839,6 +841,7 @@ describe('Viewer', function() {
|
|||
|
||||
// given
|
||||
viewer.on('import.render.complete', function(context) {
|
||||
|
||||
// then
|
||||
done(context.error);
|
||||
});
|
||||
|
@ -1169,6 +1172,7 @@ describe('Viewer', function() {
|
|||
'import.render.complete',
|
||||
'import.done'
|
||||
], function(e) {
|
||||
|
||||
// log event type + event arguments
|
||||
events.push([
|
||||
e.type,
|
||||
|
@ -1232,6 +1236,7 @@ describe('Viewer', function() {
|
|||
'saveXML.serialized',
|
||||
'saveXML.done'
|
||||
], function(e) {
|
||||
|
||||
// log event type + event arguments
|
||||
events.push([
|
||||
e.type,
|
||||
|
@ -1245,6 +1250,7 @@ describe('Viewer', function() {
|
|||
|
||||
// when
|
||||
viewer.saveXML(function(err) {
|
||||
|
||||
// then
|
||||
expect(events).to.eql([
|
||||
[ 'saveXML.start', [ 'definitions' ] ],
|
||||
|
@ -1405,6 +1411,7 @@ describe('Viewer', function() {
|
|||
'saveSVG.start',
|
||||
'saveSVG.done'
|
||||
], function(e) {
|
||||
|
||||
// log event type + event arguments
|
||||
events.push([
|
||||
e.type,
|
||||
|
@ -1418,6 +1425,7 @@ describe('Viewer', function() {
|
|||
|
||||
// when
|
||||
viewer.saveSVG(function() {
|
||||
|
||||
// then
|
||||
expect(events).to.eql([
|
||||
[ 'saveSVG.start', [ ] ],
|
||||
|
|
|
@ -476,6 +476,7 @@ describe('features - context-pad', function() {
|
|||
|
||||
it('should not open non-existing replace menu', inject(
|
||||
function(create, dragging, canvas, elementFactory) {
|
||||
|
||||
// given
|
||||
var rootShape = canvas.getRootElement(),
|
||||
dataObject = elementFactory.createShape({ type: 'bpmn:DataObjectReference' }),
|
||||
|
|
|
@ -37,6 +37,7 @@ describe('features/editor-actions', function() {
|
|||
|
||||
|
||||
it('should move to origin', inject(function(editorActions) {
|
||||
|
||||
// given
|
||||
var elements = editorActions.trigger('selectElements'),
|
||||
boundingBox;
|
||||
|
@ -73,6 +74,7 @@ describe('features/editor-actions', function() {
|
|||
|
||||
it('should ignore children of subprocesses', inject(
|
||||
function(editorActions, elementRegistry) {
|
||||
|
||||
// given
|
||||
var startEvent = elementRegistry.get('StartEvent_3'),
|
||||
startEventParent = getParent(startEvent);
|
||||
|
|
|
@ -22,6 +22,7 @@ describe('features/modeling - append shape', function() {
|
|||
describe('shape handling', function() {
|
||||
|
||||
it('should execute', inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var startEventShape = elementRegistry.get('StartEvent_1');
|
||||
|
||||
|
|
|
@ -104,6 +104,7 @@ describe('features - bpmn-updater', function() {
|
|||
|
||||
it('should crop connection only once per reconnect', inject(
|
||||
function(modeling, elementRegistry, connectionDocking) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_1'),
|
||||
target = elementRegistry.get('EndEvent_2'),
|
||||
|
|
|
@ -27,6 +27,7 @@ describe('features/modeling - id claim management', function() {
|
|||
describe('unclaim', function() {
|
||||
|
||||
it('should unclaim id when removing element', inject(function(modeling, moddle) {
|
||||
|
||||
// when
|
||||
modeling.removeElements([ element ]);
|
||||
|
||||
|
@ -36,6 +37,7 @@ describe('features/modeling - id claim management', function() {
|
|||
|
||||
|
||||
it('should revert unclaim action on restoring element', inject(function(modeling, moddle, commandStack) {
|
||||
|
||||
// given
|
||||
modeling.removeElements([ element ]);
|
||||
|
||||
|
|
|
@ -87,6 +87,7 @@ describe('label bounds', function() {
|
|||
|
||||
|
||||
it('should reduce width', inject(function(elementRegistry) {
|
||||
|
||||
// given
|
||||
var shape = elementRegistry.get('StartEvent_1'),
|
||||
oldLabelWidth = shape.label.width;
|
||||
|
@ -100,6 +101,7 @@ describe('label bounds', function() {
|
|||
|
||||
|
||||
it('should reduce height', inject(function(elementRegistry) {
|
||||
|
||||
// given
|
||||
var shape = elementRegistry.get('StartEvent_3'),
|
||||
oldLabelHeight = shape.label.height;
|
||||
|
|
|
@ -32,6 +32,7 @@ describe('features/modeling - move', function() {
|
|||
|
||||
it('should not attach label when moving BoundaryEvent',
|
||||
inject(function(elementRegistry, move, dragging) {
|
||||
|
||||
// given
|
||||
var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
subProcess = elementRegistry.get('SubProcess_1'),
|
||||
|
|
|
@ -352,6 +352,7 @@ describe('features/modeling/behavior - data store', function() {
|
|||
beforeEach(bootstrapModeler(processDiagramXML, { modules: testModules }));
|
||||
|
||||
beforeEach(inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var participantElement = elementRegistry.get('Participant'),
|
||||
participant2Element = elementRegistry.get('Participant_2'),
|
||||
|
|
|
@ -169,6 +169,7 @@ describe('modeling/behavior - drop on connection', function() {
|
|||
|
||||
it('should connect start -> target -> end (with bendpointBefore inside bbox)', inject(
|
||||
function(modeling, elementRegistry, elementFactory) {
|
||||
|
||||
// given
|
||||
var taskShape = elementFactory.createShape({ type: 'bpmn:Task' }),
|
||||
sequenceFlow = elementRegistry.get('SequenceFlow_1'),
|
||||
|
@ -345,6 +346,7 @@ describe('modeling/behavior - drop on connection', function() {
|
|||
|
||||
it('should connect start -> target -> end (with bendpointBefore inside bbox)', inject(
|
||||
function(elementRegistry, selection, move, dragging) {
|
||||
|
||||
// given
|
||||
var task3 = elementRegistry.get('Task_3'),
|
||||
sequenceFlow = elementRegistry.get('SequenceFlow_1'),
|
||||
|
@ -378,6 +380,7 @@ describe('modeling/behavior - drop on connection', function() {
|
|||
|
||||
it('should connect start -> target -> end (with bendpointAfter inside bbox)', inject(
|
||||
function(elementRegistry, selection, move, dragging) {
|
||||
|
||||
// given
|
||||
var task3 = elementRegistry.get('Task_3'),
|
||||
sequenceFlow = elementRegistry.get('SequenceFlow_1'),
|
||||
|
|
|
@ -28,6 +28,7 @@ describe('features/modeling/behavior - IsHorizontalFix', function() {
|
|||
|
||||
it('should set isHorizontal=true when participant is created',
|
||||
inject(function(canvas, elementFactory, modeling) {
|
||||
|
||||
// given
|
||||
var processShape = canvas.getRootElement(),
|
||||
participantShape = elementFactory.createParticipantShape(true);
|
||||
|
@ -45,6 +46,7 @@ describe('features/modeling/behavior - IsHorizontalFix', function() {
|
|||
|
||||
it('should set isHorizontal=true when lane is created',
|
||||
inject(function(canvas, elementFactory, modeling) {
|
||||
|
||||
// given
|
||||
var processShape = canvas.getRootElement(),
|
||||
participantShape = elementFactory.createParticipantShape(true),
|
||||
|
|
|
@ -60,6 +60,7 @@ describe('features/modeling - remove element behavior', function() {
|
|||
|
||||
// then
|
||||
var waypoints = elementRegistry.get('SequenceFlow7').waypoints;
|
||||
|
||||
// connection has two vertically equal waypoints
|
||||
expect(waypoints).to.have.length(2);
|
||||
expect(waypoints[0].x).to.eql(waypoints[1].x);
|
||||
|
|
|
@ -299,6 +299,7 @@ describe('features/modeling - collapse and expand elements', function() {
|
|||
originalChildren.forEach(function(c) {
|
||||
expect(collapsedSubProcess.children).to.include(c);
|
||||
});
|
||||
|
||||
// and hide them
|
||||
expect(collapsedSubProcess.children).to.satisfy(allHidden());
|
||||
})
|
||||
|
@ -634,6 +635,7 @@ function allShown() {
|
|||
function childrenHidden(hidden) {
|
||||
return function(children) {
|
||||
return children.every(function(child) {
|
||||
|
||||
// empty labels are allways hidden
|
||||
if (child.type === 'label' && !child.businessObject.name) {
|
||||
return child.hidden;
|
||||
|
|
|
@ -27,6 +27,7 @@ describe('features/modeling - delete default connection', function() {
|
|||
|
||||
|
||||
it('should remove default connection', inject(function(modeling) {
|
||||
|
||||
// when
|
||||
modeling.removeConnection(defaultConnection);
|
||||
|
||||
|
@ -37,6 +38,7 @@ describe('features/modeling - delete default connection', function() {
|
|||
|
||||
|
||||
it('should revert default connection', inject(function(modeling, commandStack) {
|
||||
|
||||
// given
|
||||
modeling.removeConnection(defaultConnection);
|
||||
|
||||
|
@ -50,6 +52,7 @@ describe('features/modeling - delete default connection', function() {
|
|||
|
||||
|
||||
it('should NOT remove default connection on removing other connections', inject(function(modeling) {
|
||||
|
||||
// when
|
||||
modeling.removeConnection(normalConnection);
|
||||
|
||||
|
@ -62,6 +65,7 @@ describe('features/modeling - delete default connection', function() {
|
|||
|
||||
|
||||
it('should NOT remove default connection on restoring other connections', inject(function(modeling, commandStack) {
|
||||
|
||||
// given
|
||||
modeling.removeConnection(normalConnection);
|
||||
|
||||
|
|
|
@ -98,6 +98,7 @@ describe('modeling/behavior/util - GeometricUtil', function() {
|
|||
|
||||
// given
|
||||
var testVectors = [
|
||||
|
||||
// x=-10 because we have system with flipped y axis
|
||||
{ vector: { x: 0, y: 10 }, angle: 90, rotated: { x: -10, y: 0 } },
|
||||
{ vector: { x: 10, y: 0 }, angle: 90, rotated: { x: 0, y: 10 } },
|
||||
|
|
|
@ -7,10 +7,13 @@ describe('modeling/behavior/util - LabelLayoutUtil#getLabelAdjustment', function
|
|||
|
||||
var newLine = [
|
||||
{ x: 10, y: 10 },
|
||||
|
||||
// -
|
||||
{ x: 15, y: 10 },
|
||||
|
||||
// |
|
||||
{ x: 15, y: 5 },
|
||||
|
||||
// -
|
||||
{ x: 30, y: 5 }
|
||||
];
|
||||
|
@ -21,6 +24,7 @@ describe('modeling/behavior/util - LabelLayoutUtil#getLabelAdjustment', function
|
|||
// given
|
||||
var line = [
|
||||
{ x: 10, y: 10 },
|
||||
|
||||
// -
|
||||
{ x: 20, y: 10 }
|
||||
];
|
||||
|
@ -47,6 +51,7 @@ describe('modeling/behavior/util - LabelLayoutUtil#getLabelAdjustment', function
|
|||
// given
|
||||
var line = [
|
||||
{ x: 10, y: 10 },
|
||||
|
||||
// -
|
||||
{ x: 10, y: 10 }
|
||||
];
|
||||
|
|
|
@ -15,10 +15,13 @@ describe('modeling/behavior/util - LineAttachmentUtil#getAttachment', function()
|
|||
//
|
||||
var line = [
|
||||
{ x: 10, y: 10 },
|
||||
|
||||
// -
|
||||
{ x: 30, y: 10 },
|
||||
|
||||
// |
|
||||
{ x: 30, y: 30 },
|
||||
|
||||
// \
|
||||
{ x: 130, y: 130 }
|
||||
];
|
||||
|
@ -199,10 +202,13 @@ describe('modeling/behavior/util - LineAttachmentUtil#getAttachment', function()
|
|||
//
|
||||
var floatingPointLine = [
|
||||
{ x: 10.141592, y: 10.653589 },
|
||||
|
||||
// -
|
||||
{ x: 30.793238, y: 10.462643 },
|
||||
|
||||
// |
|
||||
{ x: 30.383279, y: 30.502884 },
|
||||
|
||||
// \
|
||||
{ x: 130.197169, y: 130.399375 }
|
||||
];
|
||||
|
@ -246,6 +252,7 @@ describe('modeling/behavior/util - LineAttachmentUtil#getAttachment', function()
|
|||
|
||||
var zeroLengthLine = [
|
||||
{ x: 10, y: 10 },
|
||||
|
||||
// -
|
||||
{ x: 10, y: 10 }
|
||||
];
|
||||
|
@ -253,6 +260,7 @@ describe('modeling/behavior/util - LineAttachmentUtil#getAttachment', function()
|
|||
|
||||
var zeroLengthFloatingPointLine = [
|
||||
{ x: 10.1, y: 10.12313 },
|
||||
|
||||
// -
|
||||
{ x: 10, y: 10.112 }
|
||||
];
|
||||
|
|
|
@ -181,6 +181,7 @@ describe('features/modeling - layout message flows', function() {
|
|||
|
||||
// when
|
||||
modeling.moveElements([ participantShape ], { x: 300, y: 50 });
|
||||
|
||||
// then
|
||||
|
||||
// expect cropped, repaired manhattan connection
|
||||
|
|
|
@ -229,6 +229,7 @@ describe('features/modeling - layout', function() {
|
|||
|
||||
|
||||
it('attached bottom center, orientation bottom', function() {
|
||||
|
||||
// when
|
||||
var connection = connect('BoundaryEvent_BottomCenter', 'Task_Bottom');
|
||||
|
||||
|
@ -240,6 +241,7 @@ describe('features/modeling - layout', function() {
|
|||
|
||||
|
||||
it('attached top center, orientation top', function() {
|
||||
|
||||
// when
|
||||
var connection = connect('BoundaryEvent_TopCenter', 'Task_Top');
|
||||
|
||||
|
@ -251,6 +253,7 @@ describe('features/modeling - layout', function() {
|
|||
|
||||
|
||||
it('attached right center, orientation right', function() {
|
||||
|
||||
// when
|
||||
var connection = connect('BoundaryEvent_RightCenter', 'Task_Right');
|
||||
|
||||
|
@ -262,6 +265,7 @@ describe('features/modeling - layout', function() {
|
|||
|
||||
|
||||
it('attached right center, orientation left', function() {
|
||||
|
||||
// when
|
||||
var connection = connect('BoundaryEvent_RightCenter', 'Task_Left');
|
||||
|
||||
|
|
|
@ -908,6 +908,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
|
||||
it('should show default replace option [gateway]', inject(function(elementRegistry, popupMenu) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_3');
|
||||
|
||||
|
@ -920,6 +921,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
|
||||
it('should show Default replace option [task]', inject(function(elementRegistry, popupMenu) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_15f5knn');
|
||||
|
||||
|
@ -932,6 +934,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
|
||||
it('should NOT show default replace option', inject(function(elementRegistry, popupMenu) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_4');
|
||||
|
||||
|
@ -955,6 +958,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
|
||||
it('should show default replace option', inject(function(elementRegistry, popupMenu) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_2');
|
||||
|
||||
|
@ -971,6 +975,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
|
||||
it('should NOT show default replace option', inject(function(elementRegistry, popupMenu) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_1');
|
||||
|
||||
|
@ -998,6 +1003,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
|
||||
it('should show default replace option', inject(function(elementRegistry, popupMenu) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_2');
|
||||
|
||||
|
@ -1014,6 +1020,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
|
||||
it('should NOT show default replace option', inject(function(elementRegistry, popupMenu) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_1');
|
||||
|
||||
|
@ -1041,6 +1048,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
|
||||
it('should show ConditionalFlow replace option', inject(function(elementRegistry, popupMenu) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_3');
|
||||
|
||||
|
@ -1057,6 +1065,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
|
||||
it('should NOT show ConditionalFlow replace option', inject(function(elementRegistry, popupMenu) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_1');
|
||||
|
||||
|
@ -1133,6 +1142,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
|
||||
it('should replace SequenceFlow with DefaultFlow [gateway]', inject(function(elementRegistry, popupMenu) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_3');
|
||||
|
||||
|
@ -1151,6 +1161,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
|
||||
it('should replace SequenceFlow with DefaultFlow [task]', inject(function(elementRegistry, popupMenu) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_15f5knn');
|
||||
|
||||
|
@ -1169,6 +1180,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
|
||||
it('should morph DefaultFlow into a SequenceFlow [task]', inject(function(elementRegistry, popupMenu) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_15f5knn'),
|
||||
entries;
|
||||
|
@ -1224,6 +1236,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
|
||||
it('should morph DefaultFlow into a ConditionalFlow [task]', inject(function(elementRegistry, popupMenu) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_15f5knn'),
|
||||
task = elementRegistry.get('Task_1ei94kl'),
|
||||
|
@ -1322,6 +1335,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
|
||||
it('should only have one DefaultFlow', inject(function(elementRegistry, popupMenu) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_1'),
|
||||
sequenceFlow3 = elementRegistry.get('SequenceFlow_3');
|
||||
|
@ -1514,6 +1528,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
|
||||
it('should keep DefaultFlow when morphing Gateway', inject(function(elementRegistry, popupMenu, bpmnReplace) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
||||
exclusiveGateway = elementRegistry.get('ExclusiveGateway_1');
|
||||
|
@ -1533,6 +1548,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
|
||||
it('should keep DefaultFlow when morphing Task', inject(function(elementRegistry, bpmnReplace, popupMenu) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_15f5knn'),
|
||||
task = elementRegistry.get('Task_1ei94kl');
|
||||
|
@ -1648,6 +1664,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
|
||||
it('should morph into a ConditionalFlow', inject(function(elementRegistry, popupMenu) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_2');
|
||||
|
||||
|
@ -1665,6 +1682,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
it('should morph into a ConditionalFlow -> undo', inject(
|
||||
function(elementRegistry, popupMenu, commandStack) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_2');
|
||||
|
||||
|
@ -1684,6 +1702,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
|
||||
it('should morph back into a SequenceFlow', inject(function(elementRegistry, popupMenu) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_2');
|
||||
|
||||
|
|
|
@ -1199,6 +1199,7 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
|
||||
|
||||
it('-> Collaboration', function() {
|
||||
|
||||
// then
|
||||
expectCanDrop(label, 'Collaboration', true);
|
||||
});
|
||||
|
@ -1249,6 +1250,7 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
|
||||
|
||||
it('-> Collaboration', function() {
|
||||
|
||||
// then
|
||||
expectCanCreate(group, 'Collaboration', true);
|
||||
});
|
||||
|
@ -1508,6 +1510,7 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
|
||||
it('attach/move multiple BoundaryEvents -> SubProcess_1', inject(
|
||||
function(elementRegistry) {
|
||||
|
||||
// when
|
||||
var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
boundaryEvent2 = elementRegistry.get('BoundaryEvent_2');
|
||||
|
@ -1527,6 +1530,7 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
|
||||
it('attach/move SubProcess, BoundaryEvent and label -> Process', inject(
|
||||
function(elementRegistry) {
|
||||
|
||||
// when
|
||||
var subProcess = elementRegistry.get('SubProcess_1'),
|
||||
boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
|
@ -2108,6 +2112,7 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
];
|
||||
|
||||
types.forEach(function(type) {
|
||||
|
||||
// when
|
||||
var element = elementFactory.createShape({ type: type });
|
||||
|
||||
|
@ -2231,6 +2236,7 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
|
||||
|
||||
it('should allow start for given element types', inject(function(elementFactory, rules) {
|
||||
|
||||
// given
|
||||
var types = [
|
||||
'bpmn:FlowNode',
|
||||
|
@ -2253,6 +2259,7 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
|
||||
|
||||
it('should ignore label elements', inject(function(elementFactory, rules) {
|
||||
|
||||
// given
|
||||
var label = elementFactory.createShape({ type: 'bpmn:FlowNode', labelTarget: {} });
|
||||
|
||||
|
@ -2265,6 +2272,7 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
|
||||
|
||||
it('should NOT allow start on unknown element', inject(function(rules) {
|
||||
|
||||
// given
|
||||
var element = { type: 'bpmn:SomeUnknownType' };
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ describe('features - BPMN search provider', function() {
|
|||
|
||||
|
||||
it('should not return root element (collaboration)', inject(function(bpmnSearch) {
|
||||
|
||||
// given
|
||||
var pattern = 'collaboration';
|
||||
|
||||
|
@ -43,6 +44,7 @@ describe('features - BPMN search provider', function() {
|
|||
|
||||
|
||||
it('find should return all elements that match label or ID', inject(function(bpmnSearch) {
|
||||
|
||||
// given
|
||||
var pattern = '123456';
|
||||
|
||||
|
@ -60,6 +62,7 @@ describe('features - BPMN search provider', function() {
|
|||
|
||||
|
||||
it('matches IDs', inject(function(bpmnSearch) {
|
||||
|
||||
// given
|
||||
var pattern = 'datastore';
|
||||
|
||||
|
@ -79,6 +82,7 @@ describe('features - BPMN search provider', function() {
|
|||
|
||||
|
||||
it('should not return root element (process)', inject(function(bpmnSearch) {
|
||||
|
||||
// given
|
||||
var pattern = 'process';
|
||||
|
||||
|
@ -93,6 +97,7 @@ describe('features - BPMN search provider', function() {
|
|||
describe('should split result into matched and non matched tokens', function() {
|
||||
|
||||
it('matched all', inject(function(bpmnSearch) {
|
||||
|
||||
// given
|
||||
var pattern = 'all matched';
|
||||
|
||||
|
@ -107,6 +112,7 @@ describe('features - BPMN search provider', function() {
|
|||
|
||||
|
||||
it('matched start', inject(function(bpmnSearch) {
|
||||
|
||||
// given
|
||||
var pattern = 'before';
|
||||
|
||||
|
@ -122,6 +128,7 @@ describe('features - BPMN search provider', function() {
|
|||
|
||||
|
||||
it('matched middle', inject(function(bpmnSearch) {
|
||||
|
||||
// given
|
||||
var pattern = 'middle';
|
||||
|
||||
|
@ -138,6 +145,7 @@ describe('features - BPMN search provider', function() {
|
|||
|
||||
|
||||
it('matched end', inject(function(bpmnSearch) {
|
||||
|
||||
// given
|
||||
var pattern = 'after';
|
||||
|
||||
|
|
|
@ -12,5 +12,6 @@ CustomRules.$inject = [ 'eventBus' ];
|
|||
inherits(CustomRules, RuleProvider);
|
||||
|
||||
CustomRules.prototype.init = function() {
|
||||
|
||||
// placeholder
|
||||
};
|
Loading…
Reference in New Issue