chore(project): switch to eslint
Use eslint instead of jshint for linting. * better linting results * test files linted, too * consistent code style checks Closes #568
This commit is contained in:
parent
7e93759a0d
commit
0ba239bbce
|
@ -0,0 +1,34 @@
|
|||
{
|
||||
"rules": {
|
||||
"keyword-spacing": [ 2 ],
|
||||
"object-curly-spacing": [ 2, "always"],
|
||||
"space-before-blocks": [ 2, "always"],
|
||||
"indent": [ 2, 2, { "VariableDeclarator": { "var": 2, "let": 2, "const": 3 } } ],
|
||||
"no-unused-vars": [ 2, { "args": "none" } ],
|
||||
"space-before-function-paren": [ 2, "never" ],
|
||||
"quotes": [ 2, "single" ],
|
||||
"semi": [ 2, "always" ],
|
||||
"no-console": 0,
|
||||
"mocha/no-exclusive-tests": 2
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
"browser": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"parserOptions": {
|
||||
"sourceType": "module"
|
||||
},
|
||||
"plugins": [
|
||||
"mocha"
|
||||
],
|
||||
"globals": {
|
||||
"expect": false,
|
||||
"it": false,
|
||||
"describe": false,
|
||||
"beforeEach": true,
|
||||
"afterEach": true,
|
||||
"before": true,
|
||||
"after": true
|
||||
}
|
||||
}
|
18
.jshintrc
18
.jshintrc
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"browser": true,
|
||||
"node": true,
|
||||
"strict": true,
|
||||
"unused": "vars",
|
||||
"maxlen": 120,
|
||||
"expr": true,
|
||||
"globals": {
|
||||
"describe": false,
|
||||
"it": false,
|
||||
"expect": true,
|
||||
"beforeEach": true,
|
||||
"afterEach": true,
|
||||
"console": true,
|
||||
"spyOn": true,
|
||||
"jasmine": true
|
||||
}
|
||||
}
|
|
@ -2,7 +2,7 @@ language: node_js
|
|||
node_js: '4.0'
|
||||
|
||||
script:
|
||||
- grunt jshint test
|
||||
- npm run all
|
||||
|
||||
before_install:
|
||||
- npm install -g wiredeps
|
||||
|
|
21
Gruntfile.js
21
Gruntfile.js
|
@ -22,12 +22,19 @@ module.exports = function(grunt) {
|
|||
dist: '../bower-bpmn-js/dist'
|
||||
},
|
||||
|
||||
jshint: {
|
||||
src: [
|
||||
['<%=config.sources %>']
|
||||
],
|
||||
options: {
|
||||
jshintrc: true
|
||||
eslint: {
|
||||
check: {
|
||||
src: [
|
||||
'{lib,test}/**/*.js'
|
||||
]
|
||||
},
|
||||
fix: {
|
||||
src: [
|
||||
'{lib,test}/**/*.js'
|
||||
],
|
||||
options: {
|
||||
fix: true
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -116,5 +123,5 @@ module.exports = function(grunt) {
|
|||
|
||||
grunt.registerTask('build', [ 'bundle', 'copy' ]);
|
||||
|
||||
grunt.registerTask('default', [ 'jshint', 'test', 'build' ]);
|
||||
grunt.registerTask('default', [ 'eslint:check', 'test', 'build' ]);
|
||||
};
|
|
@ -399,7 +399,7 @@ function BpmnRenderer(eventBus, styles, pathMap, priority) {
|
|||
strokeLinecap: 'square'
|
||||
});
|
||||
|
||||
for(var i = 0;i < 12;i++) {
|
||||
for (var i = 0;i < 12;i++) {
|
||||
|
||||
var linePathData = pathMap.getScaledPath('EVENT_TIMER_LINE', {
|
||||
xScaleFactor: 0.75,
|
||||
|
@ -946,7 +946,7 @@ function BpmnRenderer(eventBus, styles, pathMap, priority) {
|
|||
}
|
||||
});
|
||||
|
||||
if (!!(getDi(element).isMarkerVisible)) {
|
||||
if ((getDi(element).isMarkerVisible)) {
|
||||
drawPath(p, pathData, {
|
||||
strokeWidth: 1,
|
||||
fill: 'black'
|
||||
|
|
|
@ -411,7 +411,7 @@ function PathMap() {
|
|||
// compute the start point of the path
|
||||
var mx, my;
|
||||
|
||||
if(!!param.abspos) {
|
||||
if (param.abspos) {
|
||||
mx = param.abspos.x;
|
||||
my = param.abspos.y;
|
||||
} else {
|
||||
|
@ -420,7 +420,7 @@ function PathMap() {
|
|||
}
|
||||
|
||||
var coordinates = {}; //map for the scaled coordinates
|
||||
if(param.position) {
|
||||
if (param.position) {
|
||||
|
||||
// path
|
||||
var heightRatio = (param.containerHeight / rawPath.height) * param.yScaleFactor;
|
||||
|
|
|
@ -21,7 +21,7 @@ var PADDING = { top: 2, bottom: 2, left: 15, right: 15 };
|
|||
* An auto resize component that takes care of expanding parent participants
|
||||
* and lanes if elements are modeled close to an edge of the parent element.
|
||||
*/
|
||||
function AutoResize(eventBus, canvas, modeling, elementRegistry){
|
||||
function AutoResize(eventBus, canvas, modeling, elementRegistry) {
|
||||
|
||||
CommandInterceptor.call(this, eventBus);
|
||||
|
||||
|
@ -74,7 +74,7 @@ function AutoResize(eventBus, canvas, modeling, elementRegistry){
|
|||
top: bbox.y < target.y + padding.top,
|
||||
bottom: bbox.y + bbox.height > target.y + target.height - padding.bottom,
|
||||
left: bbox.x < target.x + padding.left,
|
||||
right: bbox.x + bbox.width > target.x + target.width - padding.right,
|
||||
right: bbox.x + bbox.width > target.x + target.width - padding.right
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -216,16 +216,16 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|||
'append.receive-task': appendAction('bpmn:ReceiveTask', 'bpmn-icon-receive-task'),
|
||||
'append.message-intermediate-event': appendAction('bpmn:IntermediateCatchEvent',
|
||||
'bpmn-icon-intermediate-event-catch-message',
|
||||
{ eventDefinitionType: 'bpmn:MessageEventDefinition'}),
|
||||
{ eventDefinitionType: 'bpmn:MessageEventDefinition' }),
|
||||
'append.timer-intermediate-event': appendAction('bpmn:IntermediateCatchEvent',
|
||||
'bpmn-icon-intermediate-event-catch-timer',
|
||||
{ eventDefinitionType: 'bpmn:TimerEventDefinition'}),
|
||||
{ eventDefinitionType: 'bpmn:TimerEventDefinition' }),
|
||||
'append.condtion-intermediate-event': appendAction('bpmn:IntermediateCatchEvent',
|
||||
'bpmn-icon-intermediate-event-catch-condition',
|
||||
{ eventDefinitionType: 'bpmn:ConditionalEventDefinition'}),
|
||||
{ eventDefinitionType: 'bpmn:ConditionalEventDefinition' }),
|
||||
'append.signal-intermediate-event': appendAction('bpmn:IntermediateCatchEvent',
|
||||
'bpmn-icon-intermediate-event-catch-signal',
|
||||
{ eventDefinitionType: 'bpmn:SignalEventDefinition'})
|
||||
{ eventDefinitionType: 'bpmn:SignalEventDefinition' })
|
||||
});
|
||||
} else
|
||||
|
||||
|
@ -318,7 +318,7 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
|||
}
|
||||
|
||||
// delete element entry, only show if allowed by rules
|
||||
var deleteAllowed = rules.allowed('elements.delete', { elements: [ element ]});
|
||||
var deleteAllowed = rules.allowed('elements.delete', { elements: [ element ] });
|
||||
|
||||
if (isArray(deleteAllowed)) {
|
||||
// was the element returned as a deletion candidate?
|
||||
|
|
|
@ -88,7 +88,6 @@ function BpmnCopyPaste(bpmnFactory, eventBus, copyPaste, clipboard, moddle, canv
|
|||
parent = descriptor.parent,
|
||||
rootElement = canvas.getRootElement(),
|
||||
businessObject,
|
||||
eventDefinitions,
|
||||
newEventDefinition,
|
||||
conditionExpression,
|
||||
loopCharacteristics,
|
||||
|
@ -139,7 +138,7 @@ function BpmnCopyPaste(bpmnFactory, eventBus, copyPaste, clipboard, moddle, canv
|
|||
|
||||
setProperties(businessObject, descriptor, [
|
||||
'name',
|
||||
'text',
|
||||
'text'
|
||||
]);
|
||||
|
||||
if (descriptor.loopCharacteristics) {
|
||||
|
@ -163,8 +162,6 @@ function BpmnCopyPaste(bpmnFactory, eventBus, copyPaste, clipboard, moddle, canv
|
|||
}
|
||||
|
||||
if (descriptor.eventDefinitions) {
|
||||
eventDefinitions = businessObject.eventDefinitions;
|
||||
|
||||
businessObject.eventDefinitions = map(descriptor.eventDefinitions, function(type) {
|
||||
newEventDefinition = moddle.create(type);
|
||||
|
||||
|
@ -174,7 +171,13 @@ function BpmnCopyPaste(bpmnFactory, eventBus, copyPaste, clipboard, moddle, canv
|
|||
});
|
||||
}
|
||||
|
||||
removeProperties(descriptor, [ 'name', 'text', 'eventDefinitions', 'conditionExpression', 'loopCharacteristics' ]);
|
||||
removeProperties(descriptor, [
|
||||
'name',
|
||||
'text',
|
||||
'eventDefinitions',
|
||||
'conditionExpression',
|
||||
'loopCharacteristics'
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -189,4 +192,4 @@ BpmnCopyPaste.$inject = [
|
|||
'bpmnRules'
|
||||
];
|
||||
|
||||
module.exports = BpmnCopyPaste;
|
||||
module.exports = BpmnCopyPaste;
|
|
@ -439,7 +439,7 @@ BpmnUpdater.prototype.updateSemanticParent = function(businessObject, newParent,
|
|||
do {
|
||||
// unwrap Lane -> LaneSet -> (Lane | FlowElementsContainer)
|
||||
newParent = newParent.$parent.$parent;
|
||||
} while(is(newParent, 'bpmn:Lane'));
|
||||
} while (is(newParent, 'bpmn:Lane'));
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ function ReplaceConnectionBehavior(eventBus, modeling, bpmnRules) {
|
|||
this.postExecuted([
|
||||
'connection.reconnectStart',
|
||||
'connection.reconnectEnd'
|
||||
], function(event){
|
||||
], function(event) {
|
||||
|
||||
var connection = event.context.connection;
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ IdClaimHandler.prototype.execute = function(context) {
|
|||
element = context.element,
|
||||
claiming = context.claiming;
|
||||
|
||||
if (claiming){
|
||||
if (claiming) {
|
||||
ids.claim(id, element);
|
||||
} else {
|
||||
ids.unclaim(id);
|
||||
|
@ -32,7 +32,7 @@ IdClaimHandler.prototype.revert = function(context) {
|
|||
element = context.element,
|
||||
claiming = context.claiming;
|
||||
|
||||
if (claiming){
|
||||
if (claiming) {
|
||||
ids.unclaim(id);
|
||||
} else {
|
||||
ids.claim(id, element);
|
||||
|
|
|
@ -87,9 +87,9 @@ function BpmnOrderingProvider(eventBus, translate) {
|
|||
|
||||
if (!actualParent) {
|
||||
throw new Error(translate('no parent for {element} in {parent}', {
|
||||
element: element.id,
|
||||
parent: newParent.id
|
||||
}));
|
||||
element: element.id,
|
||||
parent: newParent.id
|
||||
}));
|
||||
}
|
||||
|
||||
return actualParent;
|
||||
|
|
|
@ -273,7 +273,7 @@ ReplaceMenuProvider.prototype._createEntries = function(element, replaceOptions)
|
|||
|
||||
* @return {Array<Object>} a list of menu items
|
||||
*/
|
||||
ReplaceMenuProvider.prototype._createSequenceFlowEntries = function (element, replaceOptions) {
|
||||
ReplaceMenuProvider.prototype._createSequenceFlowEntries = function(element, replaceOptions) {
|
||||
|
||||
var businessObject = getBusinessObject(element);
|
||||
|
||||
|
@ -287,44 +287,44 @@ ReplaceMenuProvider.prototype._createSequenceFlowEntries = function (element, re
|
|||
forEach(replaceOptions, function(entry) {
|
||||
|
||||
switch (entry.actionName) {
|
||||
case 'replace-with-default-flow':
|
||||
if (businessObject.sourceRef.default !== businessObject &&
|
||||
case 'replace-with-default-flow':
|
||||
if (businessObject.sourceRef.default !== businessObject &&
|
||||
(is(businessObject.sourceRef, 'bpmn:ExclusiveGateway') ||
|
||||
is(businessObject.sourceRef, 'bpmn:InclusiveGateway') ||
|
||||
is(businessObject.sourceRef, 'bpmn:Activity'))) {
|
||||
|
||||
menuEntries.push(self._createMenuEntry(entry, element, function() {
|
||||
modeling.updateProperties(element.source, { default: businessObject });
|
||||
}));
|
||||
}
|
||||
break;
|
||||
case 'replace-with-conditional-flow':
|
||||
if (!businessObject.conditionExpression && is(businessObject.sourceRef, 'bpmn:Activity')) {
|
||||
menuEntries.push(self._createMenuEntry(entry, element, function() {
|
||||
modeling.updateProperties(element.source, { default: businessObject });
|
||||
}));
|
||||
}
|
||||
break;
|
||||
case 'replace-with-conditional-flow':
|
||||
if (!businessObject.conditionExpression && is(businessObject.sourceRef, 'bpmn:Activity')) {
|
||||
|
||||
menuEntries.push(self._createMenuEntry(entry, element, function() {
|
||||
var conditionExpression = moddle.create('bpmn:FormalExpression', { body: '' });
|
||||
menuEntries.push(self._createMenuEntry(entry, element, function() {
|
||||
var conditionExpression = moddle.create('bpmn:FormalExpression', { body: '' });
|
||||
|
||||
modeling.updateProperties(element, { conditionExpression: conditionExpression });
|
||||
}));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
modeling.updateProperties(element, { conditionExpression: conditionExpression });
|
||||
}));
|
||||
}
|
||||
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 });
|
||||
}));
|
||||
}
|
||||
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') ||
|
||||
if ((is(businessObject.sourceRef, 'bpmn:ExclusiveGateway') ||
|
||||
is(businessObject.sourceRef, 'bpmn:InclusiveGateway') ||
|
||||
is(businessObject.sourceRef, 'bpmn:Activity')) &&
|
||||
businessObject.sourceRef.default === businessObject) {
|
||||
|
||||
return menuEntries.push(self._createMenuEntry(entry, element, function() {
|
||||
modeling.updateProperties(element.source, { default: undefined });
|
||||
}));
|
||||
}
|
||||
return menuEntries.push(self._createMenuEntry(entry, element, function() {
|
||||
modeling.updateProperties(element.source, { default: undefined });
|
||||
}));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -83,16 +83,16 @@ function BpmnReplace(bpmnFactory, replace, selection, modeling) {
|
|||
if (is(oldBusinessObject, 'bpmn:Participant')) {
|
||||
|
||||
// create expanded pool
|
||||
if (target.isExpanded === true) {
|
||||
newBusinessObject.processRef = bpmnFactory.create('bpmn:Process');
|
||||
} else {
|
||||
if (target.isExpanded === true) {
|
||||
newBusinessObject.processRef = bpmnFactory.create('bpmn:Process');
|
||||
} else {
|
||||
// remove children when transforming to collapsed pool
|
||||
hints.moveChildren = false;
|
||||
}
|
||||
hints.moveChildren = false;
|
||||
}
|
||||
|
||||
// apply same size
|
||||
newElement.width = element.width;
|
||||
newElement.height = element.height;
|
||||
newElement.width = element.width;
|
||||
newElement.height = element.height;
|
||||
}
|
||||
|
||||
newBusinessObject.name = oldBusinessObject.name;
|
||||
|
|
|
@ -400,7 +400,7 @@ module.exports.EVENT_SUB_PROCESS = [
|
|||
type: 'bpmn:Transaction',
|
||||
isExpanded: true
|
||||
}
|
||||
},
|
||||
}
|
||||
];
|
||||
|
||||
module.exports.TASK = [
|
||||
|
@ -618,7 +618,7 @@ module.exports.BOUNDARY_EVENT = [
|
|||
eventDefinitionType: 'bpmn:SignalEventDefinition',
|
||||
cancelActivity: false
|
||||
}
|
||||
},
|
||||
}
|
||||
];
|
||||
|
||||
module.exports.EVENT_SUB_PROCESS_START_EVENT = [
|
||||
|
@ -734,7 +734,7 @@ module.exports.EVENT_SUB_PROCESS_START_EVENT = [
|
|||
eventDefinitionType: 'bpmn:EscalationEventDefinition',
|
||||
isInterrupting: false
|
||||
}
|
||||
},
|
||||
}
|
||||
];
|
||||
|
||||
module.exports.SEQUENCE_FLOW = [
|
||||
|
|
|
@ -412,11 +412,11 @@ function canDrop(element, target, position) {
|
|||
|
||||
if (is(element, 'bpmn:Artifact')) {
|
||||
return isAny(target, [
|
||||
'bpmn:Collaboration',
|
||||
'bpmn:Lane',
|
||||
'bpmn:Participant',
|
||||
'bpmn:Process',
|
||||
'bpmn:SubProcess' ]);
|
||||
'bpmn:Collaboration',
|
||||
'bpmn:Lane',
|
||||
'bpmn:Participant',
|
||||
'bpmn:Process',
|
||||
'bpmn:SubProcess' ]);
|
||||
}
|
||||
|
||||
if (is(element, 'bpmn:MessageFlow')) {
|
||||
|
@ -454,11 +454,11 @@ function canPaste(tree, target) {
|
|||
}
|
||||
|
||||
return isAny(target, [
|
||||
'bpmn:Collaboration',
|
||||
'bpmn:Lane',
|
||||
'bpmn:Participant',
|
||||
'bpmn:Process',
|
||||
'bpmn:SubProcess' ]);
|
||||
'bpmn:Collaboration',
|
||||
'bpmn:Lane',
|
||||
'bpmn:Participant',
|
||||
'bpmn:Process',
|
||||
'bpmn:SubProcess' ]);
|
||||
}
|
||||
|
||||
function isBoundaryEvent(element) {
|
||||
|
|
|
@ -82,7 +82,7 @@ BpmnSearchProvider.prototype.find = function(pattern) {
|
|||
|
||||
|
||||
function hasMatched(tokens) {
|
||||
var matched = filter(tokens, function(t){
|
||||
var matched = filter(tokens, function(t) {
|
||||
return !!t.matched;
|
||||
});
|
||||
|
||||
|
|
|
@ -274,7 +274,7 @@ BpmnSnapping.prototype.initSnap = function(event) {
|
|||
width: shape.width,
|
||||
height: shape.height,
|
||||
x: isNaN(shape.x) ? round(shapeMid.x - shape.width / 2) : shape.x,
|
||||
y: isNaN(shape.y) ? round(shapeMid.y - shape.height / 2) : shape.y,
|
||||
y: isNaN(shape.y) ? round(shapeMid.y - shape.height / 2) : shape.y
|
||||
};
|
||||
|
||||
shapeTopLeft = topLeft(shapeBounds);
|
||||
|
|
|
@ -29,10 +29,10 @@ function collectWaypoints(waypoints) {
|
|||
|
||||
function notYetDrawn(translate, semantic, refSemantic, property) {
|
||||
return new Error(translate('element {element} referenced by {referenced}#{property} not yet drawn', {
|
||||
element: elementToString(refSemantic),
|
||||
referenced: elementToString(semantic),
|
||||
property: property
|
||||
}));
|
||||
element: elementToString(refSemantic),
|
||||
referenced: elementToString(semantic),
|
||||
property: property
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -122,9 +122,9 @@ BpmnImporter.prototype.add = function(semantic, parentElement) {
|
|||
this._canvas.addConnection(element, parentElement);
|
||||
} else {
|
||||
throw new Error(translate('unknown di {di} for element {semantic}', {
|
||||
di: elementToString(di),
|
||||
semantic: elementToString(semantic)
|
||||
}));
|
||||
di: elementToString(di),
|
||||
semantic: elementToString(semantic)
|
||||
}));
|
||||
}
|
||||
// (optional) LABEL
|
||||
if (hasExternalLabel(semantic)) {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
"version": "0.15.2",
|
||||
"description": "A bpmn 2.0 toolkit and web modeler",
|
||||
"scripts": {
|
||||
"all": "grunt",
|
||||
"test": "grunt test"
|
||||
},
|
||||
"repository": {
|
||||
|
@ -34,10 +35,12 @@
|
|||
"browserify-derequire": "^0.9.1",
|
||||
"bundle-collapser": "^1.1.1",
|
||||
"chai": "~2.2.0",
|
||||
"eslint": "^2.11.1",
|
||||
"eslint-plugin-mocha": "^2.2.0",
|
||||
"grunt": "^0.4.4",
|
||||
"grunt-cli": "^0.1.13",
|
||||
"grunt-contrib-copy": "^0.7.0",
|
||||
"grunt-contrib-jshint": "^0.7.2",
|
||||
"grunt-eslint": "^18.1.0",
|
||||
"grunt-karma": "^0.12.0",
|
||||
"grunt-release": "^0.7.0",
|
||||
"jsondiffpatch": "^0.1.26",
|
||||
|
|
|
@ -1,19 +1,20 @@
|
|||
'use strict';
|
||||
|
||||
var fs = require( 'fs' );
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
var unique = require('lodash/array/unique');
|
||||
var sortBy = require('lodash/collection/sortBy');
|
||||
|
||||
var TranslationReporter = function() {
|
||||
process.env.TRANSLATIONS = 'enabled';
|
||||
function TranslationReporter() {
|
||||
process.env.TRANSLATIONS = 'enabled';
|
||||
|
||||
var outputFile = path.join(__dirname, '../../docs/translations.json');
|
||||
var outputFile = path.join(__dirname, '../../docs/translations.json');
|
||||
|
||||
var translations = [];
|
||||
|
||||
|
||||
this.onBrowserLog = function(browser, log, type) {
|
||||
this.onBrowserLog = function(browser, log, type) {
|
||||
|
||||
if ( log === undefined || typeof log !== 'string' ) {
|
||||
return;
|
||||
|
@ -32,17 +33,17 @@ var TranslationReporter = function() {
|
|||
} catch (e) {
|
||||
return;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
this.onRunComplete = function () {
|
||||
this.onRunComplete = function() {
|
||||
translations = unique(translations);
|
||||
translations = sortBy(translations);
|
||||
|
||||
fs.writeFileSync(outputFile, JSON.stringify(translations, null, 2));
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
'reporter:translation-reporter' : [ 'type', TranslationReporter ]
|
||||
'reporter:translation-reporter' : [ 'type', TranslationReporter ]
|
||||
};
|
|
@ -229,7 +229,7 @@ function insertCSS(name, css) {
|
|||
|
||||
var head = document.head || document.getElementsByTagName('head')[0],
|
||||
style = document.createElement('style');
|
||||
style.setAttribute('data-css-file', name);
|
||||
style.setAttribute('data-css-file', name);
|
||||
|
||||
style.type = 'text/css';
|
||||
if (style.styleSheet) {
|
||||
|
|
|
@ -8,7 +8,7 @@ var canvasEvent = require('../util/MockEvents').createCanvasEvent;
|
|||
|
||||
|
||||
var customElementsModules = require('./custom-elements'),
|
||||
noTouchInteractionModule = { touchInteractionEvents: ['value', null ]},
|
||||
noTouchInteractionModule = { touchInteractionEvents: ['value', null ] },
|
||||
modelerModules = Modeler.prototype._modules,
|
||||
customModules = [ customElementsModules, noTouchInteractionModule ];
|
||||
|
||||
|
@ -21,7 +21,7 @@ var collaborationDiagramXML = require('../fixtures/bpmn/collaboration.bpmn');
|
|||
|
||||
describe('custom elements', function() {
|
||||
|
||||
describe('renderer', function () {
|
||||
describe('renderer', function() {
|
||||
|
||||
beforeEach(bootstrapModeler(processDiagramXML, {
|
||||
modules: testModules
|
||||
|
@ -80,7 +80,7 @@ describe('custom elements', function() {
|
|||
});
|
||||
|
||||
|
||||
describe('integration', function () {
|
||||
describe('integration', function() {
|
||||
|
||||
describe('process diagram', function() {
|
||||
|
||||
|
@ -114,66 +114,69 @@ describe('custom elements', function() {
|
|||
it('should allow moving a custom shape inside another one',
|
||||
inject(function(elementFactory, elementRegistry, dragging, move) {
|
||||
|
||||
// given
|
||||
var circleGfx = elementRegistry.getGraphics(circle);
|
||||
// given
|
||||
var circleGfx = elementRegistry.getGraphics(circle);
|
||||
|
||||
// when
|
||||
move.start(canvasEvent({ x: 0, y: 0 }), triangle);
|
||||
// when
|
||||
move.start(canvasEvent({ x: 0, y: 0 }), triangle);
|
||||
|
||||
dragging.move(canvasEvent({ x: 100, y: 0 }));
|
||||
dragging.hover({ element: circle, gfx: circleGfx });
|
||||
dragging.move(canvasEvent({ x: 150, y: 50 }));
|
||||
dragging.move(canvasEvent({ x: 100, y: 0 }));
|
||||
dragging.hover({ element: circle, gfx: circleGfx });
|
||||
dragging.move(canvasEvent({ x: 150, y: 50 }));
|
||||
|
||||
dragging.end();
|
||||
dragging.end();
|
||||
|
||||
// then
|
||||
expect(triangle.parent).to.equal(circle);
|
||||
}));
|
||||
// then
|
||||
expect(triangle.parent).to.equal(circle);
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should update the custom shape properties',
|
||||
inject(function(elementFactory, elementRegistry, dragging, move) {
|
||||
|
||||
// given
|
||||
var circleGfx = elementRegistry.getGraphics(circle);
|
||||
// given
|
||||
var circleGfx = elementRegistry.getGraphics(circle);
|
||||
|
||||
// when
|
||||
move.start(canvasEvent({ x: 0, y: 0 }), triangle);
|
||||
// when
|
||||
move.start(canvasEvent({ x: 0, y: 0 }), triangle);
|
||||
|
||||
dragging.move(canvasEvent({ x: 100, y: 0 }));
|
||||
dragging.hover({ element: circle, gfx: circleGfx });
|
||||
dragging.move(canvasEvent({ x: 150, y: 50 }));
|
||||
dragging.move(canvasEvent({ x: 100, y: 0 }));
|
||||
dragging.hover({ element: circle, gfx: circleGfx });
|
||||
dragging.move(canvasEvent({ x: 150, y: 50 }));
|
||||
|
||||
dragging.end();
|
||||
dragging.end();
|
||||
|
||||
// then
|
||||
expect(triangle.businessObject.leader).to.equal(circle);
|
||||
expect(circle.businessObject.companions).to.include(triangle);
|
||||
}));
|
||||
// then
|
||||
expect(triangle.businessObject.leader).to.equal(circle);
|
||||
expect(circle.businessObject.companions).to.include(triangle);
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should connect a bpmn element to a custom one',
|
||||
inject(function(elementFactory, dragging, elementRegistry, connect) {
|
||||
|
||||
// given
|
||||
var subProcess = elementRegistry.get('SubProcess_1'),
|
||||
triangleGfx = elementRegistry.getGraphics(triangle);
|
||||
// given
|
||||
var subProcess = elementRegistry.get('SubProcess_1'),
|
||||
triangleGfx = elementRegistry.getGraphics(triangle);
|
||||
|
||||
// when
|
||||
connect.start(canvasEvent({ x: 590, y: 90 }), subProcess);
|
||||
// when
|
||||
connect.start(canvasEvent({ x: 590, y: 90 }), subProcess);
|
||||
|
||||
dragging.move(canvasEvent({ x: 700, y: 100 }));
|
||||
dragging.hover({ element: triangle, gfx: triangleGfx });
|
||||
dragging.move(canvasEvent({ x: 715, y: 115 }));
|
||||
dragging.move(canvasEvent({ x: 700, y: 100 }));
|
||||
dragging.hover({ element: triangle, gfx: triangleGfx });
|
||||
dragging.move(canvasEvent({ x: 715, y: 115 }));
|
||||
|
||||
dragging.end();
|
||||
dragging.end();
|
||||
|
||||
var connection = triangle.incoming[0];
|
||||
var connection = triangle.incoming[0];
|
||||
|
||||
// then
|
||||
expect(connection.type).to.equal('bpmn:Association');
|
||||
expect(connection.source).to.equal(subProcess);
|
||||
}));
|
||||
// then
|
||||
expect(connection.type).to.equal('bpmn:Association');
|
||||
expect(connection.source).to.equal(subProcess);
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
@ -202,18 +205,19 @@ describe('custom elements', function() {
|
|||
it('should update parent when removing collaboration',
|
||||
inject(function(elementRegistry, modeling, canvas) {
|
||||
|
||||
// given
|
||||
var customTriangle = elementRegistry.get('triangle');
|
||||
// given
|
||||
var customTriangle = elementRegistry.get('triangle');
|
||||
|
||||
// when
|
||||
modeling.removeElements([
|
||||
elementRegistry.get('Participant_1'),
|
||||
elementRegistry.get('Participant_2')
|
||||
]);
|
||||
// when
|
||||
modeling.removeElements([
|
||||
elementRegistry.get('Participant_1'),
|
||||
elementRegistry.get('Participant_2')
|
||||
]);
|
||||
|
||||
// then
|
||||
expect(customTriangle.parent).to.eql(canvas.getRootElement());
|
||||
}));
|
||||
// then
|
||||
expect(customTriangle.parent).to.eql(canvas.getRootElement());
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ CustomElementFactory.$inject = [ 'bpmnFactory', 'moddle' ];
|
|||
*
|
||||
* @return {Bounds} { width, height}
|
||||
*/
|
||||
CustomElementFactory.prototype._getCustomElementSize = function (type) {
|
||||
CustomElementFactory.prototype._getCustomElementSize = function(type) {
|
||||
if (!type) {
|
||||
return { width: 100, height: 80 };
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../TestHelper');
|
||||
require('../TestHelper');
|
||||
|
||||
var NavigatedViewer = require('../../lib/NavigatedViewer');
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ describe('Viewer', function() {
|
|||
var container;
|
||||
|
||||
beforeEach(function() {
|
||||
container = TestContainer.get(this);
|
||||
container = TestContainer.get(this);
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../TestHelper');
|
||||
require('../../TestHelper');
|
||||
|
||||
var coreModule = require('../../../lib/core'),
|
||||
rendererModule = require('../../../lib/draw');
|
||||
|
@ -143,8 +143,8 @@ describe('draw - bpmn renderer', function() {
|
|||
|
||||
|
||||
it('should render boundary events without flowNodeRef', function(done) {
|
||||
var xml = require('../../fixtures/bpmn/draw/boundary-event-without-refnode.bpmn');
|
||||
bootstrapViewer(xml)(done);
|
||||
var xml = require('../../fixtures/bpmn/draw/boundary-event-without-refnode.bpmn');
|
||||
bootstrapViewer(xml)(done);
|
||||
});
|
||||
|
||||
|
||||
|
@ -206,7 +206,7 @@ describe('draw - bpmn renderer', function() {
|
|||
});
|
||||
|
||||
|
||||
describe('path', function () {
|
||||
describe('path', function() {
|
||||
|
||||
var diagramXML = require('../../fixtures/bpmn/simple-cropping.bpmn');
|
||||
|
||||
|
@ -214,7 +214,7 @@ describe('draw - bpmn renderer', function() {
|
|||
|
||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||
|
||||
describe('circle', function () {
|
||||
describe('circle', function() {
|
||||
|
||||
it('should return a circle path', inject(function(canvas, elementRegistry, graphicsFactory) {
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../TestHelper');
|
||||
require('../../TestHelper');
|
||||
|
||||
/* global bootstrapViewer, inject */
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
require('../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
@ -49,8 +49,7 @@ describe('features/auto-resize', function() {
|
|||
|
||||
describe('after moving', function() {
|
||||
|
||||
it('should expand the right edge',
|
||||
inject(function(modeling) {
|
||||
it('should expand the right edge', inject(function(modeling) {
|
||||
|
||||
// when
|
||||
modeling.moveElements([ taskShape ], { x: 100, y: 0 }, participantShape);
|
||||
|
@ -120,8 +119,7 @@ describe('features/auto-resize', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('should resize the parent if element and parent edge intersect',
|
||||
inject(function(modeling) {
|
||||
it('should resize the parent on element/parent edge intersect', inject(function(modeling) {
|
||||
|
||||
// when
|
||||
modeling.moveElements([ taskShape ], { x: 0, y: 49 }, participantShape);
|
||||
|
@ -133,8 +131,7 @@ describe('features/auto-resize', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('should not resize the parent if element is placed near the bottom',
|
||||
inject(function(modeling) {
|
||||
it('should not resize the parent if element is placed near the bottom', inject(function(modeling) {
|
||||
|
||||
// when
|
||||
modeling.moveElements([ taskShape ], { x: 0, y: 47 }, participantShape);
|
||||
|
@ -144,27 +141,31 @@ describe('features/auto-resize', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('should undo resizing', inject(function(modeling, commandStack) {
|
||||
describe('undo / redo support', function() {
|
||||
|
||||
// when
|
||||
modeling.moveElements([ startEventShape ], { x: -100, y: -100 }, participantShape);
|
||||
commandStack.undo();
|
||||
it('should undo', inject(function(modeling, commandStack) {
|
||||
|
||||
// then
|
||||
expect(participantShape).to.have.bounds(originalBounds);
|
||||
}));
|
||||
// when
|
||||
modeling.moveElements([ startEventShape ], { x: -100, y: -100 }, participantShape);
|
||||
commandStack.undo();
|
||||
|
||||
// then
|
||||
expect(participantShape).to.have.bounds(originalBounds);
|
||||
}));
|
||||
|
||||
|
||||
it('should redo resizing', inject(function(modeling, commandStack) {
|
||||
it('should redo', inject(function(modeling, commandStack) {
|
||||
|
||||
// when
|
||||
modeling.moveElements([ startEventShape ], { x: -100, y: -100 }, participantShape);
|
||||
commandStack.undo();
|
||||
commandStack.redo();
|
||||
// when
|
||||
modeling.moveElements([ startEventShape ], { x: -100, y: -100 }, participantShape);
|
||||
commandStack.undo();
|
||||
commandStack.redo();
|
||||
|
||||
// then
|
||||
expect(participantShape).to.have.bounds({ x: 122, y: 71, width: 496, height: 267 });
|
||||
}));
|
||||
// then
|
||||
expect(participantShape).to.have.bounds({ x: 122, y: 71, width: 496, height: 267 });
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
@ -197,7 +198,7 @@ describe('features/auto-resize', function() {
|
|||
});
|
||||
|
||||
|
||||
describe('after appending', function(){
|
||||
describe('after appending', function() {
|
||||
|
||||
it('should expand the bottom right edges', inject(function(modeling) {
|
||||
|
||||
|
@ -227,22 +228,23 @@ describe('features/auto-resize', function() {
|
|||
it('should redo resizing and restore shapes and connections',
|
||||
inject(function(modeling, commandStack) {
|
||||
|
||||
// given
|
||||
var taskShape2 = modeling.appendShape(taskShape, { type: 'bpmn:Task' }, { x: 660, y: 250 }, participantShape);
|
||||
// given
|
||||
var taskShape2 = modeling.appendShape(taskShape, { type: 'bpmn:Task' }, { x: 660, y: 250 }, participantShape);
|
||||
|
||||
// when
|
||||
commandStack.undo();
|
||||
commandStack.redo();
|
||||
// when
|
||||
commandStack.undo();
|
||||
commandStack.redo();
|
||||
|
||||
// then
|
||||
var expectedBounds = assign(originalBounds, { width: 563 });
|
||||
// then
|
||||
var expectedBounds = assign(originalBounds, { width: 563 });
|
||||
|
||||
expect(participantShape).to.have.bounds(expectedBounds);
|
||||
expect(participantShape).to.have.bounds(expectedBounds);
|
||||
|
||||
expect(taskShape2).to.exist;
|
||||
expect(taskShape.outgoing).not.to.be.empty;
|
||||
expect(taskShape2.incoming).not.to.be.empty;
|
||||
}));
|
||||
expect(taskShape2).to.exist;
|
||||
expect(taskShape.outgoing).not.to.be.empty;
|
||||
expect(taskShape2.incoming).not.to.be.empty;
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
@ -295,7 +297,7 @@ describe('features/auto-resize', function() {
|
|||
modeling.createShape({ type: 'bpmn:Task' }, { x: 600, y: 320 }, participantShape);
|
||||
|
||||
// then
|
||||
expect(participantShape).to.have.bounds({ x: 247, y: 160, width: 503, height: 260});
|
||||
expect(participantShape).to.have.bounds({ x: 247, y: 160, width: 503, height: 260 });
|
||||
}));
|
||||
|
||||
|
||||
|
@ -365,65 +367,68 @@ describe('features/auto-resize', function() {
|
|||
it('should auto-resize after dropping selection inside',
|
||||
inject(function(selection, move, dragging, elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var subProcessShape = elementRegistry.get('SubProcess_1'),
|
||||
taskShape = elementRegistry.get('Task_1'),
|
||||
startEventShape = elementRegistry.get('StartEvent_1');
|
||||
// given
|
||||
var subProcessShape = elementRegistry.get('SubProcess_1'),
|
||||
taskShape = elementRegistry.get('Task_1'),
|
||||
startEventShape = elementRegistry.get('StartEvent_1');
|
||||
|
||||
var originalBounds = getBounds(subProcessShape);
|
||||
var originalBounds = getBounds(subProcessShape);
|
||||
|
||||
// when
|
||||
selection.select([ taskShape, startEventShape ]);
|
||||
// when
|
||||
selection.select([ taskShape, startEventShape ]);
|
||||
|
||||
move.start(canvasEvent({ x: 265, y: 235 }), startEventShape);
|
||||
move.start(canvasEvent({ x: 265, y: 235 }), startEventShape);
|
||||
|
||||
dragging.hover({
|
||||
element: subProcessShape,
|
||||
gfx: elementRegistry.getGraphics(subProcessShape)
|
||||
});
|
||||
dragging.hover({
|
||||
element: subProcessShape,
|
||||
gfx: elementRegistry.getGraphics(subProcessShape)
|
||||
});
|
||||
|
||||
dragging.move(canvasEvent({ x: 450, y: 235 }));
|
||||
dragging.move(canvasEvent({ x: 450, y: 235 }));
|
||||
|
||||
dragging.end();
|
||||
dragging.end();
|
||||
|
||||
// then
|
||||
var expectedBounds = assign(originalBounds, { width: 552 });
|
||||
// then
|
||||
var expectedBounds = assign(originalBounds, { width: 552 });
|
||||
|
||||
expect(subProcessShape).to.have.bounds(expectedBounds);
|
||||
}));
|
||||
expect(subProcessShape).to.have.bounds(expectedBounds);
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should not auto-resize after dropping selection outside',
|
||||
inject(function(selection, canvas, move, dragging, elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var subProcessShape = elementRegistry.get('SubProcess_1'),
|
||||
taskShape = elementRegistry.get('Task_1'),
|
||||
startEventShape = elementRegistry.get('StartEvent_1'),
|
||||
rootShape = canvas.getRootElement();
|
||||
// given
|
||||
var subProcessShape = elementRegistry.get('SubProcess_1'),
|
||||
taskShape = elementRegistry.get('Task_1'),
|
||||
startEventShape = elementRegistry.get('StartEvent_1'),
|
||||
rootShape = canvas.getRootElement();
|
||||
|
||||
var originalBounds = getBounds(subProcessShape);
|
||||
var originalBounds = getBounds(subProcessShape);
|
||||
|
||||
// when
|
||||
selection.select([ taskShape, startEventShape ]);
|
||||
// when
|
||||
selection.select([ taskShape, startEventShape ]);
|
||||
|
||||
move.start(canvasEvent({ x: 390, y: 110 }), taskShape);
|
||||
move.start(canvasEvent({ x: 390, y: 110 }), taskShape);
|
||||
|
||||
dragging.hover({
|
||||
element: rootShape,
|
||||
gfx: elementRegistry.getGraphics(rootShape)
|
||||
});
|
||||
dragging.hover({
|
||||
element: rootShape,
|
||||
gfx: elementRegistry.getGraphics(rootShape)
|
||||
});
|
||||
|
||||
dragging.move(canvasEvent({ x: 600, y: 110 }));
|
||||
dragging.move(canvasEvent({ x: 600, y: 110 }));
|
||||
|
||||
dragging.end();
|
||||
dragging.end();
|
||||
|
||||
// then
|
||||
expect(subProcessShape).to.have.bounds(originalBounds);
|
||||
}));
|
||||
// then
|
||||
expect(subProcessShape).to.have.bounds(originalBounds);
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('after moving multiple elements', function() {
|
||||
|
||||
var diagramXML = require('./AutoResize.multi-selection.bpmn');
|
||||
|
@ -443,8 +448,7 @@ describe('features/auto-resize', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('should not expand, if elements keep their parents (different original parents)',
|
||||
inject(function(modeling) {
|
||||
it('should not expand, if elements keep their parents (different original parents)', inject(function(modeling) {
|
||||
|
||||
// given
|
||||
var originalBounds = getBounds(subProcessShape_1);
|
||||
|
@ -455,12 +459,10 @@ describe('features/auto-resize', function() {
|
|||
|
||||
// then
|
||||
expect(subProcessShape_1).to.have.bounds(originalBounds);
|
||||
|
||||
}));
|
||||
|
||||
|
||||
it('should expand non-primary parents',
|
||||
inject(function(modeling) {
|
||||
it('should expand non-primary parents', inject(function(modeling) {
|
||||
|
||||
// given
|
||||
var originalBounds = getBounds(subProcessShape_1);
|
||||
|
@ -472,7 +474,6 @@ describe('features/auto-resize', function() {
|
|||
// then
|
||||
var expectedBounds = assign(originalBounds, { width: 525 });
|
||||
expect(subProcessShape_1).to.have.bounds(expectedBounds);
|
||||
|
||||
}));
|
||||
|
||||
|
||||
|
@ -489,11 +490,10 @@ describe('features/auto-resize', function() {
|
|||
// then
|
||||
var expectedBounds = assign(originalBounds, { x: 0, width: 444 });
|
||||
expect(subProcessShape_1).to.have.bounds(expectedBounds);
|
||||
|
||||
}));
|
||||
|
||||
|
||||
it('should expand, if primary shape changes parent', inject(function(modeling){
|
||||
it('should expand, if primary shape changes parent', inject(function(modeling) {
|
||||
|
||||
// given
|
||||
var originalBounds = getBounds(subProcessShape_1);
|
||||
|
@ -505,11 +505,10 @@ describe('features/auto-resize', function() {
|
|||
// then
|
||||
var expectedBounds = assign(originalBounds, { y: 80, height: 317 });
|
||||
expect(subProcessShape_1).to.have.bounds(expectedBounds);
|
||||
|
||||
}));
|
||||
|
||||
|
||||
it('should expand top and bottom edge, if primary shape changes parent', inject(function(modeling){
|
||||
it('should expand top and bottom edge, if primary shape changes parent', inject(function(modeling) {
|
||||
|
||||
// given
|
||||
var originalBounds = getBounds(subProcessShape_1);
|
||||
|
@ -521,18 +520,21 @@ describe('features/auto-resize', function() {
|
|||
// then
|
||||
var expectedBounds = assign(originalBounds, { y: 130, height: 334 });
|
||||
expect(subProcessShape_1).to.have.bounds(expectedBounds);
|
||||
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('nested sub processes', function() {
|
||||
|
||||
var diagramXML = require('./AutoResize.nested-sub-processes.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||
beforeEach(bootstrapModeler(diagramXML, {
|
||||
modules: testModules
|
||||
}));
|
||||
|
||||
it('should recursively expand parent element', inject(function(elementRegistry, modeling){
|
||||
|
||||
it('should recursively expand parent element', inject(function(elementRegistry, modeling) {
|
||||
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
subProcessShape_2 = elementRegistry.get('SubProcess_2'),
|
||||
|
@ -547,7 +549,8 @@ describe('features/auto-resize', function() {
|
|||
expect(subProcessShape_2).to.have.bounds(expectedBounds);
|
||||
}));
|
||||
|
||||
it('should recursively expand last parent element', inject(function(elementRegistry, modeling){
|
||||
|
||||
it('should recursively expand last parent element', inject(function(elementRegistry, modeling) {
|
||||
|
||||
var taskShape = elementRegistry.get('Task_1'),
|
||||
subProcessShape_1 = elementRegistry.get('SubProcess_1'),
|
||||
|
|
|
@ -30,7 +30,7 @@ describe('features - context-pad', function() {
|
|||
];
|
||||
|
||||
|
||||
describe('remove action rules', function () {
|
||||
describe('remove action rules', function() {
|
||||
|
||||
var diagramXML = require('../../../fixtures/bpmn/simple.bpmn');
|
||||
|
||||
|
@ -39,7 +39,7 @@ describe('features - context-pad', function() {
|
|||
|
||||
var deleteAction;
|
||||
|
||||
beforeEach(inject(function (contextPad) {
|
||||
beforeEach(inject(function(contextPad) {
|
||||
|
||||
deleteAction = function(element) {
|
||||
return padEntry(contextPad.getPad(element).html, 'delete');
|
||||
|
@ -47,7 +47,7 @@ describe('features - context-pad', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('should add delete action by default', inject(function (elementRegistry, contextPad) {
|
||||
it('should add delete action by default', inject(function(elementRegistry, contextPad) {
|
||||
|
||||
// given
|
||||
var element = elementRegistry.get('StartEvent_1');
|
||||
|
@ -61,39 +61,41 @@ describe('features - context-pad', function() {
|
|||
|
||||
|
||||
it('should include delete action when rule returns true',
|
||||
inject(function (elementRegistry, contextPad, customRules) {
|
||||
inject(function(elementRegistry, contextPad, customRules) {
|
||||
|
||||
// given
|
||||
customRules.addRule('elements.delete', 1500, function() {
|
||||
return true;
|
||||
});
|
||||
// given
|
||||
customRules.addRule('elements.delete', 1500, function() {
|
||||
return true;
|
||||
});
|
||||
|
||||
var element = elementRegistry.get('StartEvent_1');
|
||||
var element = elementRegistry.get('StartEvent_1');
|
||||
|
||||
// when
|
||||
contextPad.open(element);
|
||||
// when
|
||||
contextPad.open(element);
|
||||
|
||||
// then
|
||||
expect(deleteAction(element)).to.exist;
|
||||
}));
|
||||
// then
|
||||
expect(deleteAction(element)).to.exist;
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should NOT include delete action when rule returns false',
|
||||
inject(function(elementRegistry, contextPad, customRules) {
|
||||
|
||||
// given
|
||||
customRules.addRule('elements.delete', 1500, function() {
|
||||
return false;
|
||||
});
|
||||
// given
|
||||
customRules.addRule('elements.delete', 1500, function() {
|
||||
return false;
|
||||
});
|
||||
|
||||
var element = elementRegistry.get('StartEvent_1');
|
||||
var element = elementRegistry.get('StartEvent_1');
|
||||
|
||||
// when
|
||||
contextPad.open(element);
|
||||
// when
|
||||
contextPad.open(element);
|
||||
|
||||
// then
|
||||
expect(deleteAction(element)).to.not.exist;
|
||||
}));
|
||||
// then
|
||||
expect(deleteAction(element)).to.not.exist;
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should call rules with [ element ]', inject(function(elementRegistry, contextPad, customRules) {
|
||||
|
@ -119,37 +121,39 @@ describe('features - context-pad', function() {
|
|||
it('should include delete action when [ element ] is returned from rule',
|
||||
inject(function(elementRegistry, contextPad, customRules) {
|
||||
|
||||
// given
|
||||
customRules.addRule('elements.delete', 1500, function(context) {
|
||||
return context.elements;
|
||||
});
|
||||
// given
|
||||
customRules.addRule('elements.delete', 1500, function(context) {
|
||||
return context.elements;
|
||||
});
|
||||
|
||||
var element = elementRegistry.get('StartEvent_1');
|
||||
var element = elementRegistry.get('StartEvent_1');
|
||||
|
||||
// when
|
||||
contextPad.open(element);
|
||||
// when
|
||||
contextPad.open(element);
|
||||
|
||||
// then
|
||||
expect(deleteAction(element)).to.exist;
|
||||
}));
|
||||
// then
|
||||
expect(deleteAction(element)).to.exist;
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should NOT include delete action when [ ] is returned from rule',
|
||||
inject(function(elementRegistry, contextPad, customRules) {
|
||||
|
||||
// given
|
||||
customRules.addRule('elements.delete', 1500, function() {
|
||||
return [];
|
||||
});
|
||||
// given
|
||||
customRules.addRule('elements.delete', 1500, function() {
|
||||
return [];
|
||||
});
|
||||
|
||||
var element = elementRegistry.get('StartEvent_1');
|
||||
var element = elementRegistry.get('StartEvent_1');
|
||||
|
||||
// when
|
||||
contextPad.open(element);
|
||||
// when
|
||||
contextPad.open(element);
|
||||
|
||||
// then
|
||||
expect(deleteAction(element)).to.not.exist;
|
||||
}));
|
||||
// then
|
||||
expect(deleteAction(element)).to.not.exist;
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
@ -297,7 +301,7 @@ describe('features - context-pad', function() {
|
|||
// mock event
|
||||
var event = {
|
||||
target: padEntry(container, 'replace'),
|
||||
preventDefault: function(){}
|
||||
preventDefault: function() {}
|
||||
};
|
||||
|
||||
// when
|
||||
|
@ -313,43 +317,45 @@ describe('features - context-pad', function() {
|
|||
it('should not include control if replacement is disallowed',
|
||||
inject(function(elementRegistry, contextPad, customRules) {
|
||||
|
||||
// given
|
||||
var element = elementRegistry.get('StartEvent_1');
|
||||
// given
|
||||
var element = elementRegistry.get('StartEvent_1');
|
||||
|
||||
// disallow replacement
|
||||
customRules.addRule('shape.replace', function(context) {
|
||||
return !is(context.element, 'bpmn:StartEvent');
|
||||
});
|
||||
// disallow replacement
|
||||
customRules.addRule('shape.replace', function(context) {
|
||||
return !is(context.element, 'bpmn:StartEvent');
|
||||
});
|
||||
|
||||
// when
|
||||
contextPad.open(element);
|
||||
// when
|
||||
contextPad.open(element);
|
||||
|
||||
var padNode = contextPad.getPad(element).html;
|
||||
var padNode = contextPad.getPad(element).html;
|
||||
|
||||
// then
|
||||
expect(padEntry(padNode, 'replace')).not.to.exist;
|
||||
}));
|
||||
// then
|
||||
expect(padEntry(padNode, 'replace')).not.to.exist;
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should include control if replacement is allowed',
|
||||
inject(function(elementRegistry, contextPad, customRules) {
|
||||
|
||||
// given
|
||||
var element = elementRegistry.get('EndEvent_1');
|
||||
// given
|
||||
var element = elementRegistry.get('EndEvent_1');
|
||||
|
||||
// disallow replacement
|
||||
customRules.addRule('shape.replace', function(context) {
|
||||
return !is(context.element, 'bpmn:StartEvent');
|
||||
});
|
||||
// disallow replacement
|
||||
customRules.addRule('shape.replace', function(context) {
|
||||
return !is(context.element, 'bpmn:StartEvent');
|
||||
});
|
||||
|
||||
// when
|
||||
contextPad.open(element);
|
||||
// when
|
||||
contextPad.open(element);
|
||||
|
||||
var padNode = contextPad.getPad(element).html;
|
||||
var padNode = contextPad.getPad(element).html;
|
||||
|
||||
// then
|
||||
expect(padEntry(padNode, 'replace')).to.exist;
|
||||
}));
|
||||
// then
|
||||
expect(padEntry(padNode, 'replace')).to.exist;
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -27,90 +27,11 @@ describe('features/copy-paste', function() {
|
|||
collaborationAssociations = require('../../../fixtures/bpmn/features/copy-paste/data-associations.bpmn');
|
||||
|
||||
|
||||
function integrationTest(ids) {
|
||||
return function(canvas, elementRegistry, modeling, copyPaste, commandStack) {
|
||||
// given
|
||||
var shapes = elementRegistry.getAll(),
|
||||
rootElement;
|
||||
|
||||
var initialContext = {
|
||||
type: mapProperty(shapes, 'type'),
|
||||
ids: mapProperty(shapes, 'id'),
|
||||
length: shapes.length
|
||||
},
|
||||
currentContext;
|
||||
|
||||
var elements = map(ids, function(id) {
|
||||
return elementRegistry.get(id);
|
||||
});
|
||||
|
||||
copyPaste.copy(elements);
|
||||
|
||||
modeling.removeElements(elements);
|
||||
|
||||
rootElement = canvas.getRootElement();
|
||||
|
||||
copyPaste.paste({
|
||||
element: rootElement,
|
||||
point: {
|
||||
x: 1100,
|
||||
y: 250
|
||||
}
|
||||
});
|
||||
|
||||
elements = elementRegistry.getAll();
|
||||
|
||||
// remove root
|
||||
elements = elementRegistry.filter(function(element) {
|
||||
return !!element.parent;
|
||||
});
|
||||
|
||||
modeling.moveElements(elements, { x: 50, y: -50 });
|
||||
|
||||
// when
|
||||
commandStack.undo();
|
||||
commandStack.undo();
|
||||
commandStack.undo();
|
||||
|
||||
elements = elementRegistry.getAll();
|
||||
|
||||
currentContext = {
|
||||
type: mapProperty(elements, 'type'),
|
||||
ids: mapProperty(elements, 'id'),
|
||||
length: elements.length
|
||||
};
|
||||
|
||||
// then
|
||||
expect(initialContext).to.have.length(currentContext.length);
|
||||
|
||||
expectCollection(initialContext.ids, currentContext.ids, true);
|
||||
|
||||
// when
|
||||
commandStack.redo();
|
||||
commandStack.redo();
|
||||
commandStack.redo();
|
||||
|
||||
elements = elementRegistry.getAll();
|
||||
|
||||
currentContext = {
|
||||
type: mapProperty(elements, 'type'),
|
||||
ids: mapProperty(elements, 'id'),
|
||||
length: elements.length
|
||||
};
|
||||
|
||||
// then
|
||||
expect(initialContext).to.have.length(currentContext.length);
|
||||
|
||||
expectCollection(initialContext.type, currentContext.type, true);
|
||||
expectCollection(initialContext.ids, currentContext.ids, false);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
describe('basic diagram', function() {
|
||||
|
||||
beforeEach(bootstrapModeler(basicXML, { modules: testModules }));
|
||||
|
||||
|
||||
describe('copy', function() {
|
||||
|
||||
it('selected elements', inject(function(elementRegistry, copyPaste) {
|
||||
|
@ -119,9 +40,7 @@ describe('features/copy-paste', function() {
|
|||
var subProcess,
|
||||
startEvent,
|
||||
boundaryEvent,
|
||||
textAnnotation,
|
||||
conditionalFlow,
|
||||
defaultFlow;
|
||||
textAnnotation;
|
||||
|
||||
// when
|
||||
var tree = copy([ 'SubProcess_1kd6ist' ]);
|
||||
|
@ -130,8 +49,6 @@ describe('features/copy-paste', function() {
|
|||
boundaryEvent = tree.getElement('BoundaryEvent_1c94bi9');
|
||||
subProcess = tree.getElement('SubProcess_1kd6ist');
|
||||
textAnnotation = tree.getElement('TextAnnotation_0h1hhgg');
|
||||
conditionalFlow = tree.getElement('SequenceFlow_07vo2r8');
|
||||
defaultFlow = tree.getElement('Task_1fo63a7');
|
||||
|
||||
// then
|
||||
expect(tree.getLength()).to.equal(3);
|
||||
|
@ -153,109 +70,115 @@ describe('features/copy-paste', function() {
|
|||
|
||||
it('should retain label\'s relative position',
|
||||
inject(function(modeling, copyPaste, canvas, elementRegistry) {
|
||||
// given
|
||||
var startEvent = elementRegistry.get('StartEvent_1'),
|
||||
startEventLabel = startEvent.label,
|
||||
seqFlow = elementRegistry.get('SequenceFlow_1rtr33r'),
|
||||
seqFlowLabel = seqFlow.label,
|
||||
task = elementRegistry.get('Task_1fo63a7'),
|
||||
rootElement = canvas.getRootElement(),
|
||||
newStrtEvt, newSeqFlow;
|
||||
|
||||
// when
|
||||
copyPaste.copy([ startEvent, task ]);
|
||||
// given
|
||||
var startEvent = elementRegistry.get('StartEvent_1'),
|
||||
startEventLabel = startEvent.label,
|
||||
seqFlow = elementRegistry.get('SequenceFlow_1rtr33r'),
|
||||
seqFlowLabel = seqFlow.label,
|
||||
task = elementRegistry.get('Task_1fo63a7'),
|
||||
rootElement = canvas.getRootElement(),
|
||||
newStrtEvt, newSeqFlow;
|
||||
|
||||
copyPaste.paste({
|
||||
element: rootElement,
|
||||
point: {
|
||||
x: 1100,
|
||||
y: 250
|
||||
}
|
||||
});
|
||||
// when
|
||||
copyPaste.copy([ startEvent, task ]);
|
||||
|
||||
newStrtEvt = elementRegistry.filter(function(element) {
|
||||
return element.parent === rootElement && element.type === 'bpmn:StartEvent';
|
||||
})[0];
|
||||
copyPaste.paste({
|
||||
element: rootElement,
|
||||
point: {
|
||||
x: 1100,
|
||||
y: 250
|
||||
}
|
||||
});
|
||||
|
||||
newSeqFlow = elementRegistry.filter(function(element) {
|
||||
return element.parent === rootElement && element.type === 'bpmn:SequenceFlow';
|
||||
})[0];
|
||||
newStrtEvt = elementRegistry.filter(function(element) {
|
||||
return element.parent === rootElement && element.type === 'bpmn:StartEvent';
|
||||
})[0];
|
||||
|
||||
// then
|
||||
expect(newStrtEvt.label.x - newStrtEvt.x).to.equal(startEventLabel.x - startEvent.x);
|
||||
expect(newStrtEvt.label.y - newStrtEvt.y).to.equal(startEventLabel.y - startEvent.y);
|
||||
newSeqFlow = elementRegistry.filter(function(element) {
|
||||
return element.parent === rootElement && element.type === 'bpmn:SequenceFlow';
|
||||
})[0];
|
||||
|
||||
expect(newSeqFlow.label.x - newSeqFlow.waypoints[0].x).to.equal(seqFlowLabel.x - seqFlow.waypoints[0].x);
|
||||
expect(newSeqFlow.label.y - newSeqFlow.waypoints[0].y).to.equal(seqFlowLabel.y - seqFlow.waypoints[0].y);
|
||||
}));
|
||||
// then
|
||||
expect(newStrtEvt.label.x - newStrtEvt.x).to.equal(startEventLabel.x - startEvent.x);
|
||||
expect(newStrtEvt.label.y - newStrtEvt.y).to.equal(startEventLabel.y - startEvent.y);
|
||||
|
||||
expect(newSeqFlow.label.x - newSeqFlow.waypoints[0].x).to.equal(seqFlowLabel.x - seqFlow.waypoints[0].x);
|
||||
expect(newSeqFlow.label.y - newSeqFlow.waypoints[0].y).to.equal(seqFlowLabel.y - seqFlow.waypoints[0].y);
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should retain default & conditional flow property',
|
||||
inject(function(elementRegistry, copyPaste, canvas, modeling) {
|
||||
// given
|
||||
var subProcess = elementRegistry.get('SubProcess_1kd6ist'),
|
||||
rootElement = canvas.getRootElement(),
|
||||
task, defaultFlow, conditionalFlow;
|
||||
|
||||
// when
|
||||
copyPaste.copy(subProcess);
|
||||
// given
|
||||
var subProcess = elementRegistry.get('SubProcess_1kd6ist'),
|
||||
rootElement = canvas.getRootElement(),
|
||||
task, defaultFlow, conditionalFlow;
|
||||
|
||||
modeling.removeElements([ subProcess ]);
|
||||
// when
|
||||
copyPaste.copy(subProcess);
|
||||
|
||||
copyPaste.paste({
|
||||
element: rootElement,
|
||||
point: {
|
||||
x: 1100,
|
||||
y: 250
|
||||
}
|
||||
});
|
||||
modeling.removeElements([ subProcess ]);
|
||||
|
||||
task = elementRegistry.filter(function(element) {
|
||||
return element.type === 'bpmn:Task';
|
||||
})[0];
|
||||
copyPaste.paste({
|
||||
element: rootElement,
|
||||
point: {
|
||||
x: 1100,
|
||||
y: 250
|
||||
}
|
||||
});
|
||||
|
||||
defaultFlow = elementRegistry.filter(function(element) {
|
||||
return !!(element.type === 'bpmn:SequenceFlow' && task.businessObject.default.id === element.id);
|
||||
})[0];
|
||||
task = elementRegistry.filter(function(element) {
|
||||
return element.type === 'bpmn:Task';
|
||||
})[0];
|
||||
|
||||
conditionalFlow = elementRegistry.filter(function(element) {
|
||||
return !!(element.type === 'bpmn:SequenceFlow' && element.businessObject.conditionExpression);
|
||||
})[0];
|
||||
defaultFlow = elementRegistry.filter(function(element) {
|
||||
return !!(element.type === 'bpmn:SequenceFlow' && task.businessObject.default.id === element.id);
|
||||
})[0];
|
||||
|
||||
expect(defaultFlow).to.exist;
|
||||
expect(conditionalFlow).to.exist;
|
||||
}));
|
||||
conditionalFlow = elementRegistry.filter(function(element) {
|
||||
return !!(element.type === 'bpmn:SequenceFlow' && element.businessObject.conditionExpression);
|
||||
})[0];
|
||||
|
||||
expect(defaultFlow).to.exist;
|
||||
expect(conditionalFlow).to.exist;
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should retain loop characteristics',
|
||||
inject(function(elementRegistry, copyPaste, canvas, modeling) {
|
||||
// given
|
||||
var subProcess = elementRegistry.get('SubProcess_0gev7mx'),
|
||||
rootElement = canvas.getRootElement(),
|
||||
loopCharacteristics;
|
||||
|
||||
// when
|
||||
copyPaste.copy(subProcess);
|
||||
// given
|
||||
var subProcess = elementRegistry.get('SubProcess_0gev7mx'),
|
||||
rootElement = canvas.getRootElement(),
|
||||
loopCharacteristics;
|
||||
|
||||
modeling.removeElements([ subProcess ]);
|
||||
// when
|
||||
copyPaste.copy(subProcess);
|
||||
|
||||
copyPaste.paste({
|
||||
element: rootElement,
|
||||
point: {
|
||||
x: 1100,
|
||||
y: 250
|
||||
}
|
||||
});
|
||||
modeling.removeElements([ subProcess ]);
|
||||
|
||||
subProcess = elementRegistry.filter(function(element) {
|
||||
return !!(element.id !== 'SubProcess_1kd6ist' && element.type === 'bpmn:SubProcess');
|
||||
})[0];
|
||||
copyPaste.paste({
|
||||
element: rootElement,
|
||||
point: {
|
||||
x: 1100,
|
||||
y: 250
|
||||
}
|
||||
});
|
||||
|
||||
loopCharacteristics = subProcess.businessObject.loopCharacteristics;
|
||||
subProcess = elementRegistry.filter(function(element) {
|
||||
return !!(element.id !== 'SubProcess_1kd6ist' && element.type === 'bpmn:SubProcess');
|
||||
})[0];
|
||||
|
||||
expect(loopCharacteristics.$type).to.equal('bpmn:MultiInstanceLoopCharacteristics');
|
||||
expect(loopCharacteristics.isSequential).to.be.true;
|
||||
}));
|
||||
loopCharacteristics = subProcess.businessObject.loopCharacteristics;
|
||||
|
||||
expect(loopCharacteristics.$type).to.equal('bpmn:MultiInstanceLoopCharacteristics');
|
||||
expect(loopCharacteristics.isSequential).to.be.true;
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('selected elements', inject(integrationTest([ 'SubProcess_1kd6ist' ])));
|
||||
|
@ -284,6 +207,7 @@ describe('features/copy-paste', function() {
|
|||
|
||||
beforeEach(bootstrapModeler(collaborationXML, { modules: testModules }));
|
||||
|
||||
|
||||
describe('integration', function() {
|
||||
|
||||
it('participant with including lanes + elements', inject(integrationTest([ 'Participant_0uu1rvj' ])));
|
||||
|
@ -293,7 +217,7 @@ describe('features/copy-paste', function() {
|
|||
});
|
||||
|
||||
|
||||
describe('rules', function () {
|
||||
describe('rules', function() {
|
||||
|
||||
it('disallow individual lanes copying', inject(function(copyPaste, elementRegistry, canvas) {
|
||||
|
||||
|
@ -308,62 +232,64 @@ describe('features/copy-paste', function() {
|
|||
it('pasting on a collaboration is disallowed when NOT every element is a Participant',
|
||||
inject(function(copyPaste, elementRegistry, canvas, tooltips, eventBus) {
|
||||
|
||||
var collaboration = canvas.getRootElement();
|
||||
var collaboration = canvas.getRootElement();
|
||||
|
||||
var pasteRejected = sinon.spy(function() {});
|
||||
var pasteRejected = sinon.spy(function() {});
|
||||
|
||||
// when
|
||||
var tree = copy([ 'Task_13xbgyg', 'Participant_145muai' ]);
|
||||
// when
|
||||
var tree = copy([ 'Task_13xbgyg', 'Participant_145muai' ]);
|
||||
|
||||
// then
|
||||
expect(tree.getDepthLength(0)).to.equal(2);
|
||||
// then
|
||||
expect(tree.getDepthLength(0)).to.equal(2);
|
||||
|
||||
// when
|
||||
eventBus.on('elements.paste.rejected', pasteRejected);
|
||||
// when
|
||||
eventBus.on('elements.paste.rejected', pasteRejected);
|
||||
|
||||
copyPaste.paste({
|
||||
element: collaboration,
|
||||
point: {
|
||||
x: 1000,
|
||||
y: 1000
|
||||
}
|
||||
});
|
||||
copyPaste.paste({
|
||||
element: collaboration,
|
||||
point: {
|
||||
x: 1000,
|
||||
y: 1000
|
||||
}
|
||||
});
|
||||
|
||||
expect(pasteRejected).to.have.been.called;
|
||||
}));
|
||||
expect(pasteRejected).to.have.been.called;
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('pasting participants on a process is disallowed when it\'s not a collaboration',
|
||||
inject(function(copyPaste, elementRegistry, canvas, tooltips, eventBus, modeling, elementFactory) {
|
||||
|
||||
var participant = elementRegistry.get('Participant_145muai'),
|
||||
otherParticipant = elementRegistry.get('Participant_0uu1rvj'),
|
||||
startEvent = elementFactory.create('shape', { type: 'bpmn:StartEvent' }),
|
||||
rootElement;
|
||||
var participant = elementRegistry.get('Participant_145muai'),
|
||||
otherParticipant = elementRegistry.get('Participant_0uu1rvj'),
|
||||
startEvent = elementFactory.create('shape', { type: 'bpmn:StartEvent' }),
|
||||
rootElement;
|
||||
|
||||
var pasteRejected = sinon.spy(function() {});
|
||||
var pasteRejected = sinon.spy(function() {});
|
||||
|
||||
// when
|
||||
copyPaste.copy([ participant ]);
|
||||
// when
|
||||
copyPaste.copy([ participant ]);
|
||||
|
||||
modeling.removeElements([ participant, otherParticipant ]);
|
||||
modeling.removeElements([ participant, otherParticipant ]);
|
||||
|
||||
rootElement = canvas.getRootElement();
|
||||
rootElement = canvas.getRootElement();
|
||||
|
||||
modeling.createShape(startEvent, { x: 50, y: 50 }, rootElement);
|
||||
modeling.createShape(startEvent, { x: 50, y: 50 }, rootElement);
|
||||
|
||||
eventBus.on('elements.paste.rejected', pasteRejected);
|
||||
eventBus.on('elements.paste.rejected', pasteRejected);
|
||||
|
||||
copyPaste.paste({
|
||||
element: rootElement,
|
||||
point: {
|
||||
x: 500,
|
||||
y: 200
|
||||
}
|
||||
});
|
||||
copyPaste.paste({
|
||||
element: rootElement,
|
||||
point: {
|
||||
x: 500,
|
||||
y: 200
|
||||
}
|
||||
});
|
||||
|
||||
expect(pasteRejected).to.have.been.called;
|
||||
}));
|
||||
expect(pasteRejected).to.have.been.called;
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
@ -377,6 +303,7 @@ describe('features/copy-paste', function() {
|
|||
describe('basics', function() {
|
||||
|
||||
it('pasting on a lane', inject(function(elementRegistry, copyPaste) {
|
||||
|
||||
// given
|
||||
var lane = elementRegistry.get('Lane_0aws6ii'),
|
||||
task = elementRegistry.get('Task_1pamrp2'),
|
||||
|
@ -445,8 +372,9 @@ describe('features/copy-paste', function() {
|
|||
|
||||
|
||||
it('copying participant should copy process as well', inject(function(elementRegistry, copyPaste, canvas) {
|
||||
|
||||
// given
|
||||
var participants = map([ 'Participant_Input', 'Participant_Output' ], function (e) {
|
||||
var participants = map([ 'Participant_Input', 'Participant_Output' ], function(e) {
|
||||
return elementRegistry.get(e);
|
||||
});
|
||||
var rootElement = canvas.getRootElement();
|
||||
|
@ -467,7 +395,7 @@ describe('features/copy-paste', function() {
|
|||
return element.type === 'bpmn:Participant';
|
||||
});
|
||||
|
||||
var processIds = map(elements, function (e) {
|
||||
var processIds = map(elements, function(e) {
|
||||
return e.businessObject.processRef.id;
|
||||
});
|
||||
|
||||
|
@ -485,6 +413,91 @@ describe('features/copy-paste', function() {
|
|||
});
|
||||
|
||||
|
||||
|
||||
////// test helpers //////////////////////////////////////////////////
|
||||
|
||||
|
||||
function integrationTest(ids) {
|
||||
|
||||
return function(canvas, elementRegistry, modeling, copyPaste, commandStack) {
|
||||
// given
|
||||
var shapes = elementRegistry.getAll(),
|
||||
rootElement;
|
||||
|
||||
var initialContext = {
|
||||
type: mapProperty(shapes, 'type'),
|
||||
ids: mapProperty(shapes, 'id'),
|
||||
length: shapes.length
|
||||
},
|
||||
currentContext;
|
||||
|
||||
var elements = map(ids, function(id) {
|
||||
return elementRegistry.get(id);
|
||||
});
|
||||
|
||||
copyPaste.copy(elements);
|
||||
|
||||
modeling.removeElements(elements);
|
||||
|
||||
rootElement = canvas.getRootElement();
|
||||
|
||||
copyPaste.paste({
|
||||
element: rootElement,
|
||||
point: {
|
||||
x: 1100,
|
||||
y: 250
|
||||
}
|
||||
});
|
||||
|
||||
elements = elementRegistry.getAll();
|
||||
|
||||
// remove root
|
||||
elements = elementRegistry.filter(function(element) {
|
||||
return !!element.parent;
|
||||
});
|
||||
|
||||
modeling.moveElements(elements, { x: 50, y: -50 });
|
||||
|
||||
// when
|
||||
commandStack.undo();
|
||||
commandStack.undo();
|
||||
commandStack.undo();
|
||||
|
||||
elements = elementRegistry.getAll();
|
||||
|
||||
currentContext = {
|
||||
type: mapProperty(elements, 'type'),
|
||||
ids: mapProperty(elements, 'id'),
|
||||
length: elements.length
|
||||
};
|
||||
|
||||
// then
|
||||
expect(initialContext).to.have.length(currentContext.length);
|
||||
|
||||
expectCollection(initialContext.ids, currentContext.ids, true);
|
||||
|
||||
// when
|
||||
commandStack.redo();
|
||||
commandStack.redo();
|
||||
commandStack.redo();
|
||||
|
||||
elements = elementRegistry.getAll();
|
||||
|
||||
currentContext = {
|
||||
type: mapProperty(elements, 'type'),
|
||||
ids: mapProperty(elements, 'id'),
|
||||
length: elements.length
|
||||
};
|
||||
|
||||
// then
|
||||
expect(initialContext).to.have.length(currentContext.length);
|
||||
|
||||
expectCollection(initialContext.type, currentContext.type, true);
|
||||
expectCollection(initialContext.ids, currentContext.ids, false);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Copy elements (or elements with given ids).
|
||||
*
|
||||
|
|
|
@ -351,7 +351,7 @@ describe('features - label-editing', function() {
|
|||
describe('textbox should have minimum size', function() {
|
||||
|
||||
function testTextboxSizing(elementId, zoom, width, height) {
|
||||
return inject(function(canvas, elementRegistry, directEditing){
|
||||
return inject(function(canvas, elementRegistry, directEditing) {
|
||||
// zoom in
|
||||
canvas.zoom(zoom);
|
||||
// grab one element
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
require('../../../TestHelper');
|
||||
|
||||
|
||||
var TestContainer = require('mocha-test-container-support');
|
||||
|
||||
|
|
|
@ -281,7 +281,7 @@ describe('features/modeling - append shape', function() {
|
|||
|
||||
// when
|
||||
var targetShape = modeling.appendShape(startEventShape, { type: 'bpmn:ExclusiveGateway' }),
|
||||
target = targetShape.businessObject;
|
||||
target = targetShape.businessObject;
|
||||
|
||||
// then
|
||||
expect(targetShape).to.exist;
|
||||
|
@ -315,7 +315,7 @@ describe('features/modeling - append shape', function() {
|
|||
var subProcess = subProcessShape.businessObject;
|
||||
|
||||
var targetShape = modeling.appendShape(startEventShape, { type: 'bpmn:ExclusiveGateway' }),
|
||||
target = targetShape.businessObject;
|
||||
target = targetShape.businessObject;
|
||||
|
||||
// when
|
||||
commandStack.undo();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
require('../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
require('../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
@ -61,8 +61,8 @@ describe('features - bpmn-factory', function() {
|
|||
|
||||
// then
|
||||
expect(result).eql([
|
||||
bpmnFactory.create('dc:Point', {x: 0, y: 0 }),
|
||||
bpmnFactory.create('dc:Point', {x: 0, y: 0 })
|
||||
bpmnFactory.create('dc:Point', { x: 0, y: 0 }),
|
||||
bpmnFactory.create('dc:Point', { x: 0, y: 0 })
|
||||
]);
|
||||
|
||||
// expect original not to have been accidently serialized
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
require('../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
@ -31,7 +31,7 @@ describe('features/modeling - create connection', function() {
|
|||
|
||||
// when
|
||||
var sequenceFlowConnection = modeling.createConnection(taskShape, gatewayShape, {
|
||||
type: 'bpmn:SequenceFlow',
|
||||
type: 'bpmn:SequenceFlow'
|
||||
}, taskShape.parent);
|
||||
|
||||
var sequenceFlow = sequenceFlowConnection.businessObject;
|
||||
|
@ -51,10 +51,10 @@ describe('features/modeling - create connection', function() {
|
|||
|
||||
// expect cropped connection
|
||||
expect(sequenceFlowConnection.waypoints).eql([
|
||||
{ original: { x: 242, y: 376 }, x: 292, y: 376},
|
||||
{ original: { x: 242, y: 376 }, x: 292, y: 376 },
|
||||
{ x: 410, y: 376 },
|
||||
{ x: 410, y: 341 },
|
||||
{ original: { x: 553, y: 341 }, x: 528, y: 341}
|
||||
{ original: { x: 553, y: 341 }, x: 528, y: 341 }
|
||||
]);
|
||||
|
||||
var diWaypoints = bpmnFactory.createDiWaypoints([
|
||||
|
@ -83,7 +83,7 @@ describe('features/modeling - create connection', function() {
|
|||
|
||||
|
||||
var sequenceFlowConnection = modeling.createConnection(taskShape, gatewayShape, {
|
||||
type: 'bpmn:SequenceFlow',
|
||||
type: 'bpmn:SequenceFlow'
|
||||
}, taskShape.parent);
|
||||
|
||||
var sequenceFlow = sequenceFlowConnection.businessObject;
|
||||
|
@ -115,7 +115,7 @@ describe('features/modeling - create connection', function() {
|
|||
|
||||
|
||||
var sequenceFlowConnection = modeling.createConnection(taskShape, gatewayShape, {
|
||||
type: 'bpmn:SequenceFlow',
|
||||
type: 'bpmn:SequenceFlow'
|
||||
}, taskShape.parent);
|
||||
|
||||
var sequenceFlow = sequenceFlowConnection.businessObject;
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
require('../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
|
||||
var modelingModule = require('../../../../lib/features/modeling'),
|
||||
coreModule = require('../../../../lib/core');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
require('../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
require('../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
|
||||
var modelingModule = require('../../../../lib/features/modeling'),
|
||||
coreModule = require('../../../../lib/core');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
require('../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
@ -64,17 +64,17 @@ describe('features/move - drop', function() {
|
|||
inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var task_1 = elementRegistry.get('ID_Task_1'),
|
||||
parent = elementRegistry.get('ID_SubProcess_1'),
|
||||
flow = elementRegistry.get('ID_Sequenceflow_1');
|
||||
var task_1 = elementRegistry.get('ID_Task_1'),
|
||||
parent = elementRegistry.get('ID_SubProcess_1'),
|
||||
flow = elementRegistry.get('ID_Sequenceflow_1');
|
||||
|
||||
// when
|
||||
modeling.moveElements([ task_1 ], { x: 0, y: 200 }, parent);
|
||||
modeling.moveElements([ task_1 ], { x: 0, y: 200 }, parent);
|
||||
|
||||
// then
|
||||
expect(flow.parent).to.be.null;
|
||||
expect(flow.businessObject.$parent).to.be.null;
|
||||
}));
|
||||
expect(flow.parent).to.be.null;
|
||||
expect(flow.businessObject.$parent).to.be.null;
|
||||
}));
|
||||
|
||||
|
||||
it('should update flow parent if target and source have same parents', inject(function(elementRegistry, modeling) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
require('../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
@ -30,10 +30,10 @@ describe('features/modeling - move connection', function() {
|
|||
modeling.moveConnection(sequenceFlowConnection, { x: 20, y: 10 });
|
||||
|
||||
var waypoints = [
|
||||
{x: 598, y: 351 },
|
||||
{x: 954, y: 351 },
|
||||
{x: 954, y: 446 },
|
||||
{x: 852, y: 446 }
|
||||
{ x: 598, y: 351 },
|
||||
{ x: 954, y: 351 },
|
||||
{ x: 954, y: 446 },
|
||||
{ x: 852, y: 446 }
|
||||
];
|
||||
|
||||
// then
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
require('../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
@ -57,34 +57,37 @@ describe('features/modeling - move', function() {
|
|||
|
||||
it('should only move label when moving BoundaryEvent and Label',
|
||||
inject(function(elementRegistry, move, dragging, selection) {
|
||||
// given
|
||||
var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
subProcess = elementRegistry.get('SubProcess_1'),
|
||||
label = boundaryEvent.label;
|
||||
|
||||
// when
|
||||
selection.select([ boundaryEvent, label ]);
|
||||
// given
|
||||
var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
subProcess = elementRegistry.get('SubProcess_1'),
|
||||
label = boundaryEvent.label;
|
||||
|
||||
move.start(canvasEvent({ x: 190, y: 355 }), boundaryEvent);
|
||||
// when
|
||||
selection.select([ boundaryEvent, label ]);
|
||||
|
||||
dragging.hover({
|
||||
element: subProcess,
|
||||
gfx: elementRegistry.getGraphics(subProcess)
|
||||
});
|
||||
move.start(canvasEvent({ x: 190, y: 355 }), boundaryEvent);
|
||||
|
||||
dragging.move(canvasEvent({ x: 220, y: 240 }));
|
||||
dragging.end();
|
||||
dragging.hover({
|
||||
element: subProcess,
|
||||
gfx: elementRegistry.getGraphics(subProcess)
|
||||
});
|
||||
|
||||
// then
|
||||
expect(subProcess.attachers).not.to.include(label);
|
||||
expect(subProcess.attachers).to.include(boundaryEvent);
|
||||
dragging.move(canvasEvent({ x: 220, y: 240 }));
|
||||
dragging.end();
|
||||
|
||||
expect(boundaryEvent.host).to.eql(subProcess);
|
||||
expect(label.host).to.not.exist;
|
||||
}));
|
||||
// then
|
||||
expect(subProcess.attachers).not.to.include(label);
|
||||
expect(subProcess.attachers).to.include(boundaryEvent);
|
||||
|
||||
expect(boundaryEvent.host).to.eql(subProcess);
|
||||
expect(label.host).to.not.exist;
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should move BoundaryEvent and Label with parent', inject(function(canvas, elementRegistry, move, dragging) {
|
||||
|
||||
// given
|
||||
var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
subProcess = elementRegistry.get('SubProcess_1'),
|
||||
|
@ -115,33 +118,35 @@ describe('features/modeling - move', function() {
|
|||
|
||||
it('should move BoundaryEvent, Label and parent',
|
||||
inject(function(canvas, elementRegistry, move, dragging, selection) {
|
||||
// given
|
||||
var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
subProcess = elementRegistry.get('SubProcess_1'),
|
||||
label = boundaryEvent.label,
|
||||
root = canvas.getRootElement();
|
||||
|
||||
// when
|
||||
selection.select([ boundaryEvent, label, subProcess ]);
|
||||
// given
|
||||
var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
subProcess = elementRegistry.get('SubProcess_1'),
|
||||
label = boundaryEvent.label,
|
||||
root = canvas.getRootElement();
|
||||
|
||||
move.start(canvasEvent({ x: 190, y: 355 }), subProcess);
|
||||
// when
|
||||
selection.select([ boundaryEvent, label, subProcess ]);
|
||||
|
||||
dragging.hover({
|
||||
element: root,
|
||||
gfx: elementRegistry.getGraphics(root)
|
||||
});
|
||||
dragging.move(canvasEvent({ x: 290, y: 455 }));
|
||||
dragging.end();
|
||||
move.start(canvasEvent({ x: 190, y: 355 }), subProcess);
|
||||
|
||||
// then
|
||||
expect(subProcess.x).to.eql(304);
|
||||
expect(subProcess.y).to.eql(178);
|
||||
dragging.hover({
|
||||
element: root,
|
||||
gfx: elementRegistry.getGraphics(root)
|
||||
});
|
||||
dragging.move(canvasEvent({ x: 290, y: 455 }));
|
||||
dragging.end();
|
||||
|
||||
expect(subProcess.attachers).not.to.include(label);
|
||||
expect(subProcess.attachers).to.include(boundaryEvent);
|
||||
// then
|
||||
expect(subProcess.x).to.eql(304);
|
||||
expect(subProcess.y).to.eql(178);
|
||||
|
||||
expect(boundaryEvent.host).to.eql(subProcess);
|
||||
expect(label.host).to.not.exist;
|
||||
}));
|
||||
expect(subProcess.attachers).not.to.include(label);
|
||||
expect(subProcess.attachers).to.include(boundaryEvent);
|
||||
|
||||
});
|
||||
expect(boundaryEvent.host).to.eql(subProcess);
|
||||
expect(label.host).to.not.exist;
|
||||
})
|
||||
);
|
||||
|
||||
});
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
require('../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
require('../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
require('../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
require('../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@ describe('features/modeling - update label', function() {
|
|||
|
||||
var diagramXML = require('../../../fixtures/bpmn/features/modeling/update-label.bpmn');
|
||||
|
||||
var testModules = [ coreModule, modelingModule ];
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||
beforeEach(bootstrapModeler(diagramXML, {
|
||||
modules: [ coreModule, modelingModule ]
|
||||
}));
|
||||
|
||||
|
||||
it('should change name of start event', inject(function(modeling, elementRegistry, eventBus) {
|
||||
|
@ -89,41 +89,43 @@ describe('features/modeling - update label', function() {
|
|||
it('should propertly fire events.changed after event name change',
|
||||
inject(function(modeling, elementRegistry, eventBus) {
|
||||
|
||||
// given
|
||||
var startEvent_1 = elementRegistry.get('StartEvent_1');
|
||||
// given
|
||||
var startEvent_1 = elementRegistry.get('StartEvent_1');
|
||||
|
||||
var changedEvent;
|
||||
var changedEvent;
|
||||
|
||||
eventBus.on('elements.changed', function(event) {
|
||||
changedEvent = event;
|
||||
});
|
||||
eventBus.on('elements.changed', function(event) {
|
||||
changedEvent = event;
|
||||
});
|
||||
|
||||
// when
|
||||
modeling.updateLabel(startEvent_1, 'foo');
|
||||
// when
|
||||
modeling.updateLabel(startEvent_1, 'foo');
|
||||
|
||||
// then
|
||||
expect(changedEvent.elements).to.include(startEvent_1);
|
||||
}));
|
||||
// then
|
||||
expect(changedEvent.elements).to.include(startEvent_1);
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should propertly fire events.changed after event label change',
|
||||
inject(function(modeling, elementRegistry, eventBus) {
|
||||
|
||||
// given
|
||||
var startEvent_1 = elementRegistry.get('StartEvent_1');
|
||||
var startEvent_1_label = elementRegistry.get('StartEvent_1_label');
|
||||
// given
|
||||
var startEvent_1 = elementRegistry.get('StartEvent_1');
|
||||
var startEvent_1_label = elementRegistry.get('StartEvent_1_label');
|
||||
|
||||
var changedEvent;
|
||||
var changedEvent;
|
||||
|
||||
eventBus.on('elements.changed', function(event) {
|
||||
changedEvent = event;
|
||||
});
|
||||
eventBus.on('elements.changed', function(event) {
|
||||
changedEvent = event;
|
||||
});
|
||||
|
||||
// when
|
||||
modeling.updateLabel(startEvent_1_label, 'foo');
|
||||
// when
|
||||
modeling.updateLabel(startEvent_1_label, 'foo');
|
||||
|
||||
// then
|
||||
expect(changedEvent.elements).to.include(startEvent_1);
|
||||
}));
|
||||
// then
|
||||
expect(changedEvent.elements).to.include(startEvent_1);
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
});
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
require('../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../../TestHelper');
|
||||
require('../../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
|
|
@ -4,12 +4,10 @@ require('../../../../TestHelper');
|
|||
|
||||
/* global inject, bootstrapModeler */
|
||||
|
||||
var find = require('lodash/collection/find');
|
||||
|
||||
var modelingModule = require('../../../../../lib/features/modeling');
|
||||
|
||||
|
||||
describe('modeling/behavior - CompensationAssociation', function(){
|
||||
describe('modeling/behavior - CompensationAssociation', function() {
|
||||
|
||||
var diagramXML = require('./CompensationAssociationBehavior.bpmn');
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../../TestHelper');
|
||||
require('../../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ require('../../../../TestHelper');
|
|||
var modelingModule = require('../../../../../lib/features/modeling');
|
||||
|
||||
|
||||
describe('modeling/behavior - drop on connection', function(){
|
||||
describe('modeling/behavior - drop on connection', function() {
|
||||
|
||||
var diagramXML = require('./CreateOnFlowBehavior.bpmn');
|
||||
|
||||
|
|
|
@ -156,16 +156,16 @@ describe('features/modeling - create participant', function() {
|
|||
it('should detach DI on update canvas root', inject(function(canvas, elementFactory, commandStack, modeling, elementRegistry) {
|
||||
|
||||
// when
|
||||
modeling.makeCollaboration();
|
||||
modeling.makeCollaboration();
|
||||
|
||||
var startEventElement = elementRegistry.get('StartEvent_1'),
|
||||
startEventDi = startEventElement.businessObject.di,
|
||||
rootElement = canvas.getRootElement(),
|
||||
rootShapeDi = rootElement.businessObject.di;
|
||||
var startEventElement = elementRegistry.get('StartEvent_1'),
|
||||
startEventDi = startEventElement.businessObject.di,
|
||||
rootElement = canvas.getRootElement(),
|
||||
rootShapeDi = rootElement.businessObject.di;
|
||||
|
||||
// then
|
||||
expect(startEventDi.$parent).to.not.be.ok;
|
||||
expect(rootShapeDi.planeElement).not.to.include(startEventDi);
|
||||
expect(startEventDi.$parent).to.not.be.ok;
|
||||
expect(rootShapeDi.planeElement).not.to.include(startEventDi);
|
||||
}));
|
||||
|
||||
});
|
||||
|
|
|
@ -9,7 +9,7 @@ var find = require('lodash/collection/find');
|
|||
var modelingModule = require('../../../../../lib/features/modeling');
|
||||
|
||||
|
||||
describe('modeling/behavior - fix DataInputAssociation#targetRef', function(){
|
||||
describe('modeling/behavior - fix DataInputAssociation#targetRef', function() {
|
||||
|
||||
var diagramXML = require('./DataInputAssociationBehavior.bpmn');
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../../TestHelper');
|
||||
require('../../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
var is = require('../../../../../lib/util/ModelUtil').is;
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../../TestHelper');
|
||||
require('../../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
var is = require('../../../../../lib/util/ModelUtil').is;
|
||||
|
||||
var modelingModule = require('../../../../../lib/features/modeling'),
|
||||
coreModule = require('../../../../../lib/core');
|
||||
|
||||
|
@ -83,9 +81,7 @@ describe('features/modeling/behavior - data store', function() {
|
|||
it('should move DataStoreReference', inject(function(elementRegistry, modeling, bpmnjs) {
|
||||
|
||||
// give
|
||||
var subProcessElement = elementRegistry.get('SubProcess'),
|
||||
subProcessBo = subProcessElement.businessObject,
|
||||
participantElement = elementRegistry.get('Participant'),
|
||||
var participantElement = elementRegistry.get('Participant'),
|
||||
participantBo = participantElement.businessObject,
|
||||
dataStoreReference = elementRegistry.get('DataStoreReference'),
|
||||
dataStoreReferenceBo = dataStoreReference.businessObject;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../../TestHelper');
|
||||
require('../../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
@ -145,7 +145,7 @@ describe('behavior - LabelBehavior', function() {
|
|||
taskShape = elementRegistry.get('Task_1');
|
||||
|
||||
var sequenceFlowConnection = modeling.createConnection(startEventShape, taskShape, {
|
||||
type: 'bpmn:SequenceFlow',
|
||||
type: 'bpmn:SequenceFlow'
|
||||
}, startEventShape.parent);
|
||||
|
||||
// when
|
||||
|
@ -181,7 +181,7 @@ describe('behavior - LabelBehavior', function() {
|
|||
taskShape = elementRegistry.get('Task_1');
|
||||
|
||||
var sequenceFlowConnection = modeling.createConnection(startEventShape, taskShape, {
|
||||
type: 'bpmn:SequenceFlow',
|
||||
type: 'bpmn:SequenceFlow'
|
||||
}, startEventShape.parent);
|
||||
|
||||
var labelPosition = {
|
||||
|
|
|
@ -32,11 +32,11 @@ describe('features/modeling - reconnect connection', function() {
|
|||
|
||||
describe('reconnect DataOutputAssociations', function() {
|
||||
|
||||
beforeEach(function(){
|
||||
beforeEach(function() {
|
||||
newWaypoints = [{ x: task2Shape.x, y: task2Shape.y+30 }, dataOutputAssociation.waypoints[1]];
|
||||
});
|
||||
|
||||
it('should execute', inject(function(modeling){
|
||||
it('should execute', inject(function(modeling) {
|
||||
|
||||
// when
|
||||
modeling.reconnectStart(dataOutputAssociation, task2Shape, newWaypoints);
|
||||
|
@ -77,11 +77,11 @@ describe('features/modeling - reconnect connection', function() {
|
|||
|
||||
describe('reconnect DataInputAssociations', function() {
|
||||
|
||||
beforeEach(function(){
|
||||
beforeEach(function() {
|
||||
newWaypoints = [dataInputAssociation.waypoints[0], { x: task1Shape.x, y: task1Shape.y-30 }];
|
||||
});
|
||||
|
||||
it('should execute', inject(function(modeling){
|
||||
it('should execute', inject(function(modeling) {
|
||||
|
||||
// when
|
||||
modeling.reconnectEnd(dataInputAssociation, task1Shape, newWaypoints);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../../TestHelper');
|
||||
require('../../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../../TestHelper');
|
||||
require('../../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
@ -38,7 +38,9 @@ describe('features/modeling - replace connection', function() {
|
|||
|
||||
var processDiagramXML = require('./ReplaceConnectionBehavior.message-sequence-flow.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(processDiagramXML, { modules: testModules }));
|
||||
beforeEach(bootstrapModeler(processDiagramXML, {
|
||||
modules: testModules
|
||||
}));
|
||||
|
||||
var element;
|
||||
|
||||
|
@ -48,9 +50,10 @@ describe('features/modeling - replace connection', function() {
|
|||
};
|
||||
}));
|
||||
|
||||
describe('after reconnecting', function(){
|
||||
|
||||
it('sequence flow to another task', inject(function(elementRegistry, modeling){
|
||||
describe('after reconnecting', function() {
|
||||
|
||||
it('sequence flow to another task', inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var task4Shape = element('Task_4');
|
||||
|
@ -66,7 +69,7 @@ describe('features/modeling - replace connection', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('message flow to another task', inject(function(elementRegistry, modeling){
|
||||
it('message flow to another task', inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var task4Shape = element('Task_4');
|
||||
|
@ -82,7 +85,7 @@ describe('features/modeling - replace connection', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('sequence flow to a participant', inject(function(elementRegistry, modeling){
|
||||
it('sequence flow to a participant', inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var participant2 = element('Participant_2');
|
||||
|
@ -98,7 +101,7 @@ describe('features/modeling - replace connection', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('sequence flow from a participant', inject(function(elementRegistry, modeling){
|
||||
it('sequence flow from a participant', inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var participant2 = element('Participant_2'),
|
||||
|
@ -119,6 +122,7 @@ describe('features/modeling - replace connection', function() {
|
|||
|
||||
});
|
||||
|
||||
|
||||
describe('moving single shape', function() {
|
||||
|
||||
it('execute', inject(function(modeling, elementRegistry) {
|
||||
|
@ -259,7 +263,10 @@ describe('features/modeling - replace connection', function() {
|
|||
|
||||
var processDiagramXML = require('./ReplaceConnectionBehavior.association.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(processDiagramXML, { modules: testModules }));
|
||||
beforeEach(bootstrapModeler(processDiagramXML, {
|
||||
modules: testModules
|
||||
}));
|
||||
|
||||
|
||||
var element;
|
||||
|
||||
|
@ -269,6 +276,7 @@ describe('features/modeling - replace connection', function() {
|
|||
};
|
||||
}));
|
||||
|
||||
|
||||
describe('moving text-annotation to participant', function() {
|
||||
|
||||
it('execute', inject(function(modeling, elementRegistry) {
|
||||
|
@ -377,13 +385,19 @@ describe('features/modeling - replace connection', function() {
|
|||
});
|
||||
|
||||
|
||||
describe('moving along host with outgoing', function () {
|
||||
describe('moving along host with outgoing', function() {
|
||||
|
||||
var processDiagramXML = require('../../../../fixtures/bpmn/features/replace/connection.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(processDiagramXML, { modules: testModules }));
|
||||
beforeEach(bootstrapModeler(processDiagramXML, {
|
||||
modules: testModules
|
||||
}));
|
||||
|
||||
|
||||
it('should move connections outgoing from an attacher',
|
||||
inject(function(canvas, elementFactory, move, dragging, elementRegistry, selection) {
|
||||
|
||||
// given
|
||||
var rootShape = canvas.getRootElement(),
|
||||
rootGfx = elementRegistry.getGraphics(rootShape),
|
||||
host = elementRegistry.get('Task_1'),
|
||||
|
@ -391,35 +405,36 @@ describe('features/modeling - replace connection', function() {
|
|||
boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
connection = elementRegistry.get('SequenceFlow_1');
|
||||
|
||||
// given
|
||||
selection.select([ host, boundaryEvent, task ]);
|
||||
selection.select([ host, boundaryEvent, task ]);
|
||||
|
||||
// when
|
||||
move.start(canvasEvent({ x: 0, y: 0 }), host);
|
||||
// when
|
||||
move.start(canvasEvent({ x: 0, y: 0 }), host);
|
||||
|
||||
dragging.hover({
|
||||
element: rootShape,
|
||||
gfx: rootGfx
|
||||
});
|
||||
dragging.hover({
|
||||
element: rootShape,
|
||||
gfx: rootGfx
|
||||
});
|
||||
|
||||
dragging.move(canvasEvent({ x: 0, y: 300 }));
|
||||
dragging.end();
|
||||
dragging.move(canvasEvent({ x: 0, y: 300 }));
|
||||
dragging.end();
|
||||
|
||||
// then
|
||||
expect(connection.waypoints[0].x).to.equal(165);
|
||||
expect(connection.waypoints[0].y).to.equal(477);
|
||||
// then
|
||||
expect(connection.waypoints[0].x).to.equal(165);
|
||||
expect(connection.waypoints[0].y).to.equal(477);
|
||||
|
||||
expect(connection.waypoints[1].x).to.equal(165);
|
||||
expect(connection.waypoints[1].y).to.equal(544);
|
||||
expect(connection.waypoints[1].x).to.equal(165);
|
||||
expect(connection.waypoints[1].y).to.equal(544);
|
||||
|
||||
expect(connection.waypoints[2].x).to.equal(234);
|
||||
expect(connection.waypoints[2].y).to.equal(544);
|
||||
expect(connection.waypoints[2].x).to.equal(234);
|
||||
expect(connection.waypoints[2].y).to.equal(544);
|
||||
|
||||
expect(connection.source).to.eql(boundaryEvent);
|
||||
expect(connection.target).to.eql(task);
|
||||
})
|
||||
);
|
||||
|
||||
expect(connection.source).to.eql(boundaryEvent);
|
||||
expect(connection.target).to.eql(task);
|
||||
}));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
});
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../../TestHelper');
|
||||
require('../../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
@ -15,14 +15,24 @@ var is = require('../../../../../lib/util/ModelUtil').is,
|
|||
|
||||
describe('features/modeling - move start event behavior', function() {
|
||||
|
||||
var testModules = [ replacePreviewModule, modelingModule, coreModule, moveModule ];
|
||||
var testModules = [
|
||||
replacePreviewModule,
|
||||
modelingModule,
|
||||
coreModule,
|
||||
moveModule
|
||||
];
|
||||
|
||||
|
||||
describe('Start Events', function() {
|
||||
|
||||
var diagramXML = require('../../../../fixtures/bpmn/event-sub-processes.bpmn');
|
||||
|
||||
var moveShape;
|
||||
beforeEach(bootstrapModeler(diagramXML, {
|
||||
modules: testModules
|
||||
}));
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||
|
||||
var moveShape;
|
||||
|
||||
beforeEach(inject(function(move, dragging, elementRegistry) {
|
||||
|
||||
|
@ -44,341 +54,369 @@ describe('features/modeling - move start event behavior', function() {
|
|||
it('should select the replacement after replacing the start event',
|
||||
inject(function(elementRegistry, canvas, dragging, move, selection) {
|
||||
|
||||
// given
|
||||
var startEvent = elementRegistry.get('StartEvent_1'),
|
||||
rootElement = canvas.getRootElement();
|
||||
// given
|
||||
var startEvent = elementRegistry.get('StartEvent_1'),
|
||||
rootElement = canvas.getRootElement();
|
||||
|
||||
// when
|
||||
moveShape(startEvent, rootElement, { x: 140, y: 250 });
|
||||
// when
|
||||
moveShape(startEvent, rootElement, { x: 140, y: 250 });
|
||||
|
||||
dragging.end();
|
||||
dragging.end();
|
||||
|
||||
var replacement = elementRegistry.filter(function(element) {
|
||||
if(is(element, 'bpmn:StartEvent') && element.parent === rootElement) {
|
||||
return true;
|
||||
}
|
||||
})[0];
|
||||
var replacement = elementRegistry.filter(function(element) {
|
||||
if (is(element, 'bpmn:StartEvent') && element.parent === rootElement) {
|
||||
return true;
|
||||
}
|
||||
})[0];
|
||||
|
||||
// then
|
||||
expect(selection.get()).to.include(replacement);
|
||||
expect(selection.get()).not.to.include(startEvent);
|
||||
}));
|
||||
// then
|
||||
expect(selection.get()).to.include(replacement);
|
||||
expect(selection.get()).not.to.include(startEvent);
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should select all moved shapes after some of them got replaced',
|
||||
inject(function(elementRegistry, canvas, dragging, move, selection) {
|
||||
|
||||
// given
|
||||
var startEvent1 = elementRegistry.get('StartEvent_1'),
|
||||
startEvent2 = elementRegistry.get('StartEvent_2'),
|
||||
startEvent3 = elementRegistry.get('StartEvent_3'),
|
||||
rootElement = canvas.getRootElement();
|
||||
// given
|
||||
var startEvent1 = elementRegistry.get('StartEvent_1'),
|
||||
startEvent2 = elementRegistry.get('StartEvent_2'),
|
||||
startEvent3 = elementRegistry.get('StartEvent_3'),
|
||||
rootElement = canvas.getRootElement();
|
||||
|
||||
// when
|
||||
selection.select([ startEvent1, startEvent2, startEvent3 ]);
|
||||
moveShape(startEvent1, rootElement, { x: 140, y: 250 });
|
||||
// when
|
||||
selection.select([ startEvent1, startEvent2, startEvent3 ]);
|
||||
moveShape(startEvent1, rootElement, { x: 140, y: 250 });
|
||||
|
||||
dragging.end();
|
||||
dragging.end();
|
||||
|
||||
var replacements = elementRegistry.filter(function(element) {
|
||||
if(is(element, 'bpmn:StartEvent') && element.type !== 'label') {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
var replacements = elementRegistry.filter(function(element) {
|
||||
if (is(element, 'bpmn:StartEvent') && element.type !== 'label') {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
// then
|
||||
expect(selection.get()).to.include(replacements[0]);
|
||||
expect(selection.get()).to.include(replacements[1]);
|
||||
expect(selection.get()).to.include(replacements[2]);
|
||||
// then
|
||||
expect(selection.get()).to.include(replacements[0]);
|
||||
expect(selection.get()).to.include(replacements[1]);
|
||||
expect(selection.get()).to.include(replacements[2]);
|
||||
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
describe('Cancel Events', function () {
|
||||
|
||||
describe('Cancel Events', function() {
|
||||
|
||||
var diagramXML = require('../../../../fixtures/bpmn/features/replace/cancel-events.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||
beforeEach(bootstrapModeler(diagramXML, {
|
||||
modules: testModules
|
||||
}));
|
||||
|
||||
describe('- normal -', function() {
|
||||
|
||||
describe('normal', function() {
|
||||
|
||||
|
||||
it('should unclaim old element ID and claim new ID',
|
||||
inject(function(elementRegistry, bpmnReplace) {
|
||||
|
||||
// given
|
||||
var transaction = elementRegistry.get('Transaction_1');
|
||||
// given
|
||||
var transaction = elementRegistry.get('Transaction_1');
|
||||
|
||||
var ids = transaction.businessObject.$model.ids;
|
||||
var ids = transaction.businessObject.$model.ids;
|
||||
|
||||
// when
|
||||
var subProcess = bpmnReplace.replaceElement(transaction, { type: 'bpmn:SubProcess' });
|
||||
// when
|
||||
var subProcess = bpmnReplace.replaceElement(transaction, { type: 'bpmn:SubProcess' });
|
||||
|
||||
// then
|
||||
expect(ids.assigned(transaction.id)).to.be.false;
|
||||
expect(ids.assigned(subProcess.id)).to.eql(subProcess.businessObject);
|
||||
}));
|
||||
// then
|
||||
expect(ids.assigned(transaction.id)).to.be.false;
|
||||
expect(ids.assigned(subProcess.id)).to.eql(subProcess.businessObject);
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should REVERT unclaim old element ID and claim new ID on UNDO',
|
||||
inject(function(elementRegistry, bpmnReplace, commandStack) {
|
||||
|
||||
// given
|
||||
var transaction = elementRegistry.get('Transaction_1');
|
||||
// given
|
||||
var transaction = elementRegistry.get('Transaction_1');
|
||||
|
||||
var ids = transaction.businessObject.$model.ids;
|
||||
var ids = transaction.businessObject.$model.ids;
|
||||
|
||||
var subProcess = bpmnReplace.replaceElement(transaction, { type: 'bpmn:SubProcess' });
|
||||
var subProcess = bpmnReplace.replaceElement(transaction, { type: 'bpmn:SubProcess' });
|
||||
|
||||
// when
|
||||
commandStack.undo();
|
||||
// when
|
||||
commandStack.undo();
|
||||
|
||||
// then
|
||||
expect(ids.assigned(transaction.id)).to.eql(transaction.businessObject);
|
||||
expect(ids.assigned(subProcess.id)).to.be.false;
|
||||
}));
|
||||
// then
|
||||
expect(ids.assigned(transaction.id)).to.eql(transaction.businessObject);
|
||||
expect(ids.assigned(subProcess.id)).to.be.false;
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should replace CancelEvent when morphing transaction',
|
||||
inject(function(elementRegistry, bpmnReplace) {
|
||||
// given
|
||||
var transaction = elementRegistry.get('Transaction_1'),
|
||||
endEvent = elementRegistry.get('EndEvent_1');
|
||||
|
||||
// when
|
||||
bpmnReplace.replaceElement(endEvent, {
|
||||
type: 'bpmn:EndEvent',
|
||||
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||
});
|
||||
// given
|
||||
var transaction = elementRegistry.get('Transaction_1'),
|
||||
endEvent = elementRegistry.get('EndEvent_1');
|
||||
|
||||
var subProcess = bpmnReplace.replaceElement(transaction, { type: 'bpmn:SubProcess' });
|
||||
// when
|
||||
bpmnReplace.replaceElement(endEvent, {
|
||||
type: 'bpmn:EndEvent',
|
||||
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||
});
|
||||
|
||||
var newEndEvent = subProcess.children[0].businessObject;
|
||||
var subProcess = bpmnReplace.replaceElement(transaction, { type: 'bpmn:SubProcess' });
|
||||
|
||||
// then
|
||||
expect(subProcess.children).to.have.length(2);
|
||||
expect(newEndEvent.eventDefinitionTypes).to.not.exist;
|
||||
}));
|
||||
var newEndEvent = subProcess.children[0].businessObject;
|
||||
|
||||
// then
|
||||
expect(subProcess.children).to.have.length(2);
|
||||
expect(newEndEvent.eventDefinitionTypes).to.not.exist;
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should replace CancelEvent when morphing transaction -> undo',
|
||||
inject(function(elementRegistry, bpmnReplace, commandStack) {
|
||||
// given
|
||||
var transaction = elementRegistry.get('Transaction_1'),
|
||||
endEvent = elementRegistry.get('EndEvent_1');
|
||||
|
||||
// when
|
||||
bpmnReplace.replaceElement(endEvent, {
|
||||
type: 'bpmn:EndEvent',
|
||||
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||
});
|
||||
// given
|
||||
var transaction = elementRegistry.get('Transaction_1'),
|
||||
endEvent = elementRegistry.get('EndEvent_1');
|
||||
|
||||
bpmnReplace.replaceElement(transaction, { type: 'bpmn:SubProcess' });
|
||||
// when
|
||||
bpmnReplace.replaceElement(endEvent, {
|
||||
type: 'bpmn:EndEvent',
|
||||
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||
});
|
||||
|
||||
commandStack.undo();
|
||||
bpmnReplace.replaceElement(transaction, { type: 'bpmn:SubProcess' });
|
||||
|
||||
var endEventAfter = elementRegistry.filter(function(element) {
|
||||
return (element.id !== 'EndEvent_2' && element.type === 'bpmn:EndEvent');
|
||||
})[0];
|
||||
commandStack.undo();
|
||||
|
||||
// then
|
||||
expect(transaction.children).to.have.length(2);
|
||||
expect(endEventAfter.businessObject.eventDefinitions).to.exist;
|
||||
}));
|
||||
var endEventAfter = elementRegistry.filter(function(element) {
|
||||
return (element.id !== 'EndEvent_2' && element.type === 'bpmn:EndEvent');
|
||||
})[0];
|
||||
|
||||
// then
|
||||
expect(transaction.children).to.have.length(2);
|
||||
expect(endEventAfter.businessObject.eventDefinitions).to.exist;
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should replace a CancelEvent when moving outside of a transaction',
|
||||
inject(function(elementRegistry, bpmnReplace, modeling) {
|
||||
// given
|
||||
var process = elementRegistry.get('Process_1'),
|
||||
transaction = elementRegistry.get('Transaction_1'),
|
||||
endEvent = elementRegistry.get('EndEvent_1');
|
||||
|
||||
// when
|
||||
var cancelEvent = bpmnReplace.replaceElement(endEvent, {
|
||||
type: 'bpmn:EndEvent',
|
||||
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||
});
|
||||
// given
|
||||
var process = elementRegistry.get('Process_1'),
|
||||
transaction = elementRegistry.get('Transaction_1'),
|
||||
endEvent = elementRegistry.get('EndEvent_1');
|
||||
|
||||
modeling.moveElements([ cancelEvent ], { x: 0, y: 150 }, process);
|
||||
// when
|
||||
var cancelEvent = bpmnReplace.replaceElement(endEvent, {
|
||||
type: 'bpmn:EndEvent',
|
||||
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||
});
|
||||
|
||||
var endEventAfter = elementRegistry.filter(function(element) {
|
||||
return (element.parent === process && element.type === 'bpmn:EndEvent');
|
||||
})[0];
|
||||
modeling.moveElements([ cancelEvent ], { x: 0, y: 150 }, process);
|
||||
|
||||
// then
|
||||
expect(transaction.children).to.have.length(0);
|
||||
expect(endEventAfter.businessObject.eventDefinitions).to.not.exist;
|
||||
}));
|
||||
var endEventAfter = elementRegistry.filter(function(element) {
|
||||
return (element.parent === process && element.type === 'bpmn:EndEvent');
|
||||
})[0];
|
||||
|
||||
// then
|
||||
expect(transaction.children).to.have.length(0);
|
||||
expect(endEventAfter.businessObject.eventDefinitions).to.not.exist;
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should replace a CancelEvent when moving outside of a transaction -> undo',
|
||||
inject(function(elementRegistry, bpmnReplace, modeling, commandStack) {
|
||||
// given
|
||||
var process = elementRegistry.get('Process_1'),
|
||||
transaction = elementRegistry.get('Transaction_1'),
|
||||
endEvent = elementRegistry.get('EndEvent_1');
|
||||
|
||||
// when
|
||||
var cancelEvent = bpmnReplace.replaceElement(endEvent, {
|
||||
type: 'bpmn:EndEvent',
|
||||
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||
});
|
||||
// given
|
||||
var process = elementRegistry.get('Process_1'),
|
||||
transaction = elementRegistry.get('Transaction_1'),
|
||||
endEvent = elementRegistry.get('EndEvent_1');
|
||||
|
||||
modeling.moveElements([ cancelEvent ], { x: 0, y: 150 }, process);
|
||||
// when
|
||||
var cancelEvent = bpmnReplace.replaceElement(endEvent, {
|
||||
type: 'bpmn:EndEvent',
|
||||
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||
});
|
||||
|
||||
commandStack.undo();
|
||||
modeling.moveElements([ cancelEvent ], { x: 0, y: 150 }, process);
|
||||
|
||||
var endEventAfter = elementRegistry.filter(function(element) {
|
||||
return (element.id !== 'EndEvent_2' && element.type === 'bpmn:EndEvent');
|
||||
})[0];
|
||||
commandStack.undo();
|
||||
|
||||
// then
|
||||
expect(transaction.children).to.have.length(2);
|
||||
expect(endEventAfter.businessObject.eventDefinitions).to.exist;
|
||||
}));
|
||||
var endEventAfter = elementRegistry.filter(function(element) {
|
||||
return (element.id !== 'EndEvent_2' && element.type === 'bpmn:EndEvent');
|
||||
})[0];
|
||||
|
||||
// then
|
||||
expect(transaction.children).to.have.length(2);
|
||||
expect(endEventAfter.businessObject.eventDefinitions).to.exist;
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
describe('- boundary events -', function() {
|
||||
|
||||
describe('boundary events', function() {
|
||||
|
||||
it('should replace CancelBoundaryEvent when morphing from a transaction',
|
||||
inject(function(elementRegistry, bpmnReplace) {
|
||||
// given
|
||||
var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
transaction = elementRegistry.get('Transaction_1');
|
||||
|
||||
// when
|
||||
bpmnReplace.replaceElement(boundaryEvent, {
|
||||
type: 'bpmn:BoundaryEvent',
|
||||
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||
});
|
||||
// given
|
||||
var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
transaction = elementRegistry.get('Transaction_1');
|
||||
|
||||
var subProcess = bpmnReplace.replaceElement(transaction, { type: 'bpmn:SubProcess' });
|
||||
// when
|
||||
bpmnReplace.replaceElement(boundaryEvent, {
|
||||
type: 'bpmn:BoundaryEvent',
|
||||
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||
});
|
||||
|
||||
var newBoundaryEvent = subProcess.attachers[0].businessObject;
|
||||
var subProcess = bpmnReplace.replaceElement(transaction, { type: 'bpmn:SubProcess' });
|
||||
|
||||
// then
|
||||
expect(newBoundaryEvent.eventDefinitionTypes).to.not.exist;
|
||||
expect(newBoundaryEvent.attachedToRef).to.equal(subProcess.businessObject);
|
||||
expect(elementRegistry.get('Transaction_1')).to.not.exist;
|
||||
}));
|
||||
var newBoundaryEvent = subProcess.attachers[0].businessObject;
|
||||
|
||||
// then
|
||||
expect(newBoundaryEvent.eventDefinitionTypes).to.not.exist;
|
||||
expect(newBoundaryEvent.attachedToRef).to.equal(subProcess.businessObject);
|
||||
expect(elementRegistry.get('Transaction_1')).to.not.exist;
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should replace CancelBoundaryEvent when morphing from a transaction -> undo',
|
||||
inject(function(elementRegistry, bpmnReplace, commandStack) {
|
||||
// given
|
||||
var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
transaction = elementRegistry.get('Transaction_1');
|
||||
|
||||
// when
|
||||
bpmnReplace.replaceElement(boundaryEvent, {
|
||||
type: 'bpmn:BoundaryEvent',
|
||||
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||
});
|
||||
// given
|
||||
var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
transaction = elementRegistry.get('Transaction_1');
|
||||
|
||||
bpmnReplace.replaceElement(transaction, { type: 'bpmn:SubProcess' });
|
||||
// when
|
||||
bpmnReplace.replaceElement(boundaryEvent, {
|
||||
type: 'bpmn:BoundaryEvent',
|
||||
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||
});
|
||||
|
||||
commandStack.undo();
|
||||
bpmnReplace.replaceElement(transaction, { type: 'bpmn:SubProcess' });
|
||||
|
||||
var afterBoundaryEvent = elementRegistry.filter(function(element) {
|
||||
return (element.type === 'bpmn:BoundaryEvent' && element.id !== 'BoundaryEvent_2');
|
||||
})[0];
|
||||
commandStack.undo();
|
||||
|
||||
// then
|
||||
expect(afterBoundaryEvent.businessObject.eventDefinitions).exist;
|
||||
expect(afterBoundaryEvent.businessObject.attachedToRef).to.equal(transaction.businessObject);
|
||||
expect(transaction.attachers).to.have.length(1);
|
||||
}));
|
||||
var afterBoundaryEvent = elementRegistry.filter(function(element) {
|
||||
return (element.type === 'bpmn:BoundaryEvent' && element.id !== 'BoundaryEvent_2');
|
||||
})[0];
|
||||
|
||||
// then
|
||||
expect(afterBoundaryEvent.businessObject.eventDefinitions).exist;
|
||||
expect(afterBoundaryEvent.businessObject.attachedToRef).to.equal(transaction.businessObject);
|
||||
expect(transaction.attachers).to.have.length(1);
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should replace CancelBoundaryEvent when attaching to a NON-transaction',
|
||||
inject(function(elementRegistry, bpmnReplace, modeling) {
|
||||
// given
|
||||
var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
subProcess = elementRegistry.get('SubProcess_1'),
|
||||
process = elementRegistry.get('Process_1'),
|
||||
transaction = elementRegistry.get('Transaction_1');
|
||||
|
||||
// when
|
||||
var newBoundaryEvent = bpmnReplace.replaceElement(boundaryEvent, {
|
||||
type: 'bpmn:BoundaryEvent',
|
||||
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||
});
|
||||
// given
|
||||
var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
subProcess = elementRegistry.get('SubProcess_1'),
|
||||
process = elementRegistry.get('Process_1'),
|
||||
transaction = elementRegistry.get('Transaction_1');
|
||||
|
||||
modeling.moveElements([ newBoundaryEvent ], { x: 500, y: 0 }, subProcess, true);
|
||||
// when
|
||||
var newBoundaryEvent = bpmnReplace.replaceElement(boundaryEvent, {
|
||||
type: 'bpmn:BoundaryEvent',
|
||||
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||
});
|
||||
|
||||
var movedBoundaryEvent = elementRegistry.filter(function(element) {
|
||||
return (element.type === 'bpmn:BoundaryEvent' && element.id !== 'BoundaryEvent_2');
|
||||
})[0];
|
||||
modeling.moveElements([ newBoundaryEvent ], { x: 500, y: 0 }, subProcess, true);
|
||||
|
||||
// then
|
||||
expect(movedBoundaryEvent.businessObject.eventDefinitions).to.not.exist;
|
||||
expect(movedBoundaryEvent.businessObject.attachedToRef).to.equal(subProcess.businessObject);
|
||||
expect(movedBoundaryEvent.parent).to.equal(process);
|
||||
var movedBoundaryEvent = elementRegistry.filter(function(element) {
|
||||
return (element.type === 'bpmn:BoundaryEvent' && element.id !== 'BoundaryEvent_2');
|
||||
})[0];
|
||||
|
||||
expect(movedBoundaryEvent.host).to.equal(subProcess);
|
||||
expect(subProcess.attachers).to.contain(movedBoundaryEvent);
|
||||
expect(transaction.attachers).to.be.empty;
|
||||
}));
|
||||
// then
|
||||
expect(movedBoundaryEvent.businessObject.eventDefinitions).to.not.exist;
|
||||
expect(movedBoundaryEvent.businessObject.attachedToRef).to.equal(subProcess.businessObject);
|
||||
expect(movedBoundaryEvent.parent).to.equal(process);
|
||||
|
||||
expect(movedBoundaryEvent.host).to.equal(subProcess);
|
||||
expect(subProcess.attachers).to.contain(movedBoundaryEvent);
|
||||
expect(transaction.attachers).to.be.empty;
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should replace CancelBoundaryEvent when attaching to a NON-transaction -> undo',
|
||||
inject(function(elementRegistry, bpmnReplace, modeling, commandStack) {
|
||||
// given
|
||||
var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
transaction = elementRegistry.get('Transaction_1'),
|
||||
subProcess = elementRegistry.get('SubProcess_1');
|
||||
|
||||
// when
|
||||
var newBoundaryEvent = bpmnReplace.replaceElement(boundaryEvent, {
|
||||
type: 'bpmn:BoundaryEvent',
|
||||
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||
});
|
||||
// given
|
||||
var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
transaction = elementRegistry.get('Transaction_1'),
|
||||
subProcess = elementRegistry.get('SubProcess_1');
|
||||
|
||||
modeling.moveElements([ newBoundaryEvent ], { x: 500, y: 0 }, subProcess, true);
|
||||
// when
|
||||
var newBoundaryEvent = bpmnReplace.replaceElement(boundaryEvent, {
|
||||
type: 'bpmn:BoundaryEvent',
|
||||
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||
});
|
||||
|
||||
commandStack.undo();
|
||||
modeling.moveElements([ newBoundaryEvent ], { x: 500, y: 0 }, subProcess, true);
|
||||
|
||||
var movedBoundaryEvent = elementRegistry.filter(function(element) {
|
||||
return (element.type === 'bpmn:BoundaryEvent' && element.id !== 'BoundaryEvent_2');
|
||||
})[0];
|
||||
commandStack.undo();
|
||||
|
||||
// then
|
||||
expect(movedBoundaryEvent.businessObject.eventDefinitions).to.exist;
|
||||
expect(movedBoundaryEvent.businessObject.attachedToRef).to.equal(transaction.businessObject);
|
||||
var movedBoundaryEvent = elementRegistry.filter(function(element) {
|
||||
return (element.type === 'bpmn:BoundaryEvent' && element.id !== 'BoundaryEvent_2');
|
||||
})[0];
|
||||
|
||||
// then
|
||||
expect(movedBoundaryEvent.businessObject.eventDefinitions).to.exist;
|
||||
expect(movedBoundaryEvent.businessObject.attachedToRef).to.equal(transaction.businessObject);
|
||||
|
||||
expect(movedBoundaryEvent.host).to.equal(transaction);
|
||||
expect(transaction.attachers).to.contain(movedBoundaryEvent);
|
||||
expect(subProcess.attachers).to.have.length(1);
|
||||
})
|
||||
);
|
||||
|
||||
expect(movedBoundaryEvent.host).to.equal(transaction);
|
||||
expect(transaction.attachers).to.contain(movedBoundaryEvent);
|
||||
expect(subProcess.attachers).to.have.length(1);
|
||||
}));
|
||||
|
||||
it('should NOT allow morphing into an IntermediateEvent',
|
||||
inject(function(elementRegistry, bpmnReplace, commandStack, move, dragging) {
|
||||
// given
|
||||
var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
subProcess = elementRegistry.get('SubProcess_1');
|
||||
|
||||
// when
|
||||
var newBoundaryEvent = bpmnReplace.replaceElement(boundaryEvent, {
|
||||
type: 'bpmn:BoundaryEvent',
|
||||
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||
});
|
||||
// given
|
||||
var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
subProcess = elementRegistry.get('SubProcess_1');
|
||||
|
||||
move.start(canvasEvent({ x: 0, y: 0 }), newBoundaryEvent);
|
||||
// when
|
||||
var newBoundaryEvent = bpmnReplace.replaceElement(boundaryEvent, {
|
||||
type: 'bpmn:BoundaryEvent',
|
||||
eventDefinitionType: 'bpmn:CancelEventDefinition'
|
||||
});
|
||||
|
||||
dragging.hover({
|
||||
gfx: elementRegistry.getGraphics(subProcess),
|
||||
element: subProcess
|
||||
});
|
||||
dragging.move(canvasEvent({ x: 450, y: -50 }));
|
||||
move.start(canvasEvent({ x: 0, y: 0 }), newBoundaryEvent);
|
||||
|
||||
var canExecute = dragging.context().data.context.canExecute;
|
||||
dragging.hover({
|
||||
gfx: elementRegistry.getGraphics(subProcess),
|
||||
element: subProcess
|
||||
});
|
||||
dragging.move(canvasEvent({ x: 450, y: -50 }));
|
||||
|
||||
// then
|
||||
expect(canExecute).to.be.false;
|
||||
}));
|
||||
var canExecute = dragging.context().data.context.canExecute;
|
||||
|
||||
// then
|
||||
expect(canExecute).to.be.false;
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -16,13 +16,11 @@ describe('features/modeling - delete default connection', function() {
|
|||
|
||||
var gateway,
|
||||
defaultConnection,
|
||||
defaultTask,
|
||||
normalConnection;
|
||||
|
||||
beforeEach(inject(function(elementRegistry) {
|
||||
gateway = elementRegistry.get('exclusive-gateway');
|
||||
defaultConnection = elementRegistry.get('flow-default');
|
||||
defaultTask = elementRegistry.get('task-default');
|
||||
normalConnection = elementRegistry.get('flow-normal');
|
||||
}));
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../../TestHelper');
|
||||
require('../../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../../TestHelper');
|
||||
require('../../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../../TestHelper');
|
||||
require('../../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../../TestHelper');
|
||||
require('../../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../../TestHelper');
|
||||
require('../../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../../TestHelper');
|
||||
require('../../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
@ -17,7 +17,7 @@ describe('features/modeling - layout association', function() {
|
|||
|
||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||
|
||||
beforeEach(inject(function(canvas){
|
||||
beforeEach(inject(function(canvas) {
|
||||
rootShape = canvas.getRootElement();
|
||||
}));
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../../TestHelper');
|
||||
require('../../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../../TestHelper');
|
||||
require('../../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
@ -20,7 +20,7 @@ describe('features/modeling - layout data association', function() {
|
|||
|
||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||
|
||||
beforeEach(inject(function(elementRegistry, canvas){
|
||||
beforeEach(inject(function(elementRegistry, canvas) {
|
||||
rootShape = canvas.getRootElement();
|
||||
taskShape = elementRegistry.get('Task_1');
|
||||
}));
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../../TestHelper');
|
||||
require('../../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
@ -77,24 +77,25 @@ describe('features/modeling - layout message flows', function() {
|
|||
|
||||
|
||||
it('should layout manhattan after Participant move beyond EndEvent bounds',
|
||||
inject(function(elementRegistry, modeling) {
|
||||
inject(function(elementRegistry, modeling) {
|
||||
|
||||
// given
|
||||
var participantShape = elementRegistry.get('Participant_1'),
|
||||
messageFlowConnection = elementRegistry.get('MessageFlow_5');
|
||||
// given
|
||||
var participantShape = elementRegistry.get('Participant_1'),
|
||||
messageFlowConnection = elementRegistry.get('MessageFlow_5');
|
||||
|
||||
// when
|
||||
modeling.moveElements([ participantShape ], { x: -200, y: 0 });
|
||||
// when
|
||||
modeling.moveElements([ participantShape ], { x: -200, y: 0 });
|
||||
|
||||
// then
|
||||
// then
|
||||
|
||||
// expect cropped, repaired manhattan connection
|
||||
expect(messageFlowConnection.waypoints).eql([
|
||||
{ original: { x: 671, y: 214 }, x: 671, y: 214 },
|
||||
{ x: 671, y: 315 },
|
||||
{ x: 471, y: 315 },
|
||||
{ original: { x: 471, y: 415 }, x: 471, y: 415 }
|
||||
]);
|
||||
}));
|
||||
// expect cropped, repaired manhattan connection
|
||||
expect(messageFlowConnection.waypoints).eql([
|
||||
{ original: { x: 671, y: 214 }, x: 671, y: 214 },
|
||||
{ x: 671, y: 315 },
|
||||
{ x: 471, y: 315 },
|
||||
{ original: { x: 471, y: 415 }, x: 471, y: 415 }
|
||||
]);
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
});
|
|
@ -12,10 +12,6 @@ var Modeler = require('../../../../../lib/Modeler');
|
|||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
var appendElement = require('../../../../util/ModelingUtil').appendElement,
|
||||
moveElements = require('../../../../util/ModelingUtil').moveElements,
|
||||
getElement = require('../../../../util/ModelingUtil').getElement;
|
||||
|
||||
|
||||
var modelingModule = require('../../../../../lib/features/modeling'),
|
||||
coreModule = require('../../../../../lib/core');
|
||||
|
@ -66,9 +62,9 @@ describe('features/modeling - layout', function() {
|
|||
|
||||
// then
|
||||
expect(connection.waypoints).to.eql([
|
||||
{"original":{"x":678,"y":302},"x":678,"y":277},
|
||||
{"x":678,"y":220},
|
||||
{"original":{"x":840,"y":220},"x":790,"y":220}
|
||||
{ original: { x:678,y:302 },x:678,y:277 },
|
||||
{ x:678,y:220 },
|
||||
{ original: { x:840,y:220 },x:790,y:220 }
|
||||
]);
|
||||
}));
|
||||
|
||||
|
@ -80,9 +76,9 @@ describe('features/modeling - layout', function() {
|
|||
|
||||
// then
|
||||
expect(connection.waypoints).to.eql([
|
||||
{"original":{"x":840,"y":220},"x":890,"y":220},
|
||||
{"x":1005,"y":220},
|
||||
{"original":{"x":1005,"y":302},"x":1005,"y":277}
|
||||
{ original:{ x:840,y:220 },x:890,y:220 },
|
||||
{ x:1005,y:220 },
|
||||
{ original:{ x:1005,y:302 },x:1005,y:277 }
|
||||
]);
|
||||
}));
|
||||
|
||||
|
@ -98,10 +94,10 @@ describe('features/modeling - layout', function() {
|
|||
|
||||
// then
|
||||
expect(connection.waypoints).to.eql([
|
||||
{"original":{"x":170,"y":302},"x":188,"y":302},
|
||||
{"x":235,"y":302},
|
||||
{"x":235,"y":220},
|
||||
{"original":{"x":332,"y":220},"x":282,"y":220}
|
||||
{ original:{ x:170,y:302 },x:188,y:302 },
|
||||
{ x:235,y:302 },
|
||||
{ x:235,y:220 },
|
||||
{ original:{ x:332,y:220 },x:282,y:220 }
|
||||
]);
|
||||
}));
|
||||
|
||||
|
@ -113,10 +109,10 @@ describe('features/modeling - layout', function() {
|
|||
|
||||
// then
|
||||
expect(connection.waypoints).to.eql([
|
||||
{"original":{"x":678,"y":117},"x":728,"y":117},
|
||||
{"x":759,"y":117},
|
||||
{"x":759,"y":220},
|
||||
{"original":{"x":840,"y":220},"x":790,"y":220}
|
||||
{ original:{ x:678,y:117 },x:728,y:117 },
|
||||
{ x:759,y:117 },
|
||||
{ x:759,y:220 },
|
||||
{ original:{ x:840,y:220 },x:790,y:220 }
|
||||
]);
|
||||
}));
|
||||
|
||||
|
@ -128,10 +124,10 @@ describe('features/modeling - layout', function() {
|
|||
|
||||
// then
|
||||
expect(connection.waypoints).to.eql([
|
||||
{"original":{"x":496,"y":302},"x":514,"y":302},
|
||||
{"x":571,"y":302},
|
||||
{"x":571,"y":117},
|
||||
{"original":{"x":678,"y":117},"x":628,"y":117}
|
||||
{ original:{ x:496,y:302 },x:514,y:302 },
|
||||
{ x:571,y:302 },
|
||||
{ x:571,y:117 },
|
||||
{ original:{ x:678,y:117 },x:628,y:117 }
|
||||
]);
|
||||
}));
|
||||
|
||||
|
@ -143,10 +139,10 @@ describe('features/modeling - layout', function() {
|
|||
|
||||
// then
|
||||
expect(connection.waypoints).to.eql([
|
||||
{"original":{"x":496,"y":302},"x":478,"y":302},
|
||||
{"x":430,"y":302},
|
||||
{"x":430,"y":220},
|
||||
{"original":{"x":332,"y":220},"x":382,"y":220}
|
||||
{ original:{ x:496,y:302 },x:478,y:302 },
|
||||
{ x:430,y:302 },
|
||||
{ x:430,y:220 },
|
||||
{ original:{ x:332,y:220 },x:382,y:220 }
|
||||
]);
|
||||
}));
|
||||
|
||||
|
@ -166,10 +162,10 @@ describe('features/modeling - layout', function() {
|
|||
|
||||
// then
|
||||
expect(connection.waypoints).to.eql([
|
||||
{"original":{"x":382,"y":241},"x":382,"y":241},
|
||||
{"x":559,"y":241},
|
||||
{"x":559,"y":138},
|
||||
{"original":{"x":660,"y":280},"x":660,"y":280}
|
||||
{ original:{ x:382,y:241 },x:382,y:241 },
|
||||
{ x:559,y:241 },
|
||||
{ x:559,y:138 },
|
||||
{ original:{ x:660,y:280 },x:660,y:280 }
|
||||
]);
|
||||
}));
|
||||
|
||||
|
@ -184,10 +180,10 @@ describe('features/modeling - layout', function() {
|
|||
move('ServiceTask_1', delta);
|
||||
|
||||
// then
|
||||
expect(connection.waypoints).to.eql([{"original":{"x":382,"y":241},"x":382,"y":241},
|
||||
{"x":559,"y":241},
|
||||
{"x":559,"y":158},
|
||||
{"original":{"x":598,"y":158},"x":598,"y":158}
|
||||
expect(connection.waypoints).to.eql([{ original:{ x:382,y:241 },x:382,y:241 },
|
||||
{ x:559,y:241 },
|
||||
{ x:559,y:158 },
|
||||
{ original:{ x:598,y:158 },x:598,y:158 }
|
||||
]);
|
||||
}));
|
||||
|
||||
|
@ -203,10 +199,10 @@ describe('features/modeling - layout', function() {
|
|||
|
||||
// then
|
||||
expect(connection.waypoints).to.eql([
|
||||
{"original":{"x":352,"y":261},"x":352,"y":261},
|
||||
{"x":559,"y":261},
|
||||
{"x":559,"y":138},
|
||||
{"original":{"x":628,"y":138},"x":628,"y":138}
|
||||
{ original:{ x:352,y:261 },x:352,y:261 },
|
||||
{ x:559,y:261 },
|
||||
{ x:559,y:138 },
|
||||
{ original:{ x:628,y:138 },x:628,y:138 }
|
||||
]);
|
||||
}));
|
||||
|
||||
|
@ -231,10 +227,10 @@ describe('features/modeling - layout', function() {
|
|||
|
||||
// then
|
||||
expect(connection.waypoints).to.eql([
|
||||
{"original":{"x":505,"y":417},"x":487,"y":417},
|
||||
{"x":437,"y":417},
|
||||
{"x":437,"y":394},
|
||||
{"original":{"x":337,"y":394},"x":387,"y":394}
|
||||
{ original:{ x:505,y:417 },x:487,y:417 },
|
||||
{ x:437,y:417 },
|
||||
{ x:437,y:394 },
|
||||
{ original:{ x:337,y:394 },x:387,y:394 }
|
||||
]);
|
||||
}));
|
||||
|
||||
|
@ -246,9 +242,9 @@ describe('features/modeling - layout', function() {
|
|||
|
||||
// then
|
||||
expect(connection.waypoints).to.eql([
|
||||
{"original":{"x":505,"y":417},"x":487,"y":417},
|
||||
{"x":412,"y":417},
|
||||
{"original":{"x":412,"y":543},"x":412,"y":503}
|
||||
{ original:{ x:505,y:417 },x:487,y:417 },
|
||||
{ x:412,y:417 },
|
||||
{ original:{ x:412,y:543 },x:412,y:503 }
|
||||
]);
|
||||
}));
|
||||
|
||||
|
@ -260,9 +256,9 @@ describe('features/modeling - layout', function() {
|
|||
|
||||
// then
|
||||
expect(connection.waypoints).to.eql([
|
||||
{"original":{"x":505,"y":417},"x":523,"y":417},
|
||||
{"x":1016,"y":417},
|
||||
{"original":{"x":1016,"y":215},"x":1016,"y":255}
|
||||
{ original:{ x:505,y:417 },x:523,y:417 },
|
||||
{ x:1016,y:417 },
|
||||
{ original:{ x:1016,y:215 },x:1016,y:255 }
|
||||
]);
|
||||
}));
|
||||
|
||||
|
@ -274,8 +270,8 @@ describe('features/modeling - layout', function() {
|
|||
|
||||
// then
|
||||
expect(connection.waypoints).to.eql([
|
||||
{"original":{"x":586,"y":258},"x":586,"y":240},
|
||||
{"original":{"x":586,"y":121},"x":586,"y":161}
|
||||
{ original:{ x:586,y:258 },x:586,y:240 },
|
||||
{ original:{ x:586,y:121 },x:586,y:161 }
|
||||
]);
|
||||
}));
|
||||
|
||||
|
@ -287,9 +283,9 @@ describe('features/modeling - layout', function() {
|
|||
|
||||
// then
|
||||
expect(connection.waypoints).to.eql([
|
||||
{"original":{"x":586,"y":258},"x":586,"y":258},
|
||||
{"x":586,"y":162},
|
||||
{"original":{"x":428,"y":162},"x":478,"y":162}
|
||||
{ original:{ x:586,y:258 },x:586,y:258 },
|
||||
{ x:586,y:162 },
|
||||
{ original:{ x:428,y:162 },x:478,y:162 }
|
||||
]);
|
||||
}));
|
||||
|
||||
|
@ -301,9 +297,9 @@ describe('features/modeling - layout', function() {
|
|||
|
||||
// then
|
||||
expect(connection.waypoints).to.eql([
|
||||
{"original":{"x":855,"y":293},"x":873,"y":293},
|
||||
{"x":1041,"y":293},
|
||||
{"original":{"x":1041,"y":483},"x":1041,"y":443}
|
||||
{ original:{ x:855,y:293 },x:873,y:293 },
|
||||
{ x:1041,y:293 },
|
||||
{ original:{ x:1041,y:483 },x:1041,y:443 }
|
||||
]);
|
||||
}));
|
||||
|
||||
|
@ -315,9 +311,9 @@ describe('features/modeling - layout', function() {
|
|||
|
||||
// then
|
||||
expect(connection.waypoints).to.eql([
|
||||
{"original":{"x":815,"y":458},"x":815,"y":476},
|
||||
{"x":815,"y":543},
|
||||
{"original":{"x":412,"y":543},"x":462,"y":543}
|
||||
{ original:{ x:815,y:458 },x:815,y:476 },
|
||||
{ x:815,y:543 },
|
||||
{ original:{ x:412,y:543 },x:462,y:543 }
|
||||
]);
|
||||
}));
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
require('../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
require('../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
@ -68,6 +68,7 @@ describe('features/replace-preview', function() {
|
|||
|
||||
}));
|
||||
|
||||
|
||||
it('should replace visuals at the same position as the replaced visual', inject(function(dragging) {
|
||||
|
||||
// when
|
||||
|
@ -79,7 +80,6 @@ describe('features/replace-preview', function() {
|
|||
dragGroup[0].attr('display', 'inline');
|
||||
|
||||
expect(dragGroup[0].getBBox()).to.eql(dragGroup[1].getBBox());
|
||||
|
||||
}));
|
||||
|
||||
|
||||
|
@ -113,12 +113,10 @@ describe('features/replace-preview', function() {
|
|||
var visualReplacements = dragging.context().data.context.visualReplacements;
|
||||
|
||||
expect(visualReplacements).to.be.empty;
|
||||
|
||||
}));
|
||||
|
||||
|
||||
it('should hide the replaced visual',
|
||||
inject(function(dragging) {
|
||||
it('should hide the replaced visual', inject(function(dragging) {
|
||||
|
||||
// when
|
||||
moveShape(startEvent_1, rootElement, { x: 280, y: 120 });
|
||||
|
@ -127,176 +125,176 @@ describe('features/replace-preview', function() {
|
|||
var dragGroup = dragging.context().data.context.dragGroup;
|
||||
|
||||
expect(dragGroup[0].attr('display')).to.equal('none');
|
||||
|
||||
}));
|
||||
|
||||
|
||||
it('should not replace non-interrupting start event while hover over same event sub process',
|
||||
inject(function(dragging, elementRegistry) {
|
||||
|
||||
// given
|
||||
var subProcess_1 = elementRegistry.get('SubProcess_1');
|
||||
// given
|
||||
var subProcess_1 = elementRegistry.get('SubProcess_1');
|
||||
|
||||
// when
|
||||
moveShape(startEvent_1, subProcess_1, { x: 210, y: 180 });
|
||||
// when
|
||||
moveShape(startEvent_1, subProcess_1, { x: 210, y: 180 });
|
||||
|
||||
var context = dragging.context().data.context;
|
||||
var context = dragging.context().data.context;
|
||||
|
||||
// then
|
||||
// check if the visual representation remains a non interrupting message start event
|
||||
var startEventGfx = getGfx({
|
||||
type: 'bpmn:StartEvent',
|
||||
isInterrupting: false,
|
||||
eventDefinitionType: 'bpmn:MessageEventDefinition'
|
||||
});
|
||||
// then
|
||||
// check if the visual representation remains a non interrupting message start event
|
||||
var startEventGfx = getGfx({
|
||||
type: 'bpmn:StartEvent',
|
||||
isInterrupting: false,
|
||||
eventDefinitionType: 'bpmn:MessageEventDefinition'
|
||||
});
|
||||
|
||||
expect(context.dragGroup[0].innerSVG()).to.equal(startEventGfx.innerSVG());
|
||||
|
||||
}));
|
||||
expect(context.dragGroup[0].innerSVG()).to.equal(startEventGfx.innerSVG());
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should replace non-interrupting start event while hover over root element',
|
||||
inject(function(dragging, elementRegistry) {
|
||||
|
||||
// when
|
||||
moveShape(startEvent_1, rootElement, { x: 280, y: 120 });
|
||||
// when
|
||||
moveShape(startEvent_1, rootElement, { x: 280, y: 120 });
|
||||
|
||||
var context = dragging.context().data.context;
|
||||
var context = dragging.context().data.context;
|
||||
|
||||
// then
|
||||
// check if the visual replacement is a blank interrupting start event
|
||||
var startEventGfx = getGfx({ type: 'bpmn:StartEvent' });
|
||||
// then
|
||||
// check if the visual replacement is a blank interrupting start event
|
||||
var startEventGfx = getGfx({ type: 'bpmn:StartEvent' });
|
||||
|
||||
expect(context.dragGroup[1].innerSVG()).to.equal(startEventGfx.innerSVG());
|
||||
|
||||
}));
|
||||
expect(context.dragGroup[1].innerSVG()).to.equal(startEventGfx.innerSVG());
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should not replace non-interrupting start event while hover over another event sub process',
|
||||
inject(function(dragging, elementRegistry) {
|
||||
|
||||
// given
|
||||
var subProcess_2 = elementRegistry.get('SubProcess_2');
|
||||
// given
|
||||
var subProcess_2 = elementRegistry.get('SubProcess_2');
|
||||
|
||||
// when
|
||||
moveShape(startEvent_1, subProcess_2, { x: 350, y: 120 });
|
||||
// when
|
||||
moveShape(startEvent_1, subProcess_2, { x: 350, y: 120 });
|
||||
|
||||
var context = dragging.context().data.context;
|
||||
var context = dragging.context().data.context;
|
||||
|
||||
// then
|
||||
// check if the visual representation remains a non interrupting message start event
|
||||
var startEventGfx = getGfx({
|
||||
type: 'bpmn:StartEvent',
|
||||
isInterrupting: false,
|
||||
eventDefinitionType: 'bpmn:MessageEventDefinition'
|
||||
});
|
||||
// then
|
||||
// check if the visual representation remains a non interrupting message start event
|
||||
var startEventGfx = getGfx({
|
||||
type: 'bpmn:StartEvent',
|
||||
isInterrupting: false,
|
||||
eventDefinitionType: 'bpmn:MessageEventDefinition'
|
||||
});
|
||||
|
||||
expect(context.dragGroup[0].innerSVG()).to.equal(startEventGfx.innerSVG());
|
||||
|
||||
}));
|
||||
expect(context.dragGroup[0].innerSVG()).to.equal(startEventGfx.innerSVG());
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should replace non-interrupting start event while hover over regular sub process',
|
||||
inject(function(dragging, elementRegistry) {
|
||||
|
||||
// given
|
||||
var subProcess_3 = elementRegistry.get('SubProcess_3');
|
||||
// given
|
||||
var subProcess_3 = elementRegistry.get('SubProcess_3');
|
||||
|
||||
// when
|
||||
moveShape(startEvent_1, subProcess_3, { x: 600, y: 120 });
|
||||
// when
|
||||
moveShape(startEvent_1, subProcess_3, { x: 600, y: 120 });
|
||||
|
||||
var context = dragging.context().data.context;
|
||||
var context = dragging.context().data.context;
|
||||
|
||||
// then
|
||||
// check if the visual representation remains a non interrupting message start event
|
||||
var startEventGfx = getGfx({ type: 'bpmn:StartEvent' });
|
||||
// then
|
||||
// check if the visual representation remains a non interrupting message start event
|
||||
var startEventGfx = getGfx({ type: 'bpmn:StartEvent' });
|
||||
|
||||
expect(context.dragGroup[1].innerSVG()).to.equal(startEventGfx.innerSVG());
|
||||
|
||||
}));
|
||||
expect(context.dragGroup[1].innerSVG()).to.equal(startEventGfx.innerSVG());
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should replace all non-interrupting start events in a selection of multiple elements',
|
||||
inject(function(move, dragging, elementRegistry, selection) {
|
||||
|
||||
// given
|
||||
var startEvent_2 = elementRegistry.get('StartEvent_2'),
|
||||
startEvent_3 = elementRegistry.get('StartEvent_3');
|
||||
// given
|
||||
var startEvent_2 = elementRegistry.get('StartEvent_2'),
|
||||
startEvent_3 = elementRegistry.get('StartEvent_3');
|
||||
|
||||
// when
|
||||
selection.select([ startEvent_1, startEvent_2, startEvent_3 ]);
|
||||
// when
|
||||
selection.select([ startEvent_1, startEvent_2, startEvent_3 ]);
|
||||
|
||||
moveShape(startEvent_1, rootElement, { x: 150, y: 250 });
|
||||
moveShape(startEvent_1, rootElement, { x: 150, y: 250 });
|
||||
|
||||
var context = dragging.context().data.context;
|
||||
var context = dragging.context().data.context;
|
||||
|
||||
// then
|
||||
// check if the visual replacements are blank interrupting start events
|
||||
var startEventGfx = getGfx({ type: 'bpmn:StartEvent' });
|
||||
// then
|
||||
// check if the visual replacements are blank interrupting start events
|
||||
var startEventGfx = getGfx({ type: 'bpmn:StartEvent' });
|
||||
|
||||
expect(context.dragGroup[1].innerSVG()).to.equal(startEventGfx.innerSVG());
|
||||
expect(context.dragGroup[3].innerSVG()).to.equal(startEventGfx.innerSVG());
|
||||
expect(context.dragGroup[4].innerSVG()).to.equal(startEventGfx.innerSVG());
|
||||
|
||||
}));
|
||||
expect(context.dragGroup[1].innerSVG()).to.equal(startEventGfx.innerSVG());
|
||||
expect(context.dragGroup[3].innerSVG()).to.equal(startEventGfx.innerSVG());
|
||||
expect(context.dragGroup[4].innerSVG()).to.equal(startEventGfx.innerSVG());
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should not replace any non-interrupting start events in a selection of multiple elements',
|
||||
inject(function(move, dragging, elementRegistry, selection) {
|
||||
|
||||
// given
|
||||
var startEvent_2 = elementRegistry.get('StartEvent_2'),
|
||||
startEvent_3 = elementRegistry.get('StartEvent_3'),
|
||||
subProcess_2 = elementRegistry.get('SubProcess_2');
|
||||
// given
|
||||
var startEvent_2 = elementRegistry.get('StartEvent_2'),
|
||||
startEvent_3 = elementRegistry.get('StartEvent_3'),
|
||||
subProcess_2 = elementRegistry.get('SubProcess_2');
|
||||
|
||||
var messageStartEventGfx = getGfx({
|
||||
type: 'bpmn:StartEvent',
|
||||
isInterrupting: false,
|
||||
eventDefinitionType: 'bpmn:MessageEventDefinition'
|
||||
});
|
||||
var messageStartEventGfx = getGfx({
|
||||
type: 'bpmn:StartEvent',
|
||||
isInterrupting: false,
|
||||
eventDefinitionType: 'bpmn:MessageEventDefinition'
|
||||
});
|
||||
|
||||
var timerStartEventGfx = getGfx({
|
||||
type: 'bpmn:StartEvent',
|
||||
isInterrupting: false,
|
||||
eventDefinitionType: 'bpmn:TimerEventDefinition'
|
||||
});
|
||||
var timerStartEventGfx = getGfx({
|
||||
type: 'bpmn:StartEvent',
|
||||
isInterrupting: false,
|
||||
eventDefinitionType: 'bpmn:TimerEventDefinition'
|
||||
});
|
||||
|
||||
var startEventGfx = getGfx({ type: 'bpmn:StartEvent' });
|
||||
var startEventGfx = getGfx({ type: 'bpmn:StartEvent' });
|
||||
|
||||
// when
|
||||
selection.select([ startEvent_1, startEvent_2, startEvent_3 ]);
|
||||
// when
|
||||
selection.select([ startEvent_1, startEvent_2, startEvent_3 ]);
|
||||
|
||||
moveShape(startEvent_1, subProcess_2, { x: 350, y: 120 });
|
||||
moveShape(startEvent_1, subProcess_2, { x: 350, y: 120 });
|
||||
|
||||
var context = dragging.context().data.context;
|
||||
var context = dragging.context().data.context;
|
||||
|
||||
// then
|
||||
expect(context.dragGroup[0].innerSVG()).to.equal(messageStartEventGfx.innerSVG());
|
||||
expect(context.dragGroup[1].innerSVG()).to.equal(startEventGfx.innerSVG());
|
||||
expect(context.dragGroup[2].innerSVG()).to.equal(timerStartEventGfx.innerSVG());
|
||||
|
||||
}));
|
||||
// then
|
||||
expect(context.dragGroup[0].innerSVG()).to.equal(messageStartEventGfx.innerSVG());
|
||||
expect(context.dragGroup[1].innerSVG()).to.equal(startEventGfx.innerSVG());
|
||||
expect(context.dragGroup[2].innerSVG()).to.equal(timerStartEventGfx.innerSVG());
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should not throw TypeError when moving boundaryEvent',
|
||||
inject(function(move, dragging, elementRegistry, elementFactory, selection, modeling) {
|
||||
|
||||
// given
|
||||
var startEvent_1 = elementRegistry.get('StartEvent_1'),
|
||||
subProcess_3 = elementRegistry.get('SubProcess_3');
|
||||
// given
|
||||
var startEvent_1 = elementRegistry.get('StartEvent_1'),
|
||||
subProcess_3 = elementRegistry.get('SubProcess_3');
|
||||
|
||||
var intermediateEvent = elementFactory.createShape({ type: 'bpmn:IntermediateThrowEvent' });
|
||||
var intermediateEvent = elementFactory.createShape({ type: 'bpmn:IntermediateThrowEvent' });
|
||||
|
||||
var boundaryEvent = modeling.createShape(intermediateEvent, { x: 550, y: 180 }, subProcess_3, true);
|
||||
var boundaryEvent = modeling.createShape(intermediateEvent, { x: 550, y: 180 }, subProcess_3, true);
|
||||
|
||||
// when
|
||||
selection.select([ startEvent_1 ]);
|
||||
// when
|
||||
selection.select([ startEvent_1 ]);
|
||||
|
||||
moveShape(boundaryEvent, subProcess_3, { x: 580, y: 210 });
|
||||
moveShape(boundaryEvent, subProcess_3, { x: 580, y: 180 });
|
||||
moveShape(boundaryEvent, subProcess_3, { x: 580, y: 210 });
|
||||
moveShape(boundaryEvent, subProcess_3, { x: 580, y: 180 });
|
||||
|
||||
// then
|
||||
// expect not to throw TypeError: Cannot read property 'oldElementId' of undefined
|
||||
}));
|
||||
// then
|
||||
// expect not to throw TypeError: Cannot read property 'oldElementId' of undefined
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
require('../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('drop Start Event -> Collapsed Sub Process', function(){
|
||||
it('drop Start Event -> Collapsed Sub Process', function() {
|
||||
|
||||
expectCanDrop('StartEvent_None', 'CollapsedSubProcess', false);
|
||||
});
|
||||
|
@ -839,7 +839,7 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
expectCanDrop('TextAnnotation_Global', 'Participant', true);
|
||||
}));
|
||||
|
||||
it('drop element -> collapsed Participant', inject(function(canvas){
|
||||
it('drop element -> collapsed Participant', inject(function(canvas) {
|
||||
expectCanDrop('StartEvent_None', 'CollapsedParticipant', false);
|
||||
expectCanDrop('SubProcess', 'CollapsedParticipant', false);
|
||||
expectCanDrop('Task_in_SubProcess', 'CollapsedParticipant', false);
|
||||
|
@ -946,7 +946,7 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('attach/move multiple BoundaryEvents -> SubProcess_1', inject(function (elementRegistry) {
|
||||
it('attach/move multiple BoundaryEvents -> SubProcess_1', inject(function(elementRegistry) {
|
||||
// when
|
||||
var boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
boundaryEvent2 = elementRegistry.get('BoundaryEvent_2');
|
||||
|
@ -963,7 +963,7 @@ describe('features/modeling/rules - BpmnRules', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('attach/move SubProcess, BoundaryEvent and label -> Process', inject(function (elementRegistry) {
|
||||
it('attach/move SubProcess, BoundaryEvent and label -> Process', inject(function(elementRegistry) {
|
||||
// when
|
||||
var subProcess = elementRegistry.get('SubProcess_1'),
|
||||
boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
|
|
|
@ -66,12 +66,12 @@ describe('features - BPMN search provider', function() {
|
|||
|
||||
// then
|
||||
expect(elements[0].primaryTokens).to.eql([
|
||||
{ normal: 'has matched ID'}
|
||||
{ normal: 'has matched ID' }
|
||||
]);
|
||||
expect(elements[0].secondaryTokens).to.eql([
|
||||
{ normal: 'some_'},
|
||||
{ matched: 'DataStore'},
|
||||
{ normal: '_123456_id'},
|
||||
{ normal: 'some_' },
|
||||
{ matched: 'DataStore' },
|
||||
{ normal: '_123456_id' }
|
||||
]);
|
||||
}));
|
||||
|
||||
|
@ -99,7 +99,7 @@ describe('features - BPMN search provider', function() {
|
|||
|
||||
// then
|
||||
expect(elements[0].primaryTokens).to.eql([
|
||||
{ matched: 'all matched'}
|
||||
{ matched: 'all matched' }
|
||||
]);
|
||||
}));
|
||||
|
||||
|
@ -113,8 +113,8 @@ describe('features - BPMN search provider', function() {
|
|||
|
||||
// then
|
||||
expect(elements[0].primaryTokens).to.eql([
|
||||
{ matched: 'before'},
|
||||
{ normal: ' 321'}
|
||||
{ matched: 'before' },
|
||||
{ normal: ' 321' }
|
||||
]);
|
||||
}));
|
||||
|
||||
|
@ -128,9 +128,9 @@ describe('features - BPMN search provider', function() {
|
|||
|
||||
// then
|
||||
expect(elements[0].primaryTokens).to.eql([
|
||||
{ normal: '123 '},
|
||||
{ matched: 'middle'},
|
||||
{ normal: ' 321'}
|
||||
{ normal: '123 ' },
|
||||
{ matched: 'middle' },
|
||||
{ normal: ' 321' }
|
||||
]);
|
||||
}));
|
||||
|
||||
|
@ -144,8 +144,8 @@ describe('features - BPMN search provider', function() {
|
|||
|
||||
// then
|
||||
expect(elements[0].primaryTokens).to.eql([
|
||||
{ normal: '123 '},
|
||||
{ matched: 'after'}
|
||||
{ normal: '123 ' },
|
||||
{ matched: 'after' }
|
||||
]);
|
||||
}));
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
require('../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
@ -26,12 +26,13 @@ describe('features/snapping - BpmnSnapping', function() {
|
|||
moveModule
|
||||
];
|
||||
|
||||
|
||||
describe('on Boundary Events', function() {
|
||||
|
||||
var diagramXML = require('../../../fixtures/bpmn/collaboration/process.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||
beforeEach(bootstrapModeler(diagramXML, {
|
||||
modules: testModules
|
||||
}));
|
||||
|
||||
var task, intermediateThrowEvent;
|
||||
|
||||
|
@ -39,7 +40,7 @@ describe('features/snapping - BpmnSnapping', function() {
|
|||
task = elementRegistry.get('Task_1');
|
||||
|
||||
intermediateThrowEvent = elementFactory.createShape({
|
||||
type: 'bpmn:IntermediateThrowEvent',
|
||||
type: 'bpmn:IntermediateThrowEvent'
|
||||
});
|
||||
|
||||
dragging.setOptions({ manual: true });
|
||||
|
@ -49,46 +50,49 @@ describe('features/snapping - BpmnSnapping', function() {
|
|||
dragging.setOptions({ manual: false });
|
||||
}));
|
||||
|
||||
|
||||
it('should snap on create to the bottom',
|
||||
inject(function(canvas, create, dragging, elementRegistry) {
|
||||
inject(function(canvas, create, dragging, elementRegistry) {
|
||||
|
||||
// given
|
||||
var taskGfx = canvas.getGraphics(task);
|
||||
// given
|
||||
var taskGfx = canvas.getGraphics(task);
|
||||
|
||||
// when
|
||||
create.start(canvasEvent({ x: 0, y: 0 }), intermediateThrowEvent);
|
||||
// when
|
||||
create.start(canvasEvent({ x: 0, y: 0 }), intermediateThrowEvent);
|
||||
|
||||
dragging.hover({ element: task, gfx: taskGfx });
|
||||
dragging.hover({ element: task, gfx: taskGfx });
|
||||
|
||||
dragging.move(canvasEvent({ x: 382, y: 170 }));
|
||||
dragging.end();
|
||||
dragging.move(canvasEvent({ x: 382, y: 170 }));
|
||||
dragging.end();
|
||||
|
||||
var boundaryEvent = elementRegistry.get(task.attachers[0].id);
|
||||
var boundaryEvent = elementRegistry.get(task.attachers[0].id);
|
||||
|
||||
// then
|
||||
expect(boundaryEvent).to.have.bounds({ x: 364, y: 167, width: 36, height: 36 });
|
||||
}));
|
||||
// then
|
||||
expect(boundaryEvent).to.have.bounds({ x: 364, y: 167, width: 36, height: 36 });
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should snap on create to the left',
|
||||
inject(function(canvas, create, dragging, elementRegistry) {
|
||||
inject(function(canvas, create, dragging, elementRegistry) {
|
||||
|
||||
// given
|
||||
var taskGfx = canvas.getGraphics(task);
|
||||
// given
|
||||
var taskGfx = canvas.getGraphics(task);
|
||||
|
||||
// when
|
||||
create.start(canvasEvent({ x: 0, y: 0 }), intermediateThrowEvent);
|
||||
// when
|
||||
create.start(canvasEvent({ x: 0, y: 0 }), intermediateThrowEvent);
|
||||
|
||||
dragging.hover({ element: task, gfx: taskGfx });
|
||||
dragging.hover({ element: task, gfx: taskGfx });
|
||||
|
||||
dragging.move(canvasEvent({ x: 382, y: 115 }));
|
||||
dragging.end();
|
||||
dragging.move(canvasEvent({ x: 382, y: 115 }));
|
||||
dragging.end();
|
||||
|
||||
var boundaryEvent = elementRegistry.get(task.attachers[0].id);
|
||||
var boundaryEvent = elementRegistry.get(task.attachers[0].id);
|
||||
|
||||
// then
|
||||
expect(boundaryEvent).to.have.bounds({ x: 364, y: 87, width: 36, height: 36 });
|
||||
}));
|
||||
// then
|
||||
expect(boundaryEvent).to.have.bounds({ x: 364, y: 87, width: 36, height: 36 });
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
@ -99,7 +103,9 @@ describe('features/snapping - BpmnSnapping', function() {
|
|||
|
||||
var diagramXML = require('../../../fixtures/bpmn/collaboration/process.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||
beforeEach(bootstrapModeler(diagramXML, {
|
||||
modules: testModules
|
||||
}));
|
||||
|
||||
beforeEach(inject(function(dragging) {
|
||||
dragging.setOptions({ manual: true });
|
||||
|
@ -107,49 +113,51 @@ describe('features/snapping - BpmnSnapping', function() {
|
|||
|
||||
|
||||
it('should snap to process children bounds / top left',
|
||||
inject(function(canvas, create, dragging, elementFactory) {
|
||||
inject(function(canvas, create, dragging, elementFactory) {
|
||||
|
||||
// given
|
||||
var participantShape = elementFactory.createParticipantShape(false),
|
||||
rootElement = canvas.getRootElement(),
|
||||
rootGfx = canvas.getGraphics(rootElement);
|
||||
// given
|
||||
var participantShape = elementFactory.createParticipantShape(false),
|
||||
rootElement = canvas.getRootElement(),
|
||||
rootGfx = canvas.getGraphics(rootElement);
|
||||
|
||||
// when
|
||||
create.start(canvasEvent({ x: 50, y: 50 }), participantShape);
|
||||
// when
|
||||
create.start(canvasEvent({ x: 50, y: 50 }), participantShape);
|
||||
|
||||
dragging.hover({ element: rootElement, gfx: rootGfx });
|
||||
dragging.hover({ element: rootElement, gfx: rootGfx });
|
||||
|
||||
dragging.move(canvasEvent({ x: 65, y: 65 }));
|
||||
dragging.end(canvasEvent({ x: 65, y: 65 }));
|
||||
dragging.move(canvasEvent({ x: 65, y: 65 }));
|
||||
dragging.end(canvasEvent({ x: 65, y: 65 }));
|
||||
|
||||
// then
|
||||
expect(participantShape).to.have.bounds({
|
||||
width: 600, height: 250, x: 18, y: -8
|
||||
});
|
||||
}));
|
||||
// then
|
||||
expect(participantShape).to.have.bounds({
|
||||
width: 600, height: 250, x: 18, y: -8
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should snap to process children bounds / bottom right',
|
||||
inject(function(canvas, create, dragging, elementFactory) {
|
||||
inject(function(canvas, create, dragging, elementFactory) {
|
||||
|
||||
// given
|
||||
var participantShape = elementFactory.createParticipantShape(false),
|
||||
rootElement = canvas.getRootElement(),
|
||||
rootGfx = canvas.getGraphics(rootElement);
|
||||
// given
|
||||
var participantShape = elementFactory.createParticipantShape(false),
|
||||
rootElement = canvas.getRootElement(),
|
||||
rootGfx = canvas.getGraphics(rootElement);
|
||||
|
||||
// when
|
||||
create.start(canvasEvent({ x: 50, y: 50 }), participantShape);
|
||||
// when
|
||||
create.start(canvasEvent({ x: 50, y: 50 }), participantShape);
|
||||
|
||||
dragging.hover({ element: rootElement, gfx: rootGfx });
|
||||
dragging.hover({ element: rootElement, gfx: rootGfx });
|
||||
|
||||
dragging.move(canvasEvent({ x: 400, y: 400 }));
|
||||
dragging.end(canvasEvent({ x: 400, y: 400 }));
|
||||
dragging.move(canvasEvent({ x: 400, y: 400 }));
|
||||
dragging.end(canvasEvent({ x: 400, y: 400 }));
|
||||
|
||||
// then
|
||||
expect(participantShape).to.have.bounds({
|
||||
width: 600, height: 250, x: 100, y: 52
|
||||
});
|
||||
}));
|
||||
// then
|
||||
expect(participantShape).to.have.bounds({
|
||||
width: 600, height: 250, x: 100, y: 52
|
||||
});
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
@ -158,7 +166,9 @@ describe('features/snapping - BpmnSnapping', function() {
|
|||
|
||||
var diagramXML = require('../../../fixtures/bpmn/collaboration/process-empty.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||
beforeEach(bootstrapModeler(diagramXML, {
|
||||
modules: testModules
|
||||
}));
|
||||
|
||||
|
||||
beforeEach(inject(function(dragging) {
|
||||
|
@ -194,8 +204,9 @@ describe('features/snapping - BpmnSnapping', function() {
|
|||
|
||||
var diagramXML = require('../../../fixtures/bpmn/collaboration/collaboration-participant.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, {
|
||||
modules: testModules
|
||||
}));
|
||||
|
||||
beforeEach(inject(function(dragging) {
|
||||
dragging.setOptions({ manual: true });
|
||||
|
@ -228,7 +239,7 @@ describe('features/snapping - BpmnSnapping', function() {
|
|||
});
|
||||
|
||||
|
||||
describe('on Participant resize', function () {
|
||||
describe('on Participant resize', function() {
|
||||
|
||||
describe('snap min bounds', function() {
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('test/TestHelper');
|
||||
require('test/TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
if (window.__env__ && window.__env__.TRANSLATIONS === 'enabled') {
|
||||
// skipping during translation extraction
|
||||
return;
|
||||
}
|
||||
// skipping this file during translation extraction
|
||||
var skip = window.__env__ && window.__env__.TRANSLATIONS === 'enabled';
|
||||
|
||||
require('test/TestHelper');
|
||||
|
||||
|
@ -19,7 +17,7 @@ var coreModule = require('lib/core'),
|
|||
var diagramXML = require('test/fixtures/bpmn/simple.bpmn');
|
||||
|
||||
|
||||
describe('i18n - translate', function() {
|
||||
skip ? describe.only : describe('i18n - translate', function() {
|
||||
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, {
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../TestHelper');
|
||||
|
||||
/* global bootstrapViewer, inject */
|
||||
require('../../TestHelper');
|
||||
|
||||
|
||||
var TestContainer = require('mocha-test-container-support');
|
||||
|
@ -262,11 +260,11 @@ describe('import - Importer', function() {
|
|||
|
||||
// then
|
||||
expect(events).to.eql([
|
||||
{ type: 'add', semantic: 'Process_1', di: 'BPMNPlane_1', diagramElement: 'Process_1'},
|
||||
{ type: 'add', semantic: 'Task_1', di: '_BPMNShape_Task_2', diagramElement: 'Task_1'},
|
||||
{ type: 'add', semantic: 'Task_2', di: '_BPMNShape_Task_3', diagramElement: 'Task_2'},
|
||||
{ type: 'add', semantic: 'BoundaryEvent_1', di: '_BPMNShape_BoundaryEvent_2', diagramElement: 'BoundaryEvent_1'},
|
||||
{ type: 'add', semantic: 'SequenceFlow_1', di: 'BPMNEdge_SequenceFlow_1', diagramElement: 'SequenceFlow_1'}
|
||||
{ type: 'add', semantic: 'Process_1', di: 'BPMNPlane_1', diagramElement: 'Process_1' },
|
||||
{ type: 'add', semantic: 'Task_1', di: '_BPMNShape_Task_2', diagramElement: 'Task_1' },
|
||||
{ type: 'add', semantic: 'Task_2', di: '_BPMNShape_Task_3', diagramElement: 'Task_2' },
|
||||
{ type: 'add', semantic: 'BoundaryEvent_1', di: '_BPMNShape_BoundaryEvent_2', diagramElement: 'BoundaryEvent_1' },
|
||||
{ type: 'add', semantic: 'SequenceFlow_1', di: 'BPMNEdge_SequenceFlow_1', diagramElement: 'SequenceFlow_1' }
|
||||
]);
|
||||
|
||||
done(err);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../TestHelper');
|
||||
require('../../TestHelper');
|
||||
|
||||
/* global bootstrapViewer, inject */
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
require('../../../TestHelper');
|
||||
|
||||
/* global bootstrapViewer, inject */
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
require('../../../TestHelper');
|
||||
|
||||
/* global bootstrapViewer, inject */
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
require('../../../TestHelper');
|
||||
|
||||
/* global bootstrapViewer, inject */
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ CustomRules.$inject = [ 'eventBus' ];
|
|||
|
||||
inherits(CustomRules, RuleProvider);
|
||||
|
||||
CustomRules.prototype.init = function () {
|
||||
CustomRules.prototype.init = function() {
|
||||
// placeholder
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue