chore(project): adjust min-dash usage (2)
This commit is contained in:
parent
245d1d6a96
commit
11f5a22471
|
@ -7,7 +7,8 @@
|
|||
'use strict';
|
||||
|
||||
var assign = require('min-dash').assign,
|
||||
isNumber = require('min-dash').isNumber;
|
||||
isNumber = require('min-dash').isNumber,
|
||||
omit = require('min-dash').omit;
|
||||
|
||||
var domify = require('min-dom').domify,
|
||||
domQuery = require('min-dom').query,
|
||||
|
@ -411,9 +412,8 @@ Viewer.prototype._init = function(container, moddle, options) {
|
|||
];
|
||||
|
||||
var diagramModules = [].concat(staticModules, baseModules, additionalModules);
|
||||
var optionsWithoutAdditionalModules = assign({}, options);
|
||||
delete optionsWithoutAdditionalModules.additionalModules;
|
||||
var diagramOptions = assign(optionsWithoutAdditionalModules, {
|
||||
|
||||
var diagramOptions = assign(omit(options, [ 'additionalModules' ]), {
|
||||
canvas: assign({}, options.canvas, { container: container }),
|
||||
modules: diagramModules
|
||||
});
|
||||
|
|
|
@ -312,7 +312,7 @@ module.exports.getConnectedAtPosition = getConnectedAtPosition;
|
|||
/**
|
||||
* Returns a new, position for the given element
|
||||
* based on the given element that is not occupied
|
||||
* by any element connected to source.
|
||||
* by some element connected to source.
|
||||
*
|
||||
* Take into account the escapeDirection (where to move
|
||||
* on positining clashes) in the computation.
|
||||
|
|
|
@ -72,9 +72,11 @@ BpmnFactory.prototype.createDiBounds = function(bounds) {
|
|||
|
||||
|
||||
BpmnFactory.prototype.createDiWaypoints = function(waypoints) {
|
||||
var self = this;
|
||||
|
||||
return map(waypoints, function(pos) {
|
||||
return this.createDiWaypoint(pos);
|
||||
}, this);
|
||||
return self.createDiWaypoint(pos);
|
||||
});
|
||||
};
|
||||
|
||||
BpmnFactory.prototype.createDiWaypoint = function(point) {
|
||||
|
|
|
@ -637,7 +637,7 @@ BpmnUpdater.prototype.updateConnection = function(context) {
|
|||
} else
|
||||
|
||||
if (is(businessObject, 'bpmn:DataInputAssociation')) {
|
||||
// handle obnoxious isMany sourceRef
|
||||
// handle obnoxious isMsome sourceRef
|
||||
businessObject.get('sourceRef')[0] = newSource;
|
||||
|
||||
visualParent = context.parent || context.newParent || newTarget;
|
||||
|
|
|
@ -2,12 +2,15 @@
|
|||
|
||||
var forEach = require('min-dash').forEach,
|
||||
find = require('min-dash').find,
|
||||
inherits = require('inherits');
|
||||
matchPattern = require('min-dash').matchPattern;
|
||||
|
||||
var inherits = require('inherits');
|
||||
|
||||
var CommandInterceptor = require('diagram-js/lib/command/CommandInterceptor');
|
||||
|
||||
var is = require('../../../util/ModelUtil').is;
|
||||
|
||||
|
||||
function ReplaceConnectionBehavior(eventBus, modeling, bpmnRules) {
|
||||
|
||||
CommandInterceptor.call(this, eventBus);
|
||||
|
@ -107,7 +110,10 @@ function ReplaceConnectionBehavior(eventBus, modeling, bpmnRules) {
|
|||
|
||||
// remove condition expression when morphing to default flow
|
||||
if (properties.default) {
|
||||
connection = find(element.outgoing, { id: element.businessObject.default.id });
|
||||
connection = find(
|
||||
element.outgoing,
|
||||
matchPattern({ id: element.businessObject.default.id })
|
||||
);
|
||||
|
||||
if (connection) {
|
||||
modeling.updateProperties(connection, { conditionExpression: undefined });
|
||||
|
|
|
@ -13,7 +13,10 @@ var is = require('../../../util/ModelUtil').is;
|
|||
* Defines the behaviour of what happens to the elements inside a container
|
||||
* that morphs into another BPMN element
|
||||
*/
|
||||
function ReplaceElementBehaviour(eventBus, bpmnReplace, bpmnRules, elementRegistry, selection, modeling) {
|
||||
function ReplaceElementBehaviour(
|
||||
eventBus, bpmnReplace, bpmnRules,
|
||||
elementRegistry, selection, modeling
|
||||
) {
|
||||
CommandInterceptor.call(this, eventBus);
|
||||
|
||||
this._bpmnReplace = bpmnReplace;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var reduce = require('min-dash').transform,
|
||||
var reduce = require('min-dash').reduce,
|
||||
keys = require('min-dash').keys,
|
||||
forEach = require('min-dash').forEach,
|
||||
assign = require('min-dash').assign;
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
'use strict';
|
||||
|
||||
var any = require('min-dash').any;
|
||||
var some = require('min-dash').some;
|
||||
|
||||
var is = require('../../../util/ModelUtil').is;
|
||||
|
||||
|
||||
/**
|
||||
* Return true if element has any of the given types.
|
||||
* Return true if element has some of the given types.
|
||||
*
|
||||
* @param {djs.model.Base} element
|
||||
* @param {Array<String>} types
|
||||
|
@ -14,7 +14,7 @@ var is = require('../../../util/ModelUtil').is;
|
|||
* @return {Boolean}
|
||||
*/
|
||||
function isAny(element, types) {
|
||||
return any(types, function(t) {
|
||||
return some(types, function(t) {
|
||||
return is(element, t);
|
||||
});
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ module.exports.isAny = isAny;
|
|||
|
||||
|
||||
/**
|
||||
* Return the parent of the element with any of the given types.
|
||||
* Return the parent of the element with some of the given types.
|
||||
*
|
||||
* @param {djs.model.Base} element
|
||||
* @param {String|Array<String>} anyType
|
||||
|
|
|
@ -4,7 +4,8 @@ var pick = require('min-dash').pick,
|
|||
assign = require('min-dash').assign,
|
||||
uniqueBy = require('min-dash').uniqueBy,
|
||||
findIndex = require('min-dash').findIndex,
|
||||
filter = require('min-dash').filter;
|
||||
filter = require('min-dash').filter,
|
||||
has = require('min-dash').has;
|
||||
|
||||
var is = require('../../util/ModelUtil').is,
|
||||
isAny = require('../modeling/util/ModelingUtil').isAny,
|
||||
|
@ -29,15 +30,15 @@ var CUSTOM_PROPERTIES = [
|
|||
function toggeling(element, target) {
|
||||
|
||||
var oldCollapsed = (
|
||||
element && hasOwnProperty(element, 'collapsed') ? element.collapsed : !isExpanded(element)
|
||||
element && has(element, 'collapsed') ? element.collapsed : !isExpanded(element)
|
||||
);
|
||||
|
||||
var targetCollapsed;
|
||||
|
||||
if (target && (hasOwnProperty(target, 'collapsed') || hasOwnProperty(target, 'isExpanded'))) {
|
||||
if (target && (has(target, 'collapsed') || has(target, 'isExpanded'))) {
|
||||
// property is explicitly set so use it
|
||||
targetCollapsed = (
|
||||
hasOwnProperty(target, 'collapsed') ? target.collapsed : !target.isExpanded
|
||||
has(target, 'collapsed') ? target.collapsed : !target.isExpanded
|
||||
);
|
||||
} else {
|
||||
// keep old state
|
||||
|
@ -141,7 +142,7 @@ function BpmnReplace(bpmnFactory, replace, selection, modeling, eventBus) {
|
|||
newElement.isExpanded = isExpanded(oldBusinessObject);
|
||||
}
|
||||
// else if property is explicitly set, use it
|
||||
else if (target && hasOwnProperty(target, 'isExpanded')) {
|
||||
else if (target && has(target, 'isExpanded')) {
|
||||
newElement.isExpanded = target.isExpanded;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
var find = require('min-dash').find,
|
||||
any = require('min-dash').any,
|
||||
some = require('min-dash').some,
|
||||
every = require('min-dash').every,
|
||||
filter = require('min-dash').filter,
|
||||
forEach = require('min-dash').forEach,
|
||||
|
@ -494,7 +494,7 @@ function canPaste(tree, target) {
|
|||
}
|
||||
|
||||
if (is(target, 'bpmn:Process')) {
|
||||
participants = any(topLevel, function(e) {
|
||||
participants = some(topLevel, function(e) {
|
||||
return e.type === 'bpmn:Participant';
|
||||
});
|
||||
|
||||
|
@ -674,12 +674,12 @@ function canReplace(elements, target, position) {
|
|||
function canMove(elements, target) {
|
||||
|
||||
// do not move selection containing boundary events
|
||||
if (any(elements, isBoundaryEvent)) {
|
||||
if (some(elements, isBoundaryEvent)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// do not move selection containing lanes
|
||||
if (any(elements, isLane)) {
|
||||
if (some(elements, isLane)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -244,7 +244,7 @@ BpmnImporter.prototype._getEnd = function(semantic, side) {
|
|||
|
||||
refSemantic = semantic[side + 'Ref'];
|
||||
|
||||
// handle mysterious isMany DataAssociation#sourceRef
|
||||
// handle mysterious isMsome DataAssociation#sourceRef
|
||||
if (side === 'source' && type === 'bpmn:DataInputAssociation') {
|
||||
refSemantic = refSemantic && refSemantic[0];
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
var forEach = require('min-dash').forEach,
|
||||
filter = require('min-dash').filter,
|
||||
any = require('min-dash').any,
|
||||
some = require('min-dash').some,
|
||||
sortBy = require('min-dash').sortBy,
|
||||
isArray = require('min-dash').isArray;
|
||||
|
||||
|
@ -11,7 +11,7 @@ var IGNORED_PROPERTIES = require('./ModelCloneUtils').IGNORED_PROPERTIES;
|
|||
function isAllowedIn(extProp, type) {
|
||||
var allowedIn = extProp.meta.allowedIn;
|
||||
|
||||
// '*' is a wildcard, which means any element is allowed to use this property
|
||||
// '*' is a wildcard, which means some element is allowed to use this property
|
||||
if (allowedIn.length === 1 && allowedIn[0] === '*') {
|
||||
return true;
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ function isAllowedIn(extProp, type) {
|
|||
}
|
||||
|
||||
function isType(element, types) {
|
||||
return any(types, function(type) {
|
||||
return some(types, function(type) {
|
||||
return typeof element === type;
|
||||
});
|
||||
}
|
||||
|
@ -38,6 +38,9 @@ module.exports = ModelCloneHelper;
|
|||
|
||||
|
||||
ModelCloneHelper.prototype.clone = function(refElement, newElement, properties) {
|
||||
|
||||
var self = this;
|
||||
|
||||
// hasNestedProperty: property allows us to avoid ending up with empty (xml) tags
|
||||
// f.ex: if extensionElements.values is empty, don't set it
|
||||
var context = {
|
||||
|
@ -83,7 +86,7 @@ ModelCloneHelper.prototype.clone = function(refElement, newElement, properties)
|
|||
|
||||
context.refTopLevelProperty = extElement;
|
||||
|
||||
newProp = this._deepClone(extElement, context);
|
||||
newProp = self._deepClone(extElement, context);
|
||||
|
||||
if (context.hasNestedProperty) {
|
||||
newProp.$parent = newElement;
|
||||
|
@ -92,14 +95,14 @@ ModelCloneHelper.prototype.clone = function(refElement, newElement, properties)
|
|||
}
|
||||
|
||||
context.hasNestedProperty = false;
|
||||
}, this);
|
||||
});
|
||||
|
||||
} else {
|
||||
name = propName.replace(/bpmn:/, '');
|
||||
|
||||
context.refTopLevelProperty = refElementProp;
|
||||
|
||||
newProperty = this._deepClone(refElementProp, context);
|
||||
newProperty = self._deepClone(refElementProp, context);
|
||||
|
||||
if (context.hasNestedProperty) {
|
||||
newElement[name] = newProperty;
|
||||
|
@ -107,12 +110,14 @@ ModelCloneHelper.prototype.clone = function(refElement, newElement, properties)
|
|||
|
||||
context.hasNestedProperty = false;
|
||||
}
|
||||
}, this);
|
||||
});
|
||||
|
||||
return newElement;
|
||||
};
|
||||
|
||||
ModelCloneHelper.prototype._deepClone = function _deepClone(propertyElement, context) {
|
||||
var self = this;
|
||||
|
||||
var eventBus = this._eventBus;
|
||||
var bpmnFactory = this._bpmnFactory;
|
||||
|
||||
|
@ -172,7 +177,7 @@ ModelCloneHelper.prototype._deepClone = function _deepClone(propertyElement, con
|
|||
}
|
||||
}
|
||||
|
||||
newDeepProp = this._deepClone(property, context);
|
||||
newDeepProp = self._deepClone(property, context);
|
||||
|
||||
newDeepProp.$parent = newProp;
|
||||
|
||||
|
@ -183,10 +188,10 @@ ModelCloneHelper.prototype._deepClone = function _deepClone(propertyElement, con
|
|||
context.hasNestedProperty = true;
|
||||
|
||||
newProp[propName].push(newDeepProp);
|
||||
}, this);
|
||||
});
|
||||
|
||||
} else if (propertyElement[propName].$type) {
|
||||
newProp[propName] = this._deepClone(propertyElement[propName], context);
|
||||
newProp[propName] = self._deepClone(propertyElement[propName], context);
|
||||
|
||||
if (newProp[propName]) {
|
||||
context.hasNestedProperty = true;
|
||||
|
@ -200,7 +205,7 @@ ModelCloneHelper.prototype._deepClone = function _deepClone(propertyElement, con
|
|||
// just assign directly if it's a value
|
||||
newProp[propName] = propertyElement[propName];
|
||||
}
|
||||
}, this);
|
||||
});
|
||||
|
||||
return newProp;
|
||||
};
|
||||
|
|
|
@ -638,7 +638,7 @@
|
|||
"resolved": "https://registry.npmjs.org/bpmn-moddle/-/bpmn-moddle-3.0.0.tgz",
|
||||
"integrity": "sha512-iNDuyr1k8fiyqcQO6OSzV/ACjOWn02KesDVmJOox9TGcG/zWxnsKUQS4DaeoCWejeuZ0001eCX+pgg+VtGYaZA==",
|
||||
"requires": {
|
||||
"min-dash": "2.2.0",
|
||||
"min-dash": "2.3.0",
|
||||
"moddle": "3.0.0",
|
||||
"moddle-xml": "5.0.0"
|
||||
}
|
||||
|
@ -1880,7 +1880,7 @@
|
|||
"didi": "3.0.0",
|
||||
"hammerjs": "2.0.8",
|
||||
"inherits": "2.0.3",
|
||||
"min-dash": "2.2.0",
|
||||
"min-dash": "2.3.0",
|
||||
"min-dom": "2.0.1",
|
||||
"object-refs": "0.1.1",
|
||||
"path-intersection": "1.0.2",
|
||||
|
@ -1907,7 +1907,7 @@
|
|||
"resolved": "https://registry.npmjs.org/diagram-js-direct-editing/-/diagram-js-direct-editing-0.23.0.tgz",
|
||||
"integrity": "sha512-rp1wTcZkfI7U/oEi7Jf0FHh/X3H0AxDMuK3NI28/7m4q+U7E8iMYEtCTRJ+W6kLYsuyGueW97IPNMSzpCWFC6A==",
|
||||
"requires": {
|
||||
"min-dash": "2.2.0",
|
||||
"min-dash": "2.3.0",
|
||||
"min-dom": "2.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
|
@ -5112,7 +5112,8 @@
|
|||
"lodash": {
|
||||
"version": "3.10.1",
|
||||
"resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz",
|
||||
"integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y="
|
||||
"integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=",
|
||||
"dev": true
|
||||
},
|
||||
"lodash.get": {
|
||||
"version": "4.4.2",
|
||||
|
@ -5321,9 +5322,9 @@
|
|||
"dev": true
|
||||
},
|
||||
"min-dash": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/min-dash/-/min-dash-2.2.0.tgz",
|
||||
"integrity": "sha512-Ff3XvILu4wfeG7fw5A7Aazigwnyym/XKj0xSPI5LNHQ5ndFnTbDIOAU0/Dt8TjsHYnths4dqhcqhMZR3MbZm8Q=="
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/min-dash/-/min-dash-2.3.0.tgz",
|
||||
"integrity": "sha512-NYwPXiE+QuEa2mqg085blzYoMFcvZzca1GBvZEiFHSDYAhrayboPYR82DgmIGWoczlxPdgVeP4X+9O9u89PGGQ=="
|
||||
},
|
||||
"min-dom": {
|
||||
"version": "2.0.1",
|
||||
|
@ -5431,7 +5432,7 @@
|
|||
"resolved": "https://registry.npmjs.org/moddle/-/moddle-3.0.0.tgz",
|
||||
"integrity": "sha512-r81IFvdfAdjhII/Qqb42mld0irpQNgsJb9Vu5rUZMcjCLx/CgI2fkvpJMSa1CHaw4FpPZTz+DK1lTPl6/eCtmw==",
|
||||
"requires": {
|
||||
"min-dash": "2.2.0"
|
||||
"min-dash": "2.3.0"
|
||||
}
|
||||
},
|
||||
"moddle-xml": {
|
||||
|
@ -5439,7 +5440,7 @@
|
|||
"resolved": "https://registry.npmjs.org/moddle-xml/-/moddle-xml-5.0.0.tgz",
|
||||
"integrity": "sha512-oYoTHu48twElwrIs9AM6oM7nSLrOBC+YOBgRLC7X1bIoOQz7ja+P4FzwkAiFeIg8Z31LDMPDFz07Qg3Im93T1Q==",
|
||||
"requires": {
|
||||
"min-dash": "2.2.0",
|
||||
"min-dash": "2.3.0",
|
||||
"moddle": "3.0.0",
|
||||
"saxen": "7.0.0",
|
||||
"tiny-stack": "0.1.0"
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
"diagram-js-direct-editing": "^0.23.0",
|
||||
"ids": "^0.2.0",
|
||||
"inherits": "^2.0.1",
|
||||
"min-dash": "^2.0.0",
|
||||
"min-dash": "^2.3.0",
|
||||
"min-dom": "^2.0.1",
|
||||
"object-refs": "^0.1.1",
|
||||
"tiny-svg": "^0.1.3"
|
||||
|
|
|
@ -28,17 +28,15 @@
|
|||
* ```
|
||||
*/
|
||||
|
||||
var uniqueBy = require('min-dash').uniqueBy,
|
||||
isFunction = require('min-dash').isFunction,
|
||||
forEach = require('min-dash').forEach;
|
||||
var isFunction = require('min-dash').isFunction,
|
||||
forEach = require('min-dash').forEach,
|
||||
merge = require('min-dash').merge;
|
||||
|
||||
var TestContainer = require('mocha-test-container-support');
|
||||
|
||||
var Modeler = require('../../lib/Modeler'),
|
||||
Viewer = require('../../lib/Viewer');
|
||||
|
||||
var merge = require('../util/merge');
|
||||
|
||||
var OPTIONS, BPMN_JS;
|
||||
|
||||
var translationModule = require('./TranslationCollector');
|
||||
|
@ -97,16 +95,16 @@ function bootstrapBpmnJS(BpmnJS, diagram, options, locals) {
|
|||
_options.modules = [].concat(_options.modules || [], [ mockModule ]);
|
||||
}
|
||||
|
||||
_options.modules = uniqueBy(function(e) {return e;}, _options.modules);
|
||||
|
||||
if (!_options.modules.length) {
|
||||
if (_options.modules && !_options.modules.length) {
|
||||
_options.modules = undefined;
|
||||
}
|
||||
|
||||
// used to extract translations used during tests
|
||||
if (window.__env__ && window.__env__.TRANSLATIONS === 'enabled') {
|
||||
_options.additionalModules = [].concat(_options.additionalModules || [], [ translationModule ]);
|
||||
_options.additionalModules = uniqueBy(function(e) {return e;}, _options.additionalModules);
|
||||
_options.additionalModules = [].concat(
|
||||
_options.additionalModules || [],
|
||||
[ translationModule ]
|
||||
);
|
||||
}
|
||||
|
||||
// clean up old bpmn-js instance
|
||||
|
|
|
@ -5,22 +5,24 @@ var forEach = require('min-dash').forEach;
|
|||
|
||||
function DescriptorTree(tree) {
|
||||
|
||||
var self = this;
|
||||
|
||||
this._tree = {};
|
||||
this._length = 0;
|
||||
|
||||
forEach(tree, function(branch, depth) {
|
||||
if (branch.length) {
|
||||
this._length += 1;
|
||||
self._length += 1;
|
||||
}
|
||||
|
||||
forEach(branch, function(element) {
|
||||
|
||||
element.depth = parseInt(depth, 10);
|
||||
|
||||
this._tree[element.id] = element;
|
||||
}, this);
|
||||
self._tree[element.id] = element;
|
||||
});
|
||||
|
||||
}, this);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = DescriptorTree;
|
||||
|
|
|
@ -60,7 +60,7 @@ describe('features - bpmn-updater', function() {
|
|||
it('should not create new di refs', inject(function(modeling, elementRegistry, elementFactory) {
|
||||
|
||||
// given
|
||||
// sequence flow without any sourceElement and targetElement di information
|
||||
// sequence flow without some sourceElement and targetElement di information
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_4');
|
||||
|
||||
var intermediateThrowEvent = elementFactory.createShape({ type: 'bpmn:IntermediateThrowEvent' }),
|
||||
|
|
|
@ -4,7 +4,7 @@ require('../../../../TestHelper');
|
|||
|
||||
/* global inject, bootstrapModeler */
|
||||
|
||||
var flatten = require('../../../util/flatten');
|
||||
var flatten = require('min-dash').flatten;
|
||||
|
||||
var coreModule = require('lib/core'),
|
||||
moveModule = require('diagram-js/lib/features/move'),
|
||||
|
|
|
@ -14,7 +14,8 @@ var coreModule = require('lib/core'),
|
|||
var domQuery = require('min-dom').query,
|
||||
domClasses = require('min-dom').classes;
|
||||
|
||||
var find = require('min-dash').find;
|
||||
var find = require('min-dash').find,
|
||||
matchPattern = require('min-dash').matchPattern;
|
||||
|
||||
var is = require('lib/util/ModelUtil').is,
|
||||
isExpanded = require('lib/util/DiUtil').isExpanded;
|
||||
|
@ -41,7 +42,7 @@ function getEntries(popupMenu) {
|
|||
}
|
||||
|
||||
function triggerAction(entries, id) {
|
||||
var entry = find(entries, { id: id });
|
||||
var entry = find(entries, matchPattern({ id: id }));
|
||||
|
||||
if (!entry) {
|
||||
throw new Error('entry "'+ id +'" not found in replace menu');
|
||||
|
@ -1535,7 +1536,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
var entries = getEntries(popupMenu);
|
||||
|
||||
// trigger DefaultFlow replacement
|
||||
var replaceDefaultFlow = find(entries, { id: 'replace-with-default-flow' });
|
||||
var replaceDefaultFlow = find(entries, matchPattern({ id: 'replace-with-default-flow' }));
|
||||
|
||||
replaceDefaultFlow.action();
|
||||
|
||||
|
@ -1570,16 +1571,20 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
);
|
||||
|
||||
|
||||
it('should remove any conditionExpression when morphing to DefaultFlow',
|
||||
it('should remove conditionExpression when morphing to DefaultFlow',
|
||||
inject(function(elementRegistry, modeling, popupMenu, moddle) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
||||
exclusiveGateway = elementRegistry.get('ExclusiveGateway_1');
|
||||
|
||||
var conditionExpression = moddle.create('bpmn:FormalExpression', { body: '' });
|
||||
var conditionExpression = moddle.create('bpmn:FormalExpression', {
|
||||
body: ''
|
||||
});
|
||||
|
||||
modeling.updateProperties(sequenceFlow, { conditionExpression: conditionExpression });
|
||||
modeling.updateProperties(sequenceFlow, {
|
||||
conditionExpression: conditionExpression
|
||||
});
|
||||
|
||||
// when
|
||||
openPopup(sequenceFlow);
|
||||
|
@ -1596,7 +1601,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
);
|
||||
|
||||
|
||||
it('should remove any conditionExpression when morphing to DefaultFlow -> undo',
|
||||
it('should remove some conditionExpression when morphing to DefaultFlow -> undo',
|
||||
inject(function(elementRegistry, modeling, popupMenu, moddle, commandStack) {
|
||||
|
||||
// given
|
||||
|
@ -1651,22 +1656,24 @@ 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');
|
||||
it('should morph into a ConditionalFlow -> undo', inject(
|
||||
function(elementRegistry, popupMenu, commandStack) {
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_2');
|
||||
|
||||
// when
|
||||
openPopup(sequenceFlow);
|
||||
// when
|
||||
openPopup(sequenceFlow);
|
||||
|
||||
var entries = getEntries(popupMenu);
|
||||
var entries = getEntries(popupMenu);
|
||||
|
||||
triggerAction(entries, 'replace-with-conditional-flow');
|
||||
triggerAction(entries, 'replace-with-conditional-flow');
|
||||
|
||||
commandStack.undo();
|
||||
commandStack.undo();
|
||||
|
||||
// then
|
||||
expect(sequenceFlow.businessObject.conditionExpression).to.not.exist;
|
||||
}));
|
||||
// then
|
||||
expect(sequenceFlow.businessObject.conditionExpression).to.not.exist;
|
||||
}
|
||||
));
|
||||
|
||||
|
||||
it('should morph back into a SequenceFlow', inject(function(elementRegistry, popupMenu) {
|
||||
|
|
|
@ -248,7 +248,7 @@ describe('features/replace-preview', function() {
|
|||
);
|
||||
|
||||
|
||||
it('should not replace any non-interrupting start events in a selection of multiple elements',
|
||||
it('should not replace some non-interrupting start events in a selection of multiple elements',
|
||||
inject(function(move, dragging, elementRegistry, selection) {
|
||||
|
||||
// given
|
||||
|
|
|
@ -1,9 +1,14 @@
|
|||
'use strict';
|
||||
|
||||
var any = require('min-dash').any;
|
||||
var some = require('min-dash').some;
|
||||
|
||||
var ALLOWED_TYPES = {
|
||||
FailedJobRetryTimeCycle: [ 'bpmn:StartEvent', 'bpmn:BoundaryEvent', 'bpmn:IntermediateCatchEvent', 'bpmn:Activity' ],
|
||||
FailedJobRetryTimeCycle: [
|
||||
'bpmn:StartEvent',
|
||||
'bpmn:BoundaryEvent',
|
||||
'bpmn:IntermediateCatchEvent',
|
||||
'bpmn:Activity'
|
||||
],
|
||||
Connector: [ 'bpmn:EndEvent', 'bpmn:IntermediateThrowEvent' ],
|
||||
Field: [ 'bpmn:EndEvent', 'bpmn:IntermediateThrowEvent' ]
|
||||
};
|
||||
|
@ -18,13 +23,13 @@ function exists(element) {
|
|||
}
|
||||
|
||||
function includesType(collection, type) {
|
||||
return exists(collection) && any(collection, function(element) {
|
||||
return exists(collection) && some(collection, function(element) {
|
||||
return is(element, type);
|
||||
});
|
||||
}
|
||||
|
||||
function anyType(element, types) {
|
||||
return any(types, function(type) {
|
||||
return some(types, function(type) {
|
||||
return is(element, type);
|
||||
});
|
||||
}
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
module.exports = function(array) {
|
||||
return [].concat.apply([], array);
|
||||
};
|
|
@ -1,20 +0,0 @@
|
|||
var isObject = require('min-dash').isObject;
|
||||
var forEach = require('min-dash').forEach;
|
||||
|
||||
module.exports = function merge(target) {
|
||||
var sources = [].slice.call(arguments, 1);
|
||||
if (!sources.length) return target;
|
||||
var source = sources.shift();
|
||||
|
||||
if (isObject(target) && isObject(source)) {
|
||||
forEach(source, function(val, key) {
|
||||
if (isObject(val) && isObject(target[key])) {
|
||||
merge(target[key], val);
|
||||
} else {
|
||||
target[key] = val;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
return merge.apply(this, [target].concat(sources));
|
||||
};
|
Loading…
Reference in New Issue