Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
y: 0
}, {
desc: 'up arrow',
keys: KEYS.UP,
shiftKey: false,
x: 0,
y: -50
}, {
desc: 'down arrow',
keys: KEYS.DOWN,
shiftKey: false,
x: 0,
y: 50
}];
forEach(decisionTable, function(testCase) {
forEach(testCase.keys, function(key) {
it('should handle ' + testCase.desc, inject(function(canvas, keyboard) {
// given
var event = createKeyEvent(key, { shiftKey: testCase.shiftKey });
// when
keyboard._keyHandler(event);
// then
expect(canvas.viewbox().x).to.eql(testCase.x);
expect(canvas.viewbox().y).to.eql(testCase.y);
}));
previewSupport.addDragger(shape, context.dragGroup);
});
// cache all dragged elements / gfx
// so that we can quickly undo their state changes later
if (!allDraggedElements) {
allDraggedElements = getAllDraggedElements(dragShapes);
} else {
allDraggedElements = flatten([
allDraggedElements,
getAllDraggedElements(dragShapes)
]);
}
// add dragging marker
forEach(allDraggedElements, function(e) {
canvas.addMarker(e, MARKER_DRAGGING);
});
context.allDraggedElements = allDraggedElements;
// determine, if any of the dragged elements have different parents
context.differentParents = haveDifferentParents(dragShapes);
});
eventBus.on('shape.move.cleanup', function(event) {
var context = event.context,
allDraggedElements = context.allDraggedElements,
dragGroup = context.dragGroup;
// remove dragging marker
forEach(allDraggedElements, function(e) {
canvas.removeMarker(e, MARKER_DRAGGING);
});
if (dragGroup) {
svgRemove(dragGroup);
}
});
function expectCollection(collA, collB, contains) {
expect(collA).to.have.length(collB.length);
forEach(collB, function(element) {
if (!element.parent) {
return;
}
if (contains) {
expect(collA).to.contain(element);
} else {
expect(collA).not.to.contain(element);
}
});
}
ReplaceMenuProvider.prototype._createEntries = function(element, replaceOptions) {
var menuEntries = [];
var self = this;
forEach(replaceOptions, function(definition) {
var entry = self._createMenuEntry(definition, element);
menuEntries.push(entry);
});
return menuEntries;
};
export function hasEventDefinition(element, eventType) {
var bo = getBusinessObject(element),
hasEventDefinition = false;
if (bo.eventDefinitions) {
forEach(bo.eventDefinitions, function(event) {
if (is(event, eventType)) {
hasEventDefinition = true;
}
});
}
return hasEventDefinition;
}
function applyAttributes(element, attrs, attributeNames) {
forEach(attributeNames, function(property) {
if (attrs[property] !== undefined) {
applyAttribute(element, attrs, property);
}
});
}
function clearSegmentDraggers(gfx) {
forEach(domQueryAll('.' + SEGMENT_DRAGGER_CLS, gfx), function(node) {
svgRemove(node);
});
}
if (!target) {
return false;
}
if (isSame(source, target)) {
return false;
}
var canExecute = {
replacements: []
};
var self = this;
forEach(elements, function(element) {
if (isEntryCriterion(element) && !self.canAttachEntryCriterion(element, target, position, source)) {
if (self.canAttachExitCriterion(element, target, position, source)) {
canExecute.replacements.push({
oldElementId: element.id,
newElementType: 'cmmn:ExitCriterion'
});
}
}
if (isExitCriterion(element) && !self.canAttachExitCriterion(element, target, position, source)) {
if (self.canAttachEntryCriterion(element, target, position, source)) {
canExecute.replacements.push({
oldElementId: element.id,
newElementType: 'cmmn:EntryCriterion'
});
}
});
return;
}
snapPoints.add('mid', mid(sibling));
if (is(sibling, 'bpmn:Participant')) {
snapPoints.add('top-left', topLeft(sibling));
snapPoints.add('bottom-right', bottomRight(sibling));
}
});
forEach(shape.incoming, function(c) {
if (siblings.indexOf(c.source) === -1) {
snapPoints.add('mid', mid(c.source));
}
var docking = c.waypoints[0];
snapPoints.add(c.id + '-docking', docking.original || docking);
});
forEach(shape.outgoing, function(c) {
if (siblings.indexOf(c.target) === -1) {
snapPoints.add('mid', mid(c.target));
}