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
|
||||
|
|
15
Gruntfile.js
15
Gruntfile.js
|
@ -22,12 +22,19 @@ module.exports = function(grunt) {
|
|||
dist: '../bower-bpmn-js/dist'
|
||||
},
|
||||
|
||||
jshint: {
|
||||
eslint: {
|
||||
check: {
|
||||
src: [
|
||||
['<%=config.sources %>']
|
||||
'{lib,test}/**/*.js'
|
||||
]
|
||||
},
|
||||
fix: {
|
||||
src: [
|
||||
'{lib,test}/**/*.js'
|
||||
],
|
||||
options: {
|
||||
jshintrc: true
|
||||
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'
|
||||
]);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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 = [
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,11 +1,12 @@
|
|||
'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() {
|
||||
function TranslationReporter() {
|
||||
process.env.TRANSLATIONS = 'enabled';
|
||||
|
||||
var outputFile = path.join(__dirname, '../../docs/translations.json');
|
||||
|
@ -35,13 +36,13 @@ var TranslationReporter = function() {
|
|||
};
|
||||
|
||||
|
||||
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 ]
|
||||
|
|
|
@ -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() {
|
||||
|
||||
|
@ -128,7 +128,8 @@ describe('custom elements', function() {
|
|||
|
||||
// then
|
||||
expect(triangle.parent).to.equal(circle);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should update the custom shape properties',
|
||||
|
@ -149,7 +150,8 @@ describe('custom elements', function() {
|
|||
// 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',
|
||||
|
@ -173,7 +175,8 @@ describe('custom elements', function() {
|
|||
// then
|
||||
expect(connection.type).to.equal('bpmn:Association');
|
||||
expect(connection.source).to.equal(subProcess);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
@ -213,7 +216,8 @@ describe('custom elements', function() {
|
|||
|
||||
// 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');
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../TestHelper');
|
||||
require('../../TestHelper');
|
||||
|
||||
var coreModule = require('../../../lib/core'),
|
||||
rendererModule = require('../../../lib/draw');
|
||||
|
@ -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,7 +141,9 @@ describe('features/auto-resize', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('should undo resizing', inject(function(modeling, commandStack) {
|
||||
describe('undo / redo support', function() {
|
||||
|
||||
it('should undo', inject(function(modeling, commandStack) {
|
||||
|
||||
// when
|
||||
modeling.moveElements([ startEventShape ], { x: -100, y: -100 }, participantShape);
|
||||
|
@ -155,7 +154,7 @@ describe('features/auto-resize', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('should redo resizing', inject(function(modeling, commandStack) {
|
||||
it('should redo', inject(function(modeling, commandStack) {
|
||||
|
||||
// when
|
||||
modeling.moveElements([ startEventShape ], { x: -100, y: -100 }, participantShape);
|
||||
|
@ -168,6 +167,8 @@ describe('features/auto-resize', function() {
|
|||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('after moving multiple elements', function() {
|
||||
|
||||
|
@ -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) {
|
||||
|
||||
|
@ -242,7 +243,8 @@ describe('features/auto-resize', function() {
|
|||
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 });
|
||||
}));
|
||||
|
||||
|
||||
|
@ -390,7 +392,8 @@ describe('features/auto-resize', function() {
|
|||
var expectedBounds = assign(originalBounds, { width: 552 });
|
||||
|
||||
expect(subProcessShape).to.have.bounds(expectedBounds);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should not auto-resize after dropping selection outside',
|
||||
|
@ -420,10 +423,12 @@ describe('features/auto-resize', function() {
|
|||
|
||||
// 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,7 +61,7 @@ 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() {
|
||||
|
@ -75,7 +75,8 @@ describe('features - context-pad', function() {
|
|||
|
||||
// then
|
||||
expect(deleteAction(element)).to.exist;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should NOT include delete action when rule returns false',
|
||||
|
@ -93,7 +94,8 @@ describe('features - context-pad', function() {
|
|||
|
||||
// then
|
||||
expect(deleteAction(element)).to.not.exist;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should call rules with [ element ]', inject(function(elementRegistry, contextPad, customRules) {
|
||||
|
@ -131,7 +133,8 @@ describe('features - context-pad', function() {
|
|||
|
||||
// then
|
||||
expect(deleteAction(element)).to.exist;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should NOT include delete action when [ ] is returned from rule',
|
||||
|
@ -149,7 +152,8 @@ describe('features - context-pad', function() {
|
|||
|
||||
// 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
|
||||
|
@ -328,7 +332,8 @@ describe('features - context-pad', function() {
|
|||
|
||||
// then
|
||||
expect(padEntry(padNode, 'replace')).not.to.exist;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should include control if replacement is allowed',
|
||||
|
@ -349,7 +354,8 @@ describe('features - context-pad', function() {
|
|||
|
||||
// then
|
||||
expect(padEntry(padNode, 'replace')).to.exist;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
|
|
@ -27,7 +27,398 @@ describe('features/copy-paste', function() {
|
|||
collaborationAssociations = require('../../../fixtures/bpmn/features/copy-paste/data-associations.bpmn');
|
||||
|
||||
|
||||
function integrationTest(ids) {
|
||||
describe('basic diagram', function() {
|
||||
|
||||
beforeEach(bootstrapModeler(basicXML, { modules: testModules }));
|
||||
|
||||
|
||||
describe('copy', function() {
|
||||
|
||||
it('selected elements', inject(function(elementRegistry, copyPaste) {
|
||||
|
||||
// given
|
||||
var subProcess,
|
||||
startEvent,
|
||||
boundaryEvent,
|
||||
textAnnotation;
|
||||
|
||||
// when
|
||||
var tree = copy([ 'SubProcess_1kd6ist' ]);
|
||||
|
||||
startEvent = tree.getElement('StartEvent_1');
|
||||
boundaryEvent = tree.getElement('BoundaryEvent_1c94bi9');
|
||||
subProcess = tree.getElement('SubProcess_1kd6ist');
|
||||
textAnnotation = tree.getElement('TextAnnotation_0h1hhgg');
|
||||
|
||||
// then
|
||||
expect(tree.getLength()).to.equal(3);
|
||||
|
||||
expect(tree.getDepthLength(0)).to.equal(1);
|
||||
expect(tree.getDepthLength(1)).to.equal(3);
|
||||
expect(tree.getDepthLength(2)).to.equal(15);
|
||||
|
||||
expect(subProcess.isExpanded).to.be.true;
|
||||
expect(startEvent.name).to.equal('hello');
|
||||
expect(textAnnotation.text).to.equal('foo');
|
||||
expect(boundaryEvent.eventDefinitions).to.contain('bpmn:TimerEventDefinition');
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('integration', 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 ]);
|
||||
|
||||
copyPaste.paste({
|
||||
element: rootElement,
|
||||
point: {
|
||||
x: 1100,
|
||||
y: 250
|
||||
}
|
||||
});
|
||||
|
||||
newStrtEvt = elementRegistry.filter(function(element) {
|
||||
return element.parent === rootElement && element.type === 'bpmn:StartEvent';
|
||||
})[0];
|
||||
|
||||
newSeqFlow = elementRegistry.filter(function(element) {
|
||||
return element.parent === rootElement && element.type === 'bpmn:SequenceFlow';
|
||||
})[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);
|
||||
|
||||
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);
|
||||
|
||||
modeling.removeElements([ subProcess ]);
|
||||
|
||||
copyPaste.paste({
|
||||
element: rootElement,
|
||||
point: {
|
||||
x: 1100,
|
||||
y: 250
|
||||
}
|
||||
});
|
||||
|
||||
task = elementRegistry.filter(function(element) {
|
||||
return element.type === 'bpmn:Task';
|
||||
})[0];
|
||||
|
||||
defaultFlow = elementRegistry.filter(function(element) {
|
||||
return !!(element.type === 'bpmn:SequenceFlow' && task.businessObject.default.id === element.id);
|
||||
})[0];
|
||||
|
||||
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);
|
||||
|
||||
modeling.removeElements([ subProcess ]);
|
||||
|
||||
copyPaste.paste({
|
||||
element: rootElement,
|
||||
point: {
|
||||
x: 1100,
|
||||
y: 250
|
||||
}
|
||||
});
|
||||
|
||||
subProcess = elementRegistry.filter(function(element) {
|
||||
return !!(element.id !== 'SubProcess_1kd6ist' && element.type === 'bpmn:SubProcess');
|
||||
})[0];
|
||||
|
||||
loopCharacteristics = subProcess.businessObject.loopCharacteristics;
|
||||
|
||||
expect(loopCharacteristics.$type).to.equal('bpmn:MultiInstanceLoopCharacteristics');
|
||||
expect(loopCharacteristics.isSequential).to.be.true;
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('selected elements', inject(integrationTest([ 'SubProcess_1kd6ist' ])));
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('rules', function() {
|
||||
|
||||
it('disallow individual boundary events copying', inject(function(copyPaste, elementRegistry, canvas) {
|
||||
|
||||
var boundaryEventA = elementRegistry.get('BoundaryEvent_1404oxd'),
|
||||
boundaryEventB = elementRegistry.get('BoundaryEvent_1c94bi9');
|
||||
|
||||
// when
|
||||
var tree = copy([ boundaryEventA, boundaryEventB ]);
|
||||
|
||||
expect(tree.getLength()).to.equal(0);
|
||||
}));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('basic collaboration', function() {
|
||||
|
||||
beforeEach(bootstrapModeler(collaborationXML, { modules: testModules }));
|
||||
|
||||
|
||||
describe('integration', function() {
|
||||
|
||||
it('participant with including lanes + elements', inject(integrationTest([ 'Participant_0uu1rvj' ])));
|
||||
|
||||
it('collapsed pool', inject(integrationTest([ 'Participant_145muai' ])));
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('rules', function() {
|
||||
|
||||
it('disallow individual lanes copying', inject(function(copyPaste, elementRegistry, canvas) {
|
||||
|
||||
// when
|
||||
var tree = copy([ 'Lane_13h648l', 'Lane_1gl63sa' ]);
|
||||
|
||||
// then
|
||||
expect(tree.getLength()).to.equal(0);
|
||||
}));
|
||||
|
||||
|
||||
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 pasteRejected = sinon.spy(function() {});
|
||||
|
||||
// when
|
||||
var tree = copy([ 'Task_13xbgyg', 'Participant_145muai' ]);
|
||||
|
||||
// then
|
||||
expect(tree.getDepthLength(0)).to.equal(2);
|
||||
|
||||
// when
|
||||
eventBus.on('elements.paste.rejected', pasteRejected);
|
||||
|
||||
copyPaste.paste({
|
||||
element: collaboration,
|
||||
point: {
|
||||
x: 1000,
|
||||
y: 1000
|
||||
}
|
||||
});
|
||||
|
||||
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 pasteRejected = sinon.spy(function() {});
|
||||
|
||||
// when
|
||||
copyPaste.copy([ participant ]);
|
||||
|
||||
modeling.removeElements([ participant, otherParticipant ]);
|
||||
|
||||
rootElement = canvas.getRootElement();
|
||||
|
||||
modeling.createShape(startEvent, { x: 50, y: 50 }, rootElement);
|
||||
|
||||
eventBus.on('elements.paste.rejected', pasteRejected);
|
||||
|
||||
copyPaste.paste({
|
||||
element: rootElement,
|
||||
point: {
|
||||
x: 500,
|
||||
y: 200
|
||||
}
|
||||
});
|
||||
|
||||
expect(pasteRejected).to.have.been.called;
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('complex collaboration', function() {
|
||||
|
||||
beforeEach(bootstrapModeler(collaborationMultipleXML, { modules: testModules }));
|
||||
|
||||
describe('basics', function() {
|
||||
|
||||
it('pasting on a lane', inject(function(elementRegistry, copyPaste) {
|
||||
|
||||
// given
|
||||
var lane = elementRegistry.get('Lane_0aws6ii'),
|
||||
task = elementRegistry.get('Task_1pamrp2'),
|
||||
participant = elementRegistry.get('Participant_1id96b4');
|
||||
|
||||
// when
|
||||
copyPaste.copy([ task ]);
|
||||
|
||||
copyPaste.paste({
|
||||
element: lane,
|
||||
point: {
|
||||
x: 400,
|
||||
y: 450
|
||||
}
|
||||
});
|
||||
|
||||
// then
|
||||
expect(lane.children).to.be.empty;
|
||||
expect(lane.businessObject.flowNodeRef).to.have.length(2);
|
||||
|
||||
expect(participant.children).to.have.length(10);
|
||||
}));
|
||||
|
||||
|
||||
it('pasting on a nested lane', inject(function(elementRegistry, copyPaste) {
|
||||
// given
|
||||
var lane = elementRegistry.get('Lane_1yo0kyz'),
|
||||
task = elementRegistry.get('Task_0n0k2nj'),
|
||||
participant = elementRegistry.get('Participant_0pgdgt4');
|
||||
|
||||
// when
|
||||
copyPaste.copy([ task ]);
|
||||
|
||||
copyPaste.paste({
|
||||
element: lane,
|
||||
point: {
|
||||
x: 200,
|
||||
y: 75
|
||||
}
|
||||
});
|
||||
|
||||
// then
|
||||
expect(lane.children).to.be.empty;
|
||||
expect(lane.businessObject.flowNodeRef).to.have.length(2);
|
||||
|
||||
expect(lane.parent.children).to.have.length(2);
|
||||
expect(participant.children).to.have.length(5);
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('integration', function() {
|
||||
|
||||
it('multiple participants', inject(integrationTest([ 'Participant_0pgdgt4', 'Participant_1id96b4' ])));
|
||||
|
||||
it('multiple participants', inject(integrationTest([ 'Participant_0pgdgt4', 'Participant_1id96b4' ])));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('participants', function() {
|
||||
|
||||
beforeEach(bootstrapModeler(collaborationAssociations, { modules: testModules }));
|
||||
|
||||
|
||||
it('copying participant should copy process as well', inject(function(elementRegistry, copyPaste, canvas) {
|
||||
|
||||
// given
|
||||
var participants = map([ 'Participant_Input', 'Participant_Output' ], function(e) {
|
||||
return elementRegistry.get(e);
|
||||
});
|
||||
var rootElement = canvas.getRootElement();
|
||||
|
||||
// when
|
||||
copyPaste.copy(participants);
|
||||
|
||||
copyPaste.paste({
|
||||
element: rootElement,
|
||||
point: {
|
||||
x: 4000,
|
||||
y: 4500
|
||||
}
|
||||
});
|
||||
|
||||
// then
|
||||
var elements = elementRegistry.filter(function(element) {
|
||||
return element.type === 'bpmn:Participant';
|
||||
});
|
||||
|
||||
var processIds = map(elements, function(e) {
|
||||
return e.businessObject.processRef.id;
|
||||
});
|
||||
|
||||
expect(uniq(processIds)).to.have.length(4);
|
||||
}));
|
||||
|
||||
|
||||
it('participant with OutputDataAssociation', inject(integrationTest([ 'Participant_Output' ])));
|
||||
|
||||
|
||||
it('participant with InputDataAssociation', inject(integrationTest([ 'Participant_Input' ])));
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
////// test helpers //////////////////////////////////////////////////
|
||||
|
||||
|
||||
function integrationTest(ids) {
|
||||
|
||||
return function(canvas, elementRegistry, modeling, copyPaste, commandStack) {
|
||||
// given
|
||||
var shapes = elementRegistry.getAll(),
|
||||
|
@ -104,385 +495,7 @@ describe('features/copy-paste', function() {
|
|||
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) {
|
||||
|
||||
// given
|
||||
var subProcess,
|
||||
startEvent,
|
||||
boundaryEvent,
|
||||
textAnnotation,
|
||||
conditionalFlow,
|
||||
defaultFlow;
|
||||
|
||||
// when
|
||||
var tree = copy([ 'SubProcess_1kd6ist' ]);
|
||||
|
||||
startEvent = tree.getElement('StartEvent_1');
|
||||
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);
|
||||
|
||||
expect(tree.getDepthLength(0)).to.equal(1);
|
||||
expect(tree.getDepthLength(1)).to.equal(3);
|
||||
expect(tree.getDepthLength(2)).to.equal(15);
|
||||
|
||||
expect(subProcess.isExpanded).to.be.true;
|
||||
expect(startEvent.name).to.equal('hello');
|
||||
expect(textAnnotation.text).to.equal('foo');
|
||||
expect(boundaryEvent.eventDefinitions).to.contain('bpmn:TimerEventDefinition');
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('integration', 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 ]);
|
||||
|
||||
copyPaste.paste({
|
||||
element: rootElement,
|
||||
point: {
|
||||
x: 1100,
|
||||
y: 250
|
||||
}
|
||||
});
|
||||
|
||||
newStrtEvt = elementRegistry.filter(function(element) {
|
||||
return element.parent === rootElement && element.type === 'bpmn:StartEvent';
|
||||
})[0];
|
||||
|
||||
newSeqFlow = elementRegistry.filter(function(element) {
|
||||
return element.parent === rootElement && element.type === 'bpmn:SequenceFlow';
|
||||
})[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);
|
||||
|
||||
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);
|
||||
|
||||
modeling.removeElements([ subProcess ]);
|
||||
|
||||
copyPaste.paste({
|
||||
element: rootElement,
|
||||
point: {
|
||||
x: 1100,
|
||||
y: 250
|
||||
}
|
||||
});
|
||||
|
||||
task = elementRegistry.filter(function(element) {
|
||||
return element.type === 'bpmn:Task';
|
||||
})[0];
|
||||
|
||||
defaultFlow = elementRegistry.filter(function(element) {
|
||||
return !!(element.type === 'bpmn:SequenceFlow' && task.businessObject.default.id === element.id);
|
||||
})[0];
|
||||
|
||||
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);
|
||||
|
||||
modeling.removeElements([ subProcess ]);
|
||||
|
||||
copyPaste.paste({
|
||||
element: rootElement,
|
||||
point: {
|
||||
x: 1100,
|
||||
y: 250
|
||||
}
|
||||
});
|
||||
|
||||
subProcess = elementRegistry.filter(function(element) {
|
||||
return !!(element.id !== 'SubProcess_1kd6ist' && element.type === 'bpmn:SubProcess');
|
||||
})[0];
|
||||
|
||||
loopCharacteristics = subProcess.businessObject.loopCharacteristics;
|
||||
|
||||
expect(loopCharacteristics.$type).to.equal('bpmn:MultiInstanceLoopCharacteristics');
|
||||
expect(loopCharacteristics.isSequential).to.be.true;
|
||||
}));
|
||||
|
||||
|
||||
it('selected elements', inject(integrationTest([ 'SubProcess_1kd6ist' ])));
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('rules', function() {
|
||||
|
||||
it('disallow individual boundary events copying', inject(function(copyPaste, elementRegistry, canvas) {
|
||||
|
||||
var boundaryEventA = elementRegistry.get('BoundaryEvent_1404oxd'),
|
||||
boundaryEventB = elementRegistry.get('BoundaryEvent_1c94bi9');
|
||||
|
||||
// when
|
||||
var tree = copy([ boundaryEventA, boundaryEventB ]);
|
||||
|
||||
expect(tree.getLength()).to.equal(0);
|
||||
}));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('basic collaboration', function() {
|
||||
|
||||
beforeEach(bootstrapModeler(collaborationXML, { modules: testModules }));
|
||||
|
||||
describe('integration', function() {
|
||||
|
||||
it('participant with including lanes + elements', inject(integrationTest([ 'Participant_0uu1rvj' ])));
|
||||
|
||||
it('collapsed pool', inject(integrationTest([ 'Participant_145muai' ])));
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('rules', function () {
|
||||
|
||||
it('disallow individual lanes copying', inject(function(copyPaste, elementRegistry, canvas) {
|
||||
|
||||
// when
|
||||
var tree = copy([ 'Lane_13h648l', 'Lane_1gl63sa' ]);
|
||||
|
||||
// then
|
||||
expect(tree.getLength()).to.equal(0);
|
||||
}));
|
||||
|
||||
|
||||
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 pasteRejected = sinon.spy(function() {});
|
||||
|
||||
// when
|
||||
var tree = copy([ 'Task_13xbgyg', 'Participant_145muai' ]);
|
||||
|
||||
// then
|
||||
expect(tree.getDepthLength(0)).to.equal(2);
|
||||
|
||||
// when
|
||||
eventBus.on('elements.paste.rejected', pasteRejected);
|
||||
|
||||
copyPaste.paste({
|
||||
element: collaboration,
|
||||
point: {
|
||||
x: 1000,
|
||||
y: 1000
|
||||
}
|
||||
});
|
||||
|
||||
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 pasteRejected = sinon.spy(function() {});
|
||||
|
||||
// when
|
||||
copyPaste.copy([ participant ]);
|
||||
|
||||
modeling.removeElements([ participant, otherParticipant ]);
|
||||
|
||||
rootElement = canvas.getRootElement();
|
||||
|
||||
modeling.createShape(startEvent, { x: 50, y: 50 }, rootElement);
|
||||
|
||||
eventBus.on('elements.paste.rejected', pasteRejected);
|
||||
|
||||
copyPaste.paste({
|
||||
element: rootElement,
|
||||
point: {
|
||||
x: 500,
|
||||
y: 200
|
||||
}
|
||||
});
|
||||
|
||||
expect(pasteRejected).to.have.been.called;
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('complex collaboration', function() {
|
||||
|
||||
beforeEach(bootstrapModeler(collaborationMultipleXML, { modules: testModules }));
|
||||
|
||||
describe('basics', function() {
|
||||
|
||||
it('pasting on a lane', inject(function(elementRegistry, copyPaste) {
|
||||
// given
|
||||
var lane = elementRegistry.get('Lane_0aws6ii'),
|
||||
task = elementRegistry.get('Task_1pamrp2'),
|
||||
participant = elementRegistry.get('Participant_1id96b4');
|
||||
|
||||
// when
|
||||
copyPaste.copy([ task ]);
|
||||
|
||||
copyPaste.paste({
|
||||
element: lane,
|
||||
point: {
|
||||
x: 400,
|
||||
y: 450
|
||||
}
|
||||
});
|
||||
|
||||
// then
|
||||
expect(lane.children).to.be.empty;
|
||||
expect(lane.businessObject.flowNodeRef).to.have.length(2);
|
||||
|
||||
expect(participant.children).to.have.length(10);
|
||||
}));
|
||||
|
||||
|
||||
it('pasting on a nested lane', inject(function(elementRegistry, copyPaste) {
|
||||
// given
|
||||
var lane = elementRegistry.get('Lane_1yo0kyz'),
|
||||
task = elementRegistry.get('Task_0n0k2nj'),
|
||||
participant = elementRegistry.get('Participant_0pgdgt4');
|
||||
|
||||
// when
|
||||
copyPaste.copy([ task ]);
|
||||
|
||||
copyPaste.paste({
|
||||
element: lane,
|
||||
point: {
|
||||
x: 200,
|
||||
y: 75
|
||||
}
|
||||
});
|
||||
|
||||
// then
|
||||
expect(lane.children).to.be.empty;
|
||||
expect(lane.businessObject.flowNodeRef).to.have.length(2);
|
||||
|
||||
expect(lane.parent.children).to.have.length(2);
|
||||
expect(participant.children).to.have.length(5);
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('integration', function() {
|
||||
|
||||
it('multiple participants', inject(integrationTest([ 'Participant_0pgdgt4', 'Participant_1id96b4' ])));
|
||||
|
||||
it('multiple participants', inject(integrationTest([ 'Participant_0pgdgt4', 'Participant_1id96b4' ])));
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('participants', function() {
|
||||
|
||||
beforeEach(bootstrapModeler(collaborationAssociations, { modules: testModules }));
|
||||
|
||||
|
||||
it('copying participant should copy process as well', inject(function(elementRegistry, copyPaste, canvas) {
|
||||
// given
|
||||
var participants = map([ 'Participant_Input', 'Participant_Output' ], function (e) {
|
||||
return elementRegistry.get(e);
|
||||
});
|
||||
var rootElement = canvas.getRootElement();
|
||||
|
||||
// when
|
||||
copyPaste.copy(participants);
|
||||
|
||||
copyPaste.paste({
|
||||
element: rootElement,
|
||||
point: {
|
||||
x: 4000,
|
||||
y: 4500
|
||||
}
|
||||
});
|
||||
|
||||
// then
|
||||
var elements = elementRegistry.filter(function(element) {
|
||||
return element.type === 'bpmn:Participant';
|
||||
});
|
||||
|
||||
var processIds = map(elements, function (e) {
|
||||
return e.businessObject.processRef.id;
|
||||
});
|
||||
|
||||
expect(uniq(processIds)).to.have.length(4);
|
||||
}));
|
||||
|
||||
|
||||
it('participant with OutputDataAssociation', inject(integrationTest([ 'Participant_Output' ])));
|
||||
|
||||
|
||||
it('participant with InputDataAssociation', inject(integrationTest([ 'Participant_Input' ])));
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
||||
|
|
|
@ -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,6 +57,7 @@ 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'),
|
||||
|
@ -81,10 +82,12 @@ describe('features/modeling - move', function() {
|
|||
|
||||
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,6 +118,7 @@ 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'),
|
||||
|
@ -142,6 +146,7 @@ describe('features/modeling - move', function() {
|
|||
|
||||
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) {
|
||||
|
@ -103,7 +103,8 @@ describe('features/modeling - update label', function() {
|
|||
|
||||
// then
|
||||
expect(changedEvent.elements).to.include(startEvent_1);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should propertly fire events.changed after event label change',
|
||||
|
@ -124,6 +125,7 @@ describe('features/modeling - update label', function() {
|
|||
|
||||
// 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');
|
||||
|
||||
|
|
|
@ -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,7 +405,6 @@ describe('features/modeling - replace connection', function() {
|
|||
boundaryEvent = elementRegistry.get('BoundaryEvent_1'),
|
||||
connection = elementRegistry.get('SequenceFlow_1');
|
||||
|
||||
// given
|
||||
selection.select([ host, boundaryEvent, task ]);
|
||||
|
||||
// when
|
||||
|
@ -417,7 +430,9 @@ describe('features/modeling - replace connection', function() {
|
|||
|
||||
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) {
|
||||
|
||||
|
@ -54,7 +64,7 @@ describe('features/modeling - move start event behavior', function() {
|
|||
dragging.end();
|
||||
|
||||
var replacement = elementRegistry.filter(function(element) {
|
||||
if(is(element, 'bpmn:StartEvent') && element.parent === rootElement) {
|
||||
if (is(element, 'bpmn:StartEvent') && element.parent === rootElement) {
|
||||
return true;
|
||||
}
|
||||
})[0];
|
||||
|
@ -62,7 +72,8 @@ describe('features/modeling - move start event behavior', function() {
|
|||
// 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',
|
||||
|
@ -81,7 +92,7 @@ describe('features/modeling - move start event behavior', function() {
|
|||
dragging.end();
|
||||
|
||||
var replacements = elementRegistry.filter(function(element) {
|
||||
if(is(element, 'bpmn:StartEvent') && element.type !== 'label') {
|
||||
if (is(element, 'bpmn:StartEvent') && element.type !== 'label') {
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
@ -91,17 +102,22 @@ describe('features/modeling - move start event behavior', function() {
|
|||
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',
|
||||
|
@ -118,7 +134,8 @@ describe('features/modeling - move start event behavior', function() {
|
|||
// 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',
|
||||
|
@ -137,11 +154,13 @@ describe('features/modeling - move start event behavior', function() {
|
|||
// 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');
|
||||
|
@ -159,11 +178,13 @@ describe('features/modeling - move start event behavior', function() {
|
|||
// 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');
|
||||
|
@ -185,11 +206,13 @@ describe('features/modeling - move start event behavior', function() {
|
|||
// 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'),
|
||||
|
@ -210,11 +233,13 @@ describe('features/modeling - move start event behavior', function() {
|
|||
// 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'),
|
||||
|
@ -237,14 +262,17 @@ describe('features/modeling - move start event behavior', function() {
|
|||
// 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');
|
||||
|
@ -263,11 +291,13 @@ describe('features/modeling - move start event behavior', function() {
|
|||
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');
|
||||
|
@ -290,11 +320,13 @@ describe('features/modeling - move start event behavior', function() {
|
|||
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'),
|
||||
|
@ -321,11 +353,13 @@ describe('features/modeling - move start event behavior', function() {
|
|||
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'),
|
||||
|
@ -352,10 +386,13 @@ describe('features/modeling - move start event behavior', function() {
|
|||
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');
|
||||
|
@ -378,7 +415,8 @@ describe('features/modeling - move start event behavior', function() {
|
|||
|
||||
// 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 */
|
||||
|
||||
|
@ -95,6 +95,7 @@ describe('features/modeling - layout message flows', function() {
|
|||
{ 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 */
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
|
||||
var globalEvent = require('../../../util/MockEvents.js').createEvent;
|
||||
var globalEvent = require('../../../util/MockEvents').createEvent;
|
||||
|
||||
var coreModule = require('../../../../lib/core'),
|
||||
modelingModule = require('../../../../lib/features/modeling'),
|
||||
|
@ -65,7 +65,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
var openPopup = function(element, offset) {
|
||||
offset = offset || 100;
|
||||
|
||||
TestHelper.getBpmnJS().invoke(function(popupMenu){
|
||||
TestHelper.getBpmnJS().invoke(function(popupMenu) {
|
||||
|
||||
popupMenu.create('bpmn-replace', element);
|
||||
|
||||
|
@ -75,7 +75,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
};
|
||||
|
||||
|
||||
describe('toggle', function(){
|
||||
describe('toggle', function() {
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXMLMarkers, { modules: testModules }));
|
||||
|
||||
|
@ -88,7 +88,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
}));
|
||||
|
||||
|
||||
describe('active attribute', function(){
|
||||
describe('active attribute', function() {
|
||||
|
||||
it('should be true for parallel marker', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
||||
|
||||
|
@ -161,7 +161,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
});
|
||||
|
||||
|
||||
describe('exclusive toggle buttons', function(){
|
||||
describe('exclusive toggle buttons', function() {
|
||||
|
||||
it('should not toggle non exclusive buttons off', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
||||
var subProcess = elementRegistry.get('AdHocSubProcess');
|
||||
|
@ -184,7 +184,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
});
|
||||
|
||||
|
||||
describe('non exclusive toggle buttons', function(){
|
||||
describe('non exclusive toggle buttons', function() {
|
||||
|
||||
it('should not toggle exclusive buttons off',
|
||||
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
||||
|
@ -216,11 +216,13 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
expect(domClasses(parallelEntry).has('active')).to.be.true;
|
||||
expect(domClasses(adHocEntry).has('active')).to.be.true;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
describe('parallel toggle button', function(){
|
||||
|
||||
describe('parallel toggle button', function() {
|
||||
|
||||
it('should toggle parallel marker off',
|
||||
inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
||||
|
@ -242,7 +244,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
// then
|
||||
expect(task.businessObject.loopCharacteristics).not.to.exist;
|
||||
expect(domClasses(parallelEntry).has('active')).to.be.false;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should toggle parallel marker on', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
||||
|
@ -311,7 +314,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
});
|
||||
|
||||
describe('sequential toggle button', function(){
|
||||
|
||||
describe('sequential toggle button', function() {
|
||||
|
||||
it('should toggle sequential marker off', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
||||
|
||||
|
@ -401,7 +405,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
});
|
||||
|
||||
describe('loop toggle button', function(){
|
||||
|
||||
describe('loop toggle button', function() {
|
||||
|
||||
it('should toggle loop marker off', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
||||
|
||||
|
@ -425,7 +430,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('should toggle loop marker on', inject(function(popupMenu, bpmnReplace, elementRegistry){
|
||||
it('should toggle loop marker on', inject(function(popupMenu, bpmnReplace, elementRegistry) {
|
||||
|
||||
// given
|
||||
var task = elementRegistry.get('Task');
|
||||
|
@ -534,7 +539,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
expect(callActivity.businessObject.loopCharacteristics).to.exist;
|
||||
expect(callActivity.businessObject.loopCharacteristics.isSequential).to.be.true;
|
||||
expect(is(callActivity.businessObject.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.true;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should retain expanded status for sub processes',
|
||||
|
@ -553,7 +559,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(isExpanded(transaction)).to.equal(isExpanded(subProcess));
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should replace sub processes -> event sub process',
|
||||
|
@ -572,7 +579,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(eventSubProcess.businessObject.triggeredByEvent).to.be.true;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should retain the loop characteristics and the expanded status for transactions',
|
||||
|
@ -591,7 +599,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(isExpanded(subProcess)).to.equal(isExpanded(transaction));
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should not retain the loop characteristics morphing to an event sub process',
|
||||
|
@ -612,7 +621,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(isExpanded(subProcess)).to.equal(isExpanded(transaction));
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should retain the expanded property morphing to an event sub processes',
|
||||
|
@ -631,7 +641,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(isExpanded(eventSubProcess)).to.equal(isExpanded(transaction));
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
@ -655,7 +666,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
// then
|
||||
expect(queryEntry(popupMenu, 'replace-with-none-start')).to.be.null;
|
||||
expect(getEntries(popupMenu)).to.have.length(6);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should contain all start events inside event sub process except the current one',
|
||||
|
@ -672,7 +684,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
expect(queryEntry(popupMenu, 'replace-with-message-start')).to.exist;
|
||||
|
||||
expect(getEntries(popupMenu)).to.have.length(11);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should contain all non interrupting start events inside event sub process except the current one',
|
||||
|
@ -695,7 +708,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
expect(queryEntry(popupMenu, 'replace-with-non-interrupting-conditional-start')).to.be.null;
|
||||
|
||||
expect(getEntries(popupMenu)).to.have.length(11);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should contain all intermediate events except the current one',
|
||||
|
@ -711,7 +725,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
expect(queryEntry(popupMenu, 'replace-with-none-intermediate-throw')).to.be.null;
|
||||
|
||||
expect(getEntries(popupMenu)).to.have.length(12);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should contain all end events except the current one',
|
||||
|
@ -727,7 +742,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
expect(queryEntry(popupMenu, 'replace-with-none-end')).to.be.null;
|
||||
|
||||
expect(getEntries(popupMenu)).to.have.length(9);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
@ -749,12 +765,13 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(getEntries(popupMenu)).to.have.length(9);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should NOT contain cancel event replace option',
|
||||
|
||||
inject(function(elementRegistry, bpmnReplace, popupMenu, replaceMenuProvider) {
|
||||
|
||||
// given
|
||||
var endEvent = elementRegistry.get('EndEvent_2');
|
||||
|
||||
|
@ -763,7 +780,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(getEntries(popupMenu)).to.have.length(9);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should contain cancel event replace option (boundary events)',
|
||||
|
@ -777,7 +795,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(getEntries(popupMenu)).to.have.length(13);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should NOT contain cancel event replace option (boundary events)',
|
||||
|
@ -791,7 +810,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(getEntries(popupMenu)).to.have.length(13);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
@ -812,7 +832,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
// then
|
||||
expect(queryEntry(popupMenu, 'replace-with-conditional-intermediate-catch')).to.be.null;
|
||||
expect(getEntries(popupMenu)).to.have.length(12);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should contain all boundary events for a non interrupting boundary event',
|
||||
|
@ -827,7 +848,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
// then
|
||||
expect(queryEntry(popupMenu, 'replace-with-non-interrupting-message-intermediate-catch')).to.be.null;
|
||||
expect(getEntries(popupMenu)).to.have.length(12);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should contain compensation boundary event',
|
||||
|
@ -841,7 +863,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(queryEntry(popupMenu, 'replace-with-compensation-boundary')).to.exist;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
@ -850,7 +873,10 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
var diagramXML = require('./ReplaceMenuProvider.defaultFlows.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||
beforeEach(bootstrapModeler(diagramXML, {
|
||||
modules: testModules
|
||||
}));
|
||||
|
||||
|
||||
it('should show default replace option [gateway]', inject(function(elementRegistry, popupMenu) {
|
||||
// given
|
||||
|
@ -894,7 +920,10 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
var diagramXML = require('./ReplaceMenuProvider.defaultFlowsFromInclusiveGateways.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||
beforeEach(bootstrapModeler(diagramXML, {
|
||||
modules: testModules
|
||||
}));
|
||||
|
||||
|
||||
it('should show default replace option', inject(function(elementRegistry, popupMenu) {
|
||||
// given
|
||||
|
@ -934,7 +963,10 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
var diagramXML = require('./ReplaceMenuProvider.conditionalFlows.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||
beforeEach(bootstrapModeler(diagramXML, {
|
||||
modules: testModules
|
||||
}));
|
||||
|
||||
|
||||
it('should show ConditionalFlow replace option', inject(function(elementRegistry, popupMenu) {
|
||||
// given
|
||||
|
@ -1067,6 +1099,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
it('should morph DefaultFlow into a SequenceFlow [task] -> undo',
|
||||
inject(function(elementRegistry, popupMenu, commandStack) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_15f5knn'),
|
||||
entries;
|
||||
|
@ -1090,7 +1123,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(task.businessObject.default).to.equal(sequenceFlow.businessObject);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should morph DefaultFlow into a ConditionalFlow [task]', inject(function(elementRegistry, popupMenu) {
|
||||
|
@ -1119,6 +1153,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
it('should morph DefaultFlow into a ConditionalFlow [task] -> undo',
|
||||
inject(function(elementRegistry, popupMenu, commandStack) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_15f5knn'),
|
||||
task = elementRegistry.get('Task_1ei94kl'),
|
||||
|
@ -1141,11 +1176,13 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(task.businessObject.default).to.equal(sequenceFlow.businessObject);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should replace SequenceFlow with DefaultFlow [gateway] -> undo',
|
||||
inject(function(elementRegistry, popupMenu, commandStack) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
||||
gateway = elementRegistry.get('ExclusiveGateway_1');
|
||||
|
@ -1161,11 +1198,13 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(gateway.businessObject.default).to.not.exist;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should replace SequenceFlow with DefaultFlow [task] -> undo',
|
||||
inject(function(elementRegistry, popupMenu, commandStack) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_15f5knn');
|
||||
|
||||
|
@ -1182,7 +1221,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(task.businessObject.default).to.not.exist;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should only have one DefaultFlow', inject(function(elementRegistry, popupMenu) {
|
||||
|
@ -1216,6 +1256,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
it('should replace DefaultFlow with SequenceFlow when changing source',
|
||||
inject(function(elementRegistry, popupMenu, modeling) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_1'),
|
||||
task = elementRegistry.get('Task_2');
|
||||
|
@ -1236,11 +1277,13 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(gateway.businessObject.default).to.not.exist;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should replace DefaultFlow with SequenceFlow when changing source -> undo',
|
||||
inject(function(elementRegistry, popupMenu, modeling, commandStack) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_1'),
|
||||
task = elementRegistry.get('Task_2');
|
||||
|
@ -1263,19 +1306,22 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(gateway.businessObject.default).equal(sequenceFlow.businessObject);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
[
|
||||
'bpmn:StartEvent'
|
||||
].forEach(function(type) {
|
||||
|
||||
it('should replace DefaultFlow with SequenceFlow when changing target to ' + type,
|
||||
inject(function(elementRegistry, elementFactory, canvas, popupMenu, modeling) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_1'),
|
||||
root = canvas.getRootElement();
|
||||
|
||||
var intermediateEvent = elementFactory.createShape({ type: type});
|
||||
var intermediateEvent = elementFactory.createShape({ type: type });
|
||||
|
||||
modeling.createShape(intermediateEvent, { x: 686, y: 50 }, root);
|
||||
|
||||
|
@ -1295,7 +1341,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(gateway.businessObject.default).to.not.exist;
|
||||
}));
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
|
@ -1304,13 +1351,15 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
'bpmn:EndEvent',
|
||||
'bpmn:IntermediateThrowEvent'
|
||||
].forEach(function(type) {
|
||||
|
||||
it('should keep DefaultFlow when changing target to ' + type,
|
||||
inject(function(elementRegistry, elementFactory, canvas, popupMenu, modeling) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_1'),
|
||||
root = canvas.getRootElement();
|
||||
|
||||
var intermediateEvent = elementFactory.createShape({ type: type});
|
||||
var intermediateEvent = elementFactory.createShape({ type: type });
|
||||
|
||||
modeling.createShape(intermediateEvent, { x: 686, y: 50 }, root);
|
||||
|
||||
|
@ -1330,19 +1379,21 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(gateway.businessObject.default).to.exist;
|
||||
}));
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
it('should replace DefaultFlow with SequenceFlow when changing target -> undo',
|
||||
inject(function(elementRegistry, elementFactory, canvas, popupMenu, modeling, commandStack) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_1'),
|
||||
root = canvas.getRootElement();
|
||||
rootElement = canvas.getRootElement();
|
||||
|
||||
var intermediateEvent = elementFactory.createShape({ type: 'bpmn:StartEvent'});
|
||||
var intermediateEvent = elementFactory.createShape({ type: 'bpmn:StartEvent' });
|
||||
|
||||
modeling.createShape(intermediateEvent, { x: 686, y: 50 }, root);
|
||||
modeling.createShape(intermediateEvent, { x: 686, y: 50 }, rootElement);
|
||||
|
||||
openPopup(sequenceFlow);
|
||||
|
||||
|
@ -1362,7 +1413,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(gateway.businessObject.default).equal(sequenceFlow.businessObject);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should keep DefaultFlow when morphing Gateway', inject(function(elementRegistry, popupMenu, bpmnReplace) {
|
||||
|
@ -1377,7 +1429,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
triggerAction(entries, 'replace-with-default-flow');
|
||||
|
||||
var inclusiveGateway = bpmnReplace.replaceElement(exclusiveGateway, { type: 'bpmn:InclusiveGateway'});
|
||||
var inclusiveGateway = bpmnReplace.replaceElement(exclusiveGateway, { type: 'bpmn:InclusiveGateway' });
|
||||
|
||||
// then
|
||||
expect(inclusiveGateway.businessObject.default).to.equal(sequenceFlow.businessObject);
|
||||
|
@ -1399,7 +1451,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
replaceDefaultFlow.action();
|
||||
|
||||
var sendTask = bpmnReplace.replaceElement(task, { type: 'bpmn:SendTask'});
|
||||
var sendTask = bpmnReplace.replaceElement(task, { type: 'bpmn:SendTask' });
|
||||
|
||||
// then
|
||||
expect(sendTask.businessObject.default).to.equal(sequenceFlow.businessObject);
|
||||
|
@ -1408,6 +1460,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
it('should keep DefaultFlow when morphing Gateway -> undo',
|
||||
inject(function(elementRegistry, bpmnReplace, popupMenu, commandStack) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
||||
exclusiveGateway = elementRegistry.get('ExclusiveGateway_1');
|
||||
|
@ -1419,17 +1472,19 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
triggerAction(entries, 'replace-with-default-flow');
|
||||
|
||||
bpmnReplace.replaceElement(exclusiveGateway, { type: 'bpmn:InclusiveGateway'});
|
||||
bpmnReplace.replaceElement(exclusiveGateway, { type: 'bpmn:InclusiveGateway' });
|
||||
|
||||
commandStack.undo();
|
||||
|
||||
// then
|
||||
expect(exclusiveGateway.businessObject.default).to.equal(sequenceFlow.businessObject);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should remove any conditionExpression when morphing to DefaultFlow',
|
||||
inject(function(elementRegistry, modeling, popupMenu, moddle) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
||||
exclusiveGateway = elementRegistry.get('ExclusiveGateway_1');
|
||||
|
@ -1449,11 +1504,13 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
// then
|
||||
expect(exclusiveGateway.businessObject.default).to.equal(sequenceFlow.businessObject);
|
||||
expect(sequenceFlow.businessObject.conditionExpression).to.not.exist;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should remove any conditionExpression when morphing to DefaultFlow -> undo',
|
||||
inject(function(elementRegistry, modeling, popupMenu, moddle, commandStack) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
||||
exclusiveGateway = elementRegistry.get('ExclusiveGateway_1');
|
||||
|
@ -1475,7 +1532,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
// then
|
||||
expect(exclusiveGateway.businessObject.default).to.not.exist;
|
||||
expect(sequenceFlow.businessObject.conditionExpression).to.equal(conditionExpression);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
@ -1484,7 +1542,9 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
var diagramXML = require('./ReplaceMenuProvider.conditionalFlows.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||
beforeEach(bootstrapModeler(diagramXML, {
|
||||
modules: testModules
|
||||
}));
|
||||
|
||||
|
||||
it('should morph into a ConditionalFlow', inject(function(elementRegistry, popupMenu) {
|
||||
|
@ -1547,6 +1607,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
it('should replace ConditionalFlow with SequenceFlow when changing source',
|
||||
inject(function(elementRegistry, popupMenu, modeling) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
||||
startEvent = elementRegistry.get('StartEvent_1');
|
||||
|
@ -1566,11 +1627,13 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(sequenceFlow.businessObject.conditionExpression).to.not.exist;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should replace ConditionalFlow with SequenceFlow when changing source -> undo',
|
||||
inject(function(elementRegistry, popupMenu, modeling, commandStack) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
||||
startEvent = elementRegistry.get('StartEvent_1');
|
||||
|
@ -1592,14 +1655,17 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(sequenceFlow.businessObject.conditionExpression.$type).to.equal('bpmn:FormalExpression');
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
[
|
||||
'bpmn:StartEvent'
|
||||
].forEach(function(type) {
|
||||
|
||||
it('should replace ConditionalFlow with SequenceFlow when changing target to ' + type,
|
||||
inject(function(elementRegistry, elementFactory, canvas, popupMenu, modeling) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
||||
root = canvas.getRootElement(),
|
||||
|
@ -1621,7 +1687,9 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(sequenceFlow.businessObject.conditionExpression).to.not.exist;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
@ -1630,8 +1698,10 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
'bpmn:EndEvent',
|
||||
'bpmn:IntermediateThrowEvent'
|
||||
].forEach(function(type) {
|
||||
|
||||
it('should keep ConditionalFlow when changing target to ' + type,
|
||||
inject(function(elementRegistry, elementFactory, canvas, popupMenu, modeling) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
||||
root = canvas.getRootElement(),
|
||||
|
@ -1653,16 +1723,19 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(sequenceFlow.businessObject.conditionExpression).to.exist;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
||||
it('should replace ConditionalFlow with SequenceFlow when changing target -> undo',
|
||||
inject(function(elementRegistry, elementFactory, canvas, popupMenu, modeling, commandStack) {
|
||||
|
||||
// given
|
||||
var sequenceFlow = elementRegistry.get('SequenceFlow_3'),
|
||||
root = canvas.getRootElement(),
|
||||
intermediateEvent = elementFactory.createShape({ type: 'bpmn:StartEvent'});
|
||||
intermediateEvent = elementFactory.createShape({ type: 'bpmn:StartEvent' });
|
||||
|
||||
modeling.createShape(intermediateEvent, { x: 497, y: 197 }, root);
|
||||
|
||||
|
@ -1683,18 +1756,22 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(sequenceFlow.businessObject.conditionExpression.$type).to.equal('bpmn:FormalExpression');
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
describe('rules', function () {
|
||||
describe('rules', function() {
|
||||
|
||||
var diagramXML = require('../../../fixtures/bpmn/basic.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules.concat([ customRulesModule ]) }));
|
||||
beforeEach(bootstrapModeler(diagramXML, {
|
||||
modules: testModules.concat([ customRulesModule ])
|
||||
}));
|
||||
|
||||
|
||||
it('should get entries by default', inject(function(elementRegistry, popupMenu) {
|
||||
|
||||
|
@ -1717,7 +1794,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
// given
|
||||
var startEvent = elementRegistry.get('StartEvent_1');
|
||||
|
||||
customRules.addRule('shape.replace', function () {
|
||||
customRules.addRule('shape.replace', function() {
|
||||
return true;
|
||||
});
|
||||
|
||||
|
@ -1728,7 +1805,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(entries).to.have.length.above(0);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should get no entries when custom rule returns false',
|
||||
|
@ -1737,7 +1815,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
// given
|
||||
var startEvent = elementRegistry.get('StartEvent_1');
|
||||
|
||||
customRules.addRule('shape.replace', function () {
|
||||
customRules.addRule('shape.replace', function() {
|
||||
return false;
|
||||
});
|
||||
|
||||
|
@ -1748,7 +1826,8 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
|
||||
// then
|
||||
expect(entries).to.have.length(0);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should provide element to custom rules', inject(function(elementRegistry, popupMenu, customRules) {
|
||||
|
@ -1757,7 +1836,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
var startEvent = elementRegistry.get('StartEvent_1');
|
||||
var actual;
|
||||
|
||||
customRules.addRule('shape.replace', function (context) {
|
||||
customRules.addRule('shape.replace', function(context) {
|
||||
actual = context.element;
|
||||
});
|
||||
|
||||
|
@ -1775,7 +1854,7 @@ describe('features/popup-menu - replace menu provider', function() {
|
|||
var callCount = 0;
|
||||
var startEvent = elementRegistry.get('StartEvent_1');
|
||||
|
||||
customRules.addRule('shape.replace', function () {
|
||||
customRules.addRule('shape.replace', function() {
|
||||
callCount++;
|
||||
});
|
||||
|
||||
|
|
|
@ -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,7 +125,6 @@ describe('features/replace-preview', function() {
|
|||
var dragGroup = dragging.context().data.context.dragGroup;
|
||||
|
||||
expect(dragGroup[0].attr('display')).to.equal('none');
|
||||
|
||||
}));
|
||||
|
||||
|
||||
|
@ -151,8 +148,8 @@ describe('features/replace-preview', function() {
|
|||
});
|
||||
|
||||
expect(context.dragGroup[0].innerSVG()).to.equal(startEventGfx.innerSVG());
|
||||
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should replace non-interrupting start event while hover over root element',
|
||||
|
@ -168,8 +165,8 @@ describe('features/replace-preview', function() {
|
|||
var startEventGfx = getGfx({ type: 'bpmn:StartEvent' });
|
||||
|
||||
expect(context.dragGroup[1].innerSVG()).to.equal(startEventGfx.innerSVG());
|
||||
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should not replace non-interrupting start event while hover over another event sub process',
|
||||
|
@ -192,8 +189,8 @@ describe('features/replace-preview', function() {
|
|||
});
|
||||
|
||||
expect(context.dragGroup[0].innerSVG()).to.equal(startEventGfx.innerSVG());
|
||||
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should replace non-interrupting start event while hover over regular sub process',
|
||||
|
@ -212,8 +209,8 @@ describe('features/replace-preview', function() {
|
|||
var startEventGfx = getGfx({ type: 'bpmn:StartEvent' });
|
||||
|
||||
expect(context.dragGroup[1].innerSVG()).to.equal(startEventGfx.innerSVG());
|
||||
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should replace all non-interrupting start events in a selection of multiple elements',
|
||||
|
@ -237,8 +234,8 @@ describe('features/replace-preview', function() {
|
|||
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',
|
||||
|
@ -274,8 +271,8 @@ describe('features/replace-preview', function() {
|
|||
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',
|
||||
|
@ -297,6 +294,7 @@ describe('features/replace-preview', function() {
|
|||
|
||||
// then
|
||||
// expect not to throw TypeError: Cannot read property 'oldElementId' of undefined
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
|
||||
var TestHelper = require('../../../TestHelper');
|
||||
require('../../../TestHelper');
|
||||
|
||||
/* global bootstrapModeler, inject */
|
||||
|
||||
|
@ -17,7 +17,13 @@ var is = require('../../../../lib/util/ModelUtil').is,
|
|||
|
||||
describe('features/replace - bpmn replace', function() {
|
||||
|
||||
var testModules = [ coreModule, modelingModule, replaceModule, moveModule ];
|
||||
var testModules = [
|
||||
coreModule,
|
||||
modelingModule,
|
||||
replaceModule,
|
||||
moveModule
|
||||
];
|
||||
|
||||
|
||||
describe('should replace', function() {
|
||||
|
||||
|
@ -140,7 +146,8 @@ describe('features/replace - bpmn replace', function() {
|
|||
expect(is(newElement.businessObject, 'bpmn:BoundaryEvent')).to.be.true;
|
||||
expect(newElement.businessObject.eventDefinitions[0].$type).to.equal('bpmn:EscalationEventDefinition');
|
||||
expect(newElement.businessObject.cancelActivity).to.be.true;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('interrupting boundary event by non interrupting boundary event',
|
||||
|
@ -162,7 +169,8 @@ describe('features/replace - bpmn replace', function() {
|
|||
expect(is(newElement, 'bpmn:BoundaryEvent')).to.be.true;
|
||||
expect(newElement.businessObject.eventDefinitions[0].$type).to.equal('bpmn:SignalEventDefinition');
|
||||
expect(newElement.businessObject.cancelActivity).to.be.false;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('boundary event and update host',
|
||||
|
@ -173,7 +181,7 @@ describe('features/replace - bpmn replace', function() {
|
|||
host = elementRegistry.get('Task_1'),
|
||||
newElementData = {
|
||||
type: 'bpmn:BoundaryEvent',
|
||||
eventDefinitionType: 'bpmn:ErrorEventDefinition',
|
||||
eventDefinitionType: 'bpmn:ErrorEventDefinition'
|
||||
};
|
||||
|
||||
// when
|
||||
|
@ -182,7 +190,8 @@ describe('features/replace - bpmn replace', function() {
|
|||
// then
|
||||
expect(newElement.host).to.exist;
|
||||
expect(newElement.host).to.eql(host);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
@ -191,7 +200,9 @@ describe('features/replace - bpmn replace', function() {
|
|||
|
||||
var diagramXML = require('./BpmnReplace.collaboration.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||
beforeEach(bootstrapModeler(diagramXML, {
|
||||
modules: testModules
|
||||
}));
|
||||
|
||||
|
||||
it('expanded with collapsed pool', inject(function(elementRegistry, bpmnReplace) {
|
||||
|
@ -247,7 +258,8 @@ describe('features/replace - bpmn replace', function() {
|
|||
expect(newElement.y).to.equal(task.y);
|
||||
}));
|
||||
|
||||
it('should keep label position', inject(function (elementRegistry, bpmnReplace, modeling) {
|
||||
|
||||
it('should keep label position', inject(function(elementRegistry, bpmnReplace, modeling) {
|
||||
|
||||
// given
|
||||
var exclusiveGateway = elementRegistry.get('ExclusiveGateway_1');
|
||||
|
@ -263,7 +275,6 @@ describe('features/replace - bpmn replace', function() {
|
|||
// then
|
||||
expect(newElement.label.x).to.equal(label.x);
|
||||
expect(newElement.label.y).to.equal(label.y);
|
||||
|
||||
}));
|
||||
|
||||
});
|
||||
|
@ -290,7 +301,8 @@ describe('features/replace - bpmn replace', function() {
|
|||
|
||||
// then
|
||||
expect(selection.get()).to.include(newElement);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
@ -316,7 +328,8 @@ describe('features/replace - bpmn replace', function() {
|
|||
|
||||
// then
|
||||
expect(newElement.businessObject.name).to.equal('Task Caption');
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should keep exterior labels',
|
||||
|
@ -336,7 +349,8 @@ describe('features/replace - bpmn replace', function() {
|
|||
expect(newElement.label.hidden).to.equal(false);
|
||||
expect(newElement.label.labelTarget).to.equal(newElement);
|
||||
expect(newElement.businessObject.name).to.equal('KEEP ME');
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
@ -345,11 +359,12 @@ describe('features/replace - bpmn replace', function() {
|
|||
|
||||
var diagramXML = require('../../../fixtures/bpmn/features/replace/01_replace.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||
beforeEach(bootstrapModeler(diagramXML, {
|
||||
modules: testModules
|
||||
}));
|
||||
|
||||
|
||||
it('should undo replace',
|
||||
inject(function(elementRegistry, bpmnReplace, commandStack) {
|
||||
it('should undo', inject(function(elementRegistry, bpmnReplace, commandStack) {
|
||||
|
||||
// given
|
||||
var task = elementRegistry.get('Task_1');
|
||||
|
@ -371,8 +386,7 @@ describe('features/replace - bpmn replace', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('should redo replace',
|
||||
inject(function(elementRegistry, bpmnReplace, commandStack) {
|
||||
it('should redo', inject(function(elementRegistry, bpmnReplace, commandStack) {
|
||||
|
||||
// given
|
||||
var task = elementRegistry.get('Task_1');
|
||||
|
@ -407,11 +421,12 @@ describe('features/replace - bpmn replace', function() {
|
|||
|
||||
var diagramXML = require('../../../fixtures/bpmn/features/replace/01_replace.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||
beforeEach(bootstrapModeler(diagramXML, {
|
||||
modules: testModules
|
||||
}));
|
||||
|
||||
|
||||
it('should reconnect valid connections',
|
||||
inject(function(elementRegistry, bpmnReplace) {
|
||||
it('should reconnect valid', inject(function(elementRegistry, bpmnReplace) {
|
||||
|
||||
// given
|
||||
var task = elementRegistry.get('Task_1');
|
||||
|
@ -428,7 +443,6 @@ describe('features/replace - bpmn replace', function() {
|
|||
source = incoming.source,
|
||||
target = outgoing.target;
|
||||
|
||||
|
||||
expect(incoming).to.exist;
|
||||
expect(outgoing).to.exist;
|
||||
expect(source).to.eql(elementRegistry.get('StartEvent_1'));
|
||||
|
@ -436,8 +450,7 @@ describe('features/replace - bpmn replace', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('should remove invalid incomming connections',
|
||||
inject(function(elementRegistry, bpmnReplace) {
|
||||
it('should remove invalid (incoming)', inject(function(elementRegistry, bpmnReplace) {
|
||||
|
||||
// given
|
||||
var task = elementRegistry.get('StartEvent_1');
|
||||
|
@ -449,17 +462,11 @@ describe('features/replace - bpmn replace', function() {
|
|||
var newElement = bpmnReplace.replaceElement(task, newElementData);
|
||||
|
||||
// then
|
||||
var incoming = newElement.incoming[0],
|
||||
outgoing = newElement.outgoing[0];
|
||||
|
||||
|
||||
expect(incoming).not.to.exist;
|
||||
expect(outgoing).not.to.exist;
|
||||
expect(newElement.incoming).to.be.empty;
|
||||
}));
|
||||
|
||||
|
||||
it('should remove invalid outgoing connections',
|
||||
inject(function(elementRegistry, bpmnReplace) {
|
||||
it('should remove invalid (outgoing)', inject(function(elementRegistry, bpmnReplace) {
|
||||
|
||||
// given
|
||||
var task = elementRegistry.get('EndEvent_1');
|
||||
|
@ -471,19 +478,13 @@ describe('features/replace - bpmn replace', function() {
|
|||
var newElement = bpmnReplace.replaceElement(task, newElementData);
|
||||
|
||||
// then
|
||||
var incoming = newElement.incoming[0],
|
||||
outgoing = newElement.outgoing[0];
|
||||
|
||||
|
||||
expect(incoming).not.to.exist;
|
||||
expect(outgoing).not.to.exist;
|
||||
expect(newElement.outgoing).to.be.empty;
|
||||
}));
|
||||
|
||||
|
||||
describe('undo support', function() {
|
||||
|
||||
it('should reconnect valid connections',
|
||||
inject(function(elementRegistry, bpmnReplace, commandStack) {
|
||||
it('should reconnect valid', inject(function(elementRegistry, bpmnReplace, commandStack) {
|
||||
|
||||
// given
|
||||
var task = elementRegistry.get('Task_1');
|
||||
|
@ -503,7 +504,6 @@ describe('features/replace - bpmn replace', function() {
|
|||
source = incoming.source,
|
||||
target = outgoing.target;
|
||||
|
||||
|
||||
expect(incoming).to.exist;
|
||||
expect(outgoing).to.exist;
|
||||
expect(source).to.eql(elementRegistry.get('StartEvent_1'));
|
||||
|
@ -511,7 +511,7 @@ describe('features/replace - bpmn replace', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('should remove invalid incoming connections',
|
||||
it('should remove invalid (invalid)',
|
||||
inject(function(elementRegistry, bpmnReplace, commandStack) {
|
||||
|
||||
// given
|
||||
|
@ -535,7 +535,8 @@ describe('features/replace - bpmn replace', function() {
|
|||
expect(incoming).not.to.exist;
|
||||
expect(outgoing).to.exist;
|
||||
expect(target).to.eql(elementRegistry.get('Task_1'));
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should remove invalid outgoing connections',
|
||||
|
@ -558,11 +559,11 @@ describe('features/replace - bpmn replace', function() {
|
|||
outgoing = newEvent.outgoing[0],
|
||||
source = incoming.source;
|
||||
|
||||
|
||||
expect(incoming).to.exist;
|
||||
expect(outgoing).not.to.exist;
|
||||
expect(source).to.eql(elementRegistry.get('Transaction_1'));
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
@ -594,7 +595,8 @@ describe('features/replace - bpmn replace', function() {
|
|||
expect(outgoing).to.exist;
|
||||
expect(source).to.eql(elementRegistry.get('StartEvent_1'));
|
||||
expect(target).to.eql(elementRegistry.get('ExclusiveGateway_1'));
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should remove invalid incoming connections',
|
||||
|
@ -618,7 +620,8 @@ describe('features/replace - bpmn replace', function() {
|
|||
|
||||
expect(incoming).not.to.exist;
|
||||
expect(outgoing).not.to.exist;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should remove invalid outgoing connections',
|
||||
|
@ -642,7 +645,8 @@ describe('features/replace - bpmn replace', function() {
|
|||
|
||||
expect(incoming).not.to.exist;
|
||||
expect(outgoing).not.to.exist;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
@ -712,7 +716,8 @@ describe('features/replace - bpmn replace', function() {
|
|||
// then
|
||||
expect(is(newElement, 'bpmn:AdHocSubProcess')).to.be.true;
|
||||
expect(isExpanded(newElement)).to.be.true;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should allow morphing expanded ad hoc into expanded',
|
||||
|
@ -731,7 +736,8 @@ describe('features/replace - bpmn replace', function() {
|
|||
expect(is(newElement, 'bpmn:SubProcess')).to.be.true;
|
||||
expect(is(newElement, 'bpmn:AdHocSubProcess')).to.be.false;
|
||||
expect(isExpanded(newElement)).to.be.true;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should allow morphing collapsed into collapsed ad hoc',
|
||||
|
@ -749,7 +755,8 @@ describe('features/replace - bpmn replace', function() {
|
|||
// then
|
||||
expect(is(newElement, 'bpmn:AdHocSubProcess')).to.be.true;
|
||||
expect(isExpanded(newElement)).not.to.be.true;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should allow morphing collapsed ad hoc into collapsed',
|
||||
|
@ -768,18 +775,22 @@ describe('features/replace - bpmn replace', function() {
|
|||
expect(is(newElement, 'bpmn:SubProcess')).to.be.true;
|
||||
expect(is(newElement, 'bpmn:AdHocSubProcess')).to.be.false;
|
||||
expect(isExpanded(newElement)).not.to.be.true;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
describe('morphing collapsed tasks / sub processes into expanded sub processes', function() {
|
||||
|
||||
describe('collapsed to expanded', function() {
|
||||
|
||||
var diagramXML = require('../../../fixtures/bpmn/features/replace/01_replace.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||
beforeEach(bootstrapModeler(diagramXML, {
|
||||
modules: testModules
|
||||
}));
|
||||
|
||||
|
||||
it('should allow morphing task into expanded sub process', inject(function(bpmnReplace, elementRegistry) {
|
||||
it('should morph task -> expanded sub process', inject(function(bpmnReplace, elementRegistry) {
|
||||
|
||||
// given
|
||||
var element = elementRegistry.get('Task_1');
|
||||
|
@ -797,7 +808,7 @@ describe('features/replace - bpmn replace', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('should allow morphing collapsed sup process into expanded sub process', inject(function(bpmnReplace, elementRegistry) {
|
||||
it('should expand sub-process', inject(function(bpmnReplace, elementRegistry) {
|
||||
|
||||
// given
|
||||
var element = elementRegistry.get('SubProcessCollapsed');
|
||||
|
@ -815,7 +826,7 @@ describe('features/replace - bpmn replace', function() {
|
|||
}));
|
||||
|
||||
|
||||
it('should allow morphing collapsed ad hoc into expanded ad hoc', inject(function(bpmnReplace, elementRegistry) {
|
||||
it('should expand ad hoc sub-process', inject(function(bpmnReplace, elementRegistry) {
|
||||
|
||||
// given
|
||||
var element = elementRegistry.get('AdHocSubProcessCollapsed');
|
||||
|
@ -853,11 +864,14 @@ describe('features/replace - bpmn replace', function() {
|
|||
|
||||
});
|
||||
|
||||
|
||||
describe('compensation activity', function() {
|
||||
|
||||
var diagramXML = require('./BpmnReplace.compensation.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||
beforeEach(bootstrapModeler(diagramXML, {
|
||||
modules: testModules
|
||||
}));
|
||||
|
||||
|
||||
it('should keep isForCompensation attr', inject(function(elementRegistry, bpmnReplace) {
|
||||
|
@ -904,7 +918,8 @@ describe('features/replace - bpmn replace', function() {
|
|||
|
||||
expect(incoming).not.to.exist;
|
||||
expect(outgoing).not.to.exist;
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should replace non-interrupting start event after moving it outside event sub process',
|
||||
|
@ -925,7 +940,8 @@ describe('features/replace - bpmn replace', function() {
|
|||
expect(isInterrupting(startEventAfter)).to.be.true;
|
||||
expect(startEventAfter.parent).to.equal(root);
|
||||
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should replace non-interrupting start event after moving it to a regular sub process',
|
||||
|
@ -946,7 +962,8 @@ describe('features/replace - bpmn replace', function() {
|
|||
expect(isInterrupting(startEventAfter)).to.be.true;
|
||||
expect(startEventAfter.parent).to.equal(subProcess);
|
||||
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should not replace non-interrupting start event after moving it to another event sub process',
|
||||
|
@ -973,7 +990,8 @@ describe('features/replace - bpmn replace', function() {
|
|||
expect(startEvent.id).to.equal(startEventAfter.id);
|
||||
expect(startEventAfter.parent).to.equal(eventSubProcess);
|
||||
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should not replace interrupting start event after moving it outside event sub process',
|
||||
|
@ -996,11 +1014,12 @@ describe('features/replace - bpmn replace', function() {
|
|||
expect(startEventAfter).to.equal(interruptingStartEvent);
|
||||
expect(startEventAfter.parent).to.equal(root);
|
||||
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should replace non-interrupting start event when replacing parent event sub process',
|
||||
inject(function(elementRegistry, bpmnReplace){
|
||||
inject(function(elementRegistry, bpmnReplace) {
|
||||
|
||||
// given
|
||||
var eventSubProcess = elementRegistry.get('SubProcess_2');
|
||||
|
@ -1009,17 +1028,18 @@ describe('features/replace - bpmn replace', function() {
|
|||
var subProcess = bpmnReplace.replaceElement(eventSubProcess, { type: 'bpmn:SubProcess' });
|
||||
|
||||
// then
|
||||
var replacedStartEvent = elementRegistry.filter(function (element) {
|
||||
var replacedStartEvent = elementRegistry.filter(function(element) {
|
||||
return (element.parent === subProcess && element.type !== 'label');
|
||||
})[0];
|
||||
|
||||
expect(isInterrupting(replacedStartEvent)).to.be.true;
|
||||
expect(replacedStartEvent.parent).to.equal(subProcess);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should not replace non-interrupting start event when moving parent event sub process',
|
||||
inject(function(elementRegistry, bpmnReplace, modeling){
|
||||
inject(function(elementRegistry, bpmnReplace, modeling) {
|
||||
|
||||
// given
|
||||
var eventSubProcess = elementRegistry.get('SubProcess_2'),
|
||||
|
@ -1029,14 +1049,15 @@ describe('features/replace - bpmn replace', function() {
|
|||
modeling.moveElements([eventSubProcess], { x: 20, y: 30 });
|
||||
|
||||
// start event after moving parent
|
||||
var startEventAfter = elementRegistry.filter(function (element) {
|
||||
var startEventAfter = elementRegistry.filter(function(element) {
|
||||
return (element.parent === eventSubProcess && element.type !== 'label');
|
||||
})[0];
|
||||
|
||||
// then
|
||||
expect(startEventAfter).to.equal(startEvent);
|
||||
expect(startEventAfter.parent).to.eql(eventSubProcess);
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
});
|
||||
|
||||
|
@ -1045,7 +1066,10 @@ describe('features/replace - bpmn replace', function() {
|
|||
|
||||
var diagramXML = require('../../../fixtures/bpmn/basic.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
||||
beforeEach(bootstrapModeler(diagramXML, {
|
||||
modules: testModules
|
||||
}));
|
||||
|
||||
|
||||
it('should properly set parent of event definitions', inject(function(elementRegistry, modeling, bpmnReplace) {
|
||||
|
||||
|
@ -1061,6 +1085,7 @@ describe('features/replace - bpmn replace', function() {
|
|||
expect(parent).to.exist;
|
||||
expect(parent).to.equal(messageEvent.businessObject);
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -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,6 +50,7 @@ describe('features/snapping - BpmnSnapping', function() {
|
|||
dragging.setOptions({ manual: false });
|
||||
}));
|
||||
|
||||
|
||||
it('should snap on create to the bottom',
|
||||
inject(function(canvas, create, dragging, elementRegistry) {
|
||||
|
||||
|
@ -67,7 +69,8 @@ describe('features/snapping - BpmnSnapping', function() {
|
|||
|
||||
// then
|
||||
expect(boundaryEvent).to.have.bounds({ x: 364, y: 167, width: 36, height: 36 });
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should snap on create to the left',
|
||||
|
@ -88,7 +91,8 @@ describe('features/snapping - BpmnSnapping', function() {
|
|||
|
||||
// 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 });
|
||||
|
@ -126,7 +132,8 @@ describe('features/snapping - BpmnSnapping', function() {
|
|||
expect(participantShape).to.have.bounds({
|
||||
width: 600, height: 250, x: 18, y: -8
|
||||
});
|
||||
}));
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
it('should snap to process children bounds / bottom right',
|
||||
|
@ -149,7 +156,8 @@ describe('features/snapping - BpmnSnapping', function() {
|
|||
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