Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function triggerPaletteEntry(id) {
getBpmnJS().invoke(function(palette) {
var entry = palette.getEntries()[ id ];
if (entry && entry.action && entry.action.click) {
entry.action.click(createMoveEvent(0, 0));
}
});
}
function getContextPadEntries(elementId) {
let entries;
getBpmnJS().invoke(function(elementRegistry, contextPad) {
const element = elementRegistry.get(elementId);
contextPad.open(element, true);
entries = contextPad._current.entries;
});
return Object.keys(entries);
}
const expectCanAttach = (elements, target, rules) => {
let results = {};
getBpmnJS().invoke(function(bpmnRules) {
target = get(target);
if ('attach' in rules) {
results.attach = bpmnRules.canAttach(elements, target);
}
});
expect(results).to.eql(rules);
};
const get = (element) => {
let actualElement;
if (isString(element)) {
actualElement = getBpmnJS().invoke(function(elementRegistry) {
return elementRegistry.get(element);
});
if (!actualElement) {
throw new Error('element #' + element + ' not found');
}
return actualElement;
}
return element;
};
const padEvent = entry => {
return getBpmnJS().invoke(function(overlays) {
const target = padEntry(overlays._overlayRoot, entry);
return {
target: target,
preventDefault: () => {},
clientX: 100,
clientY: 100
};
});
};
const openPopup = (element, offset) => {
offset = offset || 100;
getBpmnJS().invoke(function(popupMenu) {
popupMenu.open(element, 'bpmn-replace', {
x: element.x + offset, y: element.y + offset
});
});
};