test(project): replace jasmine with mocha

Closes #204
This commit is contained in:
pedesen 2015-07-15 17:22:19 +02:00
parent 31ea6b2f91
commit c3e4ad3e40
47 changed files with 761 additions and 882 deletions

View File

@ -4,6 +4,7 @@
"strict": true,
"unused": "vars",
"maxlen": 120,
"expr": true,
"globals": {
"describe": false,
"it": false,

View File

@ -33,25 +33,30 @@
"browserify": "^8.1.0",
"browserify-derequire": "^0.9.1",
"bundle-collapser": "^1.1.1",
"chai": "~2.2.0",
"grunt": "^0.4.4",
"grunt-contrib-copy": "^0.7.0",
"grunt-contrib-jshint": "^0.7.2",
"grunt-jsdoc": "^0.5.1",
"grunt-karma": "^0.8.0",
"grunt-release": "^0.7.0",
"jasmine-test-container-support": "^0.1.2",
"jsondiffpatch": "^0.1.26",
"karma": "^0.12.12",
"karma-browserify": "^4.0.0",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "^0.1.2",
"karma-firefox-launcher": "^0.1.3",
"karma-ie-launcher": "^0.1.4",
"karma-jasmine": "https://github.com/Nikku/karma-jasmine/archive/jasmine-v2.0.0-latest-1.tar.gz",
"karma-mocha": "~0.1.10",
"karma-phantomjs-launcher": "^0.1.2",
"karma-safari-launcher": "^0.1.1",
"karma-sinon-chai": "~0.3.0",
"load-grunt-tasks": "^0.3.0",
"mocha-test-container-support": "~0.1.0",
"source-map-concat": "^0.4.0",
"stringify": "^3.1.0",
"sinon": "~1.14.1",
"sinon-chai": "~2.7.0",
"time-grunt": "^0.3.2",
"uglify-js": "^2.4.16"
},

View File

@ -1,85 +0,0 @@
'use strict';
/* global jasmine */
var cloneDeep = require('lodash/lang/cloneDeep'),
isEqual = require('lodash/lang/isEqual'),
pick = require('lodash/object/pick');
module.exports.addDeepEquals = function() {
var jsondiffpatch = require('jsondiffpatch');
var compare = jsondiffpatch.create({
objectHash: function (obj) {
return JSON.stringify(obj);
}
});
function deepEquals(actual, expected) {
var actualClone = cloneDeep(actual);
var expectedClone = cloneDeep(expected);
var result = {
pass: isEqual(actualClone, expectedClone)
};
var message;
if (!result.pass) {
message =
'Expected elements to equal but got diff\n' +
JSON.stringify(compare.diff(actualClone, expectedClone), null, ' ');
} else {
message = 'Expected elements not to equal';
}
result.message = message;
return result;
}
jasmine.addMatchers({
toDeepEqual: function(util) {
return {
compare: deepEquals
};
}
});
};
module.exports.addBBoxMatchers = function() {
jasmine.addMatchers({
toFitBBox: function(util) {
return {
compare: function(actual, expected) {
var actualBBox = actual.getBBox();
var pass = actualBBox.x >= expected.x &&
actualBBox.y >= expected.y &&
actualBBox.width <= expected.width &&
actualBBox.x + actualBBox.width <= expected.x + expected.width &&
(expected.height ? actualBBox.height <= expected.height : true) &&
(expected.height ? actualBBox.y + actualBBox.height <= expected.y + expected.height : true);
var message = '';
if (!pass) {
message = 'Expected element#' + actual.id + ' with bbox ' +
jasmine.pp(pick(actualBBox, ['x', 'y', 'width', 'height'])) + ' to fit ' +
jasmine.pp(expected);
}
return {
pass: pass,
message: message
};
}
};
}
});
};

View File

@ -3,8 +3,9 @@
var TestHelper = module.exports = require('./helper');
TestHelper.insertCSS('diagram-js.css', require('diagram-js/assets/diagram-js.css'));
TestHelper.insertCSS('bpmn-embedded.css', require('../assets/bpmn-font/css/bpmn-embedded.css'));
TestHelper.insertCSS('diagram-js-testing.css',
'.test-container .result { height: 500px; }' + '.test-container > div'
);
);

View File

@ -5,7 +5,10 @@ module.exports = function(karma) {
basePath: '../../',
frameworks: [ 'browserify', 'jasmine' ],
frameworks: [ 'browserify',
'mocha',
'chai',
'sinon-chai'],
files: [
'test/spec/**/*Spec.js',

View File

@ -33,69 +33,71 @@ var unique = require('lodash/array/unique'),
assign = require('lodash/object/assign'),
forEach = require('lodash/collection/forEach');
var TestContainer = require('mocha-test-container-support');
var Modeler = require('../../lib/Modeler'),
Viewer = require('../../lib/Viewer');
try {
// enhance jasmine with test container API
require('jasmine-test-container-support').extend(jasmine);
} catch (e) {
// no test container :-(
}
var OPTIONS, BPMN_JS;
function bootstrapBpmnJS(BpmnJS, diagram, options, locals) {
function bootstrapBpmnJS(BpmnJS, options, locals) {
return function(done) {
var testContainer;
var testContainer;
// Make sure the test container is an optional dependency and we fall back
// to an empty <div> if it does not exist.
//
// This is needed if other libraries rely on this helper for testing
// while not adding the mocha-test-container-support as a dependency.
try {
// 'this' is the current test context
testContainer = TestContainer.get(this);
} catch (e) {
testContainer = document.createElement('div');
document.body.appendChild(testContainer);
}
try {
testContainer = jasmine.getEnv().getTestContainer();
} catch (e) {
testContainer = document.createElement('div');
document.body.appendChild(testContainer);
}
testContainer.classList.add('test-container');
testContainer.classList.add('test-container');
var _options = options,
_locals = locals;
var _options = options,
_locals = locals;
if (_locals === undefined && isFunction(_options)) {
_locals = _options;
_options = null;
}
if (_locals === undefined && isFunction(_options)) {
_locals = _options;
_options = null;
}
if (isFunction(_options)) {
_options = _options();
}
if (isFunction(_options)) {
_options = _options();
}
if (isFunction(_locals)) {
_locals = _locals();
}
if (isFunction(_locals)) {
_locals = _locals();
}
_options = assign({ container: testContainer }, OPTIONS || {}, _options || {});
_options = assign({ container: testContainer, width: '100%', height: '100%' }, OPTIONS || {}, _options || {});
if (_locals) {
var mockModule = {};
if (_locals) {
var mockModule = {};
forEach(_locals, function(v, k) {
mockModule[k] = ['value', v];
});
forEach(_locals, function(v, k) {
mockModule[k] = ['value', v];
});
_options.modules = [].concat(_options.modules || [], [ mockModule ]);
}
_options.modules = [].concat(_options.modules || [], [ mockModule ]);
}
_options.modules = unique(_options.modules);
_options.modules = unique(_options.modules);
if (!_options.modules.length) {
_options.modules = undefined;
}
if (!_options.modules.length) {
_options.modules = undefined;
}
BPMN_JS = new BpmnJS(_options);
BPMN_JS = new BpmnJS(_options);
return BPMN_JS;
BPMN_JS.importXML(diagram, done);
};
}
@ -124,14 +126,7 @@ function bootstrapBpmnJS(BpmnJS, options, locals) {
* @return {Function} a function to be passed to beforeEach
*/
function bootstrapModeler(diagram, options, locals) {
return function(done) {
// bootstrap
var modeler = bootstrapBpmnJS(Modeler, options, locals);
// import diagram
modeler.importXML(diagram, done);
};
return bootstrapBpmnJS(Modeler, diagram, options, locals);
}
/**
@ -159,14 +154,7 @@ function bootstrapModeler(diagram, options, locals) {
* @return {Function} a function to be passed to beforeEach
*/
function bootstrapViewer(diagram, options, locals) {
return function(done) {
// bootstrap
var viewer = bootstrapBpmnJS(Viewer, options, locals);
// import diagram
viewer.importXML(diagram, done);
};
return bootstrapBpmnJS(Viewer, diagram, options, locals);
}
@ -184,7 +172,7 @@ function bootstrapViewer(diagram, options, locals) {
* beforeEach(bootstrapViewer(...));
*
* it('should provide mocked events', inject(function(events) {
* expect(events).toBe(mockEvents);
* expect(events).to.eql(mockEvents);
* }));
*
* });
@ -238,4 +226,4 @@ function insertCSS(name, css) {
head.appendChild(style);
}
module.exports.insertCSS = insertCSS;
module.exports.insertCSS = insertCSS;

View File

@ -1,9 +1,8 @@
'use strict';
var TestHelper = require('../TestHelper');
var Modeler = require('../../lib/Modeler');
var TestContainer = require('mocha-test-container-support');
describe('scenario - simple modeling', function() {
@ -11,7 +10,7 @@ describe('scenario - simple modeling', function() {
var container;
beforeEach(function() {
container = jasmine.getEnv().getTestContainer();
container = TestContainer.get(this);
});
@ -27,4 +26,4 @@ describe('scenario - simple modeling', function() {
});
});
});
});

View File

@ -31,11 +31,11 @@ describe('bpmn-moddle', function() {
}
// then
expect(definitions.id).toBe('simple');
expect(definitions.targetNamespace).toBe('http://bpmn.io/schema/bpmn');
expect(definitions.id).to.equal('simple');
expect(definitions.targetNamespace).to.equal('http://bpmn.io/schema/bpmn');
expect(definitions.rootElements.length).toBe(1);
expect(definitions.rootElements[0].id).toBe('Process_1');
expect(definitions.rootElements.length).to.equal(1);
expect(definitions.rootElements[0].id).to.equal('Process_1');
done();
});

View File

@ -1,16 +1,15 @@
'use strict';
var TestHelper = require('../TestHelper');
var Modeler = require('../../lib/Modeler');
var TestContainer = require('mocha-test-container-support');
describe('Modeler', function() {
var container;
beforeEach(function() {
container = jasmine.getEnv().getTestContainer();
container = TestContainer.get(this);
});
@ -61,7 +60,7 @@ describe('Modeler', function() {
}
// then
expect(warnings.length).toBe(0);
expect(warnings.length).to.equal(0);
done();
});
@ -80,7 +79,7 @@ describe('Modeler', function() {
modeler.importXML(xml, function(err, warnings) {
expect(modeler.container.parentNode).toBe(document.body);
expect(modeler.container.parentNode).to.equal(document.body);
done(err, warnings);
});
@ -102,8 +101,8 @@ describe('Modeler', function() {
elementRegistry = viewer.get('elementRegistry');
// assume
expect(overlays).toBeDefined();
expect(elementRegistry).toBeDefined();
expect(overlays).to.be.defined;
expect(elementRegistry).to.be.defined;
// when
@ -124,8 +123,8 @@ describe('Modeler', function() {
});
// then
expect(overlays.get({ element: 'SubProcess_1', type: 'badge' }).length).toBe(1);
expect(overlays.get({ element: 'StartEvent_1', type: 'badge' }).length).toBe(1);
expect(overlays.get({ element: 'SubProcess_1', type: 'badge' }).length).to.equal(1);
expect(overlays.get({ element: 'StartEvent_1', type: 'badge' }).length).to.equal(1);
done(err);
});
@ -152,7 +151,7 @@ describe('Modeler', function() {
createEvent = Events.scopedCreate(viewer.get('canvas'));
// assume
expect(bendpointMove).toBeDefined();
expect(bendpointMove).to.be.defined;
// when
bendpointMove.start(createEvent({ x: 0, y: 0 }), elementRegistry.get('SequenceFlow_1'), 1);
@ -174,7 +173,7 @@ describe('Modeler', function() {
modeler.importXML(xml, function(err) {
expect(err).toBeDefined();
expect(err).to.be.defined;
done();
});
@ -195,7 +194,7 @@ describe('Modeler', function() {
createModeler(xml, function(err, warnings, modeler) {
expect(modeler.get('bpmnjs')).toBe(modeler);
expect(modeler.get('bpmnjs')).to.equal(modeler);
done(err);
});

View File

@ -10,10 +10,12 @@ describe('NavigatedViewer', function() {
var container;
beforeEach(function() {
container = jasmine.getEnv().getTestContainer();
container = document.createElement('div');
document.body.appendChild(container);
});
function createViewer(xml, done) {
var viewer = new NavigatedViewer({ container: container });
@ -36,7 +38,7 @@ describe('NavigatedViewer', function() {
it('should include zoomScroll', function(done) {
createViewer(xml, function(err, warnings, viewer) {
expect(viewer.get('zoomScroll')).toBeDefined();
expect(viewer.get('zoomScroll')).to.be.defined;
done(err);
});
@ -45,7 +47,7 @@ describe('NavigatedViewer', function() {
it('should include moveCanvas', function(done) {
createViewer(xml, function(err, warnings, viewer) {
expect(viewer.get('moveCanvas')).toBeDefined();
expect(viewer.get('moveCanvas')).to.be.defined;
done(err);
});
@ -53,4 +55,4 @@ describe('NavigatedViewer', function() {
});
});
});

View File

@ -1,7 +1,6 @@
'use strict';
var TestHelper = require('../TestHelper');
var TestContainer = require('mocha-test-container-support');
var Viewer = require('../../lib/Viewer');
@ -11,7 +10,7 @@ describe('Viewer', function() {
var container;
beforeEach(function() {
container = jasmine.getEnv().getTestContainer();
container = TestContainer.get(this);
});
@ -52,8 +51,8 @@ describe('Viewer', function() {
viewer.importXML(xml, function(err, warnings) {
// then
expect(err).toBeFalsy();
expect(warnings.length).toBe(0);
expect(err).to.not.be.ok;
expect(warnings.length).to.equal(0);
done();
});
@ -72,7 +71,7 @@ describe('Viewer', function() {
viewer.importXML(xml, function(err, warnings) {
expect(viewer.container.parentNode).toBe(document.body);
expect(viewer.container.parentNode).to.equal(document.body);
done(err, warnings);
});
@ -108,7 +107,7 @@ describe('Viewer', function() {
viewer.importXML(xml, function(err) {
// then
expect(events).toEqual([
expect(events).to.eql([
'import.start',
'import.success'
]);
@ -133,8 +132,8 @@ describe('Viewer', function() {
elementRegistry = viewer.get('elementRegistry');
// then
expect(overlays).toBeDefined();
expect(elementRegistry).toBeDefined();
expect(overlays).to.be.defined;
expect(elementRegistry).to.be.defined;
// when
overlays.add('SubProcess_1', {
@ -146,7 +145,7 @@ describe('Viewer', function() {
});
// then
expect(overlays.get({ element: 'SubProcess_1' }).length).toBe(1);
expect(overlays.get({ element: 'SubProcess_1' }).length).to.equal(1);
done(err);
});
@ -161,18 +160,18 @@ describe('Viewer', function() {
function expectMessage(e, expectedMessage) {
expect(e).toBeDefined();
expect(e).to.be.defined;
if (expectedMessage instanceof RegExp) {
expect(e.message).toMatch(expectedMessage);
expect(e.message).to.match(expectedMessage);
} else {
expect(e.message).toEqual(expectedMessage);
expect(e.message).to.equal(expectedMessage);
}
}
function expectWarnings(warnings, expected) {
expect(warnings.length).toBe(expected.length);
expect(warnings.length).to.equal(expected.length);
warnings.forEach(function(w, idx) {
expectMessage(w, expected[idx]);
@ -186,7 +185,7 @@ describe('Viewer', function() {
createViewer(xml, function(err) {
expect(err).toBeTruthy();
expect(err).to.be.ok;
expectMessage(err, /Text data outside of root node./);
@ -203,7 +202,7 @@ describe('Viewer', function() {
createViewer(xml, function(err, warnings) {
// then
expect(err).toBeFalsy();
expect(err).to.not.be.ok;
expectWarnings(warnings, [
'unresolved reference <Collaboration_2>',
@ -218,7 +217,8 @@ describe('Viewer', function() {
});
it('should handle invalid namespaced element', function(done) {
it
('should handle invalid namespaced element', function(done) {
var xml = require('../fixtures/bpmn/error/categoryValue.bpmn');
@ -226,7 +226,7 @@ describe('Viewer', function() {
createViewer(xml, function(err, warnings) {
// then
expect(err).toBeFalsy();
expect(err).to.not.be.ok;
expectWarnings(warnings, [
/unparsable content <categoryValue> detected/,
@ -246,7 +246,7 @@ describe('Viewer', function() {
createViewer(xml, function(err, warnings) {
// then
expect(err).toBeFalsy();
expect(err).to.not.be.ok;
expectWarnings(warnings, [
/unparsable content <collaboration> detected/,
@ -271,7 +271,7 @@ describe('Viewer', function() {
createViewer(xml, function(err, warnings, viewer) {
expect(viewer.get('bpmnjs')).toBe(viewer);
expect(viewer.get('bpmnjs')).to.equal(viewer);
done(err);
});
@ -290,15 +290,15 @@ describe('Viewer', function() {
var expectedStart = '<?xml version="1.0" encoding="utf-8"?>';
var expectedEnd = '</svg>';
expect(svg.indexOf(expectedStart)).toEqual(0);
expect(svg.indexOf(expectedEnd)).toEqual(svg.length - expectedEnd.length);
expect(svg.indexOf(expectedStart)).to.equal(0);
expect(svg.indexOf(expectedEnd)).to.equal(svg.length - expectedEnd.length);
// ensure correct rendering of SVG contents
expect(svg.indexOf('undefined')).toBe(-1);
expect(svg.indexOf('undefined')).to.equal(-1);
// expect header to be written only once
expect(svg.indexOf('<svg width="100%" height="100%">')).toBe(-1);
expect(svg.indexOf('<g class="viewport"')).toBe(-1);
expect(svg.indexOf('<svg width="100%" height="100%">')).to.equal(-1);
expect(svg.indexOf('<g class="viewport"')).to.equal(-1);
// FIXME(nre): make matcher
return true;
@ -324,7 +324,7 @@ describe('Viewer', function() {
}
// then
expect(isValid(svg)).toBe(true);
expect(isValid(svg)).to.be.true;
done();
});
@ -353,10 +353,10 @@ describe('Viewer', function() {
}
// then
expect(isValid(svg)).toBe(true);
expect(isValid(svg)).to.be.true;
// no svg export should take more than 500ms
expect(currentTime() - time).toBeLessThan(500);
expect(currentTime() - time).to.be.below(500);
done();
});
@ -391,7 +391,7 @@ describe('Viewer', function() {
appendTestRect(svgDoc);
appendTestRect(svgDoc);
expect(svgDoc.querySelectorAll('.outer-bound-marker')).toBeDefined();
expect(svgDoc.querySelectorAll('.outer-bound-marker')).to.be.defined;
// when
viewer.saveSVG(function(err, svg) {
@ -404,8 +404,8 @@ describe('Viewer', function() {
svgDoc.innerHTML = svg;
// then
expect(isValid(svg)).toBe(true);
expect(svgDoc.querySelector('.outer-bound-marker')).toBeNull();
expect(isValid(svg)).to.be.true;
expect(svgDoc.querySelector('.outer-bound-marker')).to.be.null;
done();
});
@ -440,7 +440,7 @@ describe('Viewer', function() {
viewer.importXML(xml, function(err) {
// then
expect(err.message).toBe('No provider for "bpmnImporter"! (Resolving: bpmnImporter)');
expect(err.message).to.equal('No provider for "bpmnImporter"! (Resolving: bpmnImporter)');
done();
});
@ -457,7 +457,7 @@ describe('Viewer', function() {
// then
var logger = viewer.get('logger');
expect(logger.called).toBe(true);
expect(logger.called).to.be.true;
done(err);
});
@ -476,9 +476,9 @@ describe('Viewer', function() {
});
// then
expect(viewer.container.style.position).toBe('fixed');
expect(viewer.container.style.width).toBe('200px');
expect(viewer.container.style.height).toBe('100px');
expect(viewer.container.style.position).to.equal('fixed');
expect(viewer.container.style.width).to.equal('200px');
expect(viewer.container.style.height).to.equal('100px');
});
@ -505,18 +505,18 @@ describe('Viewer', function() {
sendTask = taskShape.businessObject;
// then
expect(sendTask).toBeDefined();
expect(sendTask).to.be.defined;
var extensionElements = sendTask.extensionElements;
// receive task should be moddle extended
expect(sendTask.$instanceOf('camunda:ServiceTaskLike')).toBeTruthy();
expect(sendTask.$instanceOf('camunda:ServiceTaskLike')).to.be.ok;
// extension elements should provide typed element
expect(extensionElements).toBeTruthy();
expect(extensionElements).to.be.ok;
expect(extensionElements.values.length).toBe(1);
expect(extensionElements.values[0].$instanceOf('camunda:InputOutput')).toBeTruthy();
expect(extensionElements.values.length).to.equal(1);
expect(extensionElements.values[0].$instanceOf('camunda:InputOutput')).to.be.ok;
done(err);
});
@ -539,9 +539,9 @@ describe('Viewer', function() {
viewer.destroy();
// then
expect(viewer.container.parentNode).toBeFalsy();
expect(viewer.container.parentNode).to.not.be.ok;
});
});
});
});

View File

@ -1,7 +1,6 @@
'use strict';
var Matchers = require('../../Matchers'),
TestHelper = require('../../TestHelper');
var TestHelper = require('../../TestHelper');
var coreModule = require('../../../lib/core'),
rendererModule = require('../../../lib/draw');
@ -152,9 +151,6 @@ describe('draw - bpmn renderer', function() {
});
describe('path - bpmn renderer', function () {
beforeEach(Matchers.addDeepEquals);
var diagramXML = require('../../fixtures/bpmn/simple-cropping.bpmn');
@ -163,7 +159,7 @@ describe('path - bpmn renderer', function () {
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
describe('circle', function () {
it('should return a circle path', inject(function(canvas, elementRegistry, renderer) {
@ -174,7 +170,7 @@ describe('path - bpmn renderer', function () {
var startPath = renderer.getShapePath(eventElement);
// then
expect(startPath).toEqual('M247,343m0,-18a18,18,0,1,1,0,36a18,18,0,1,1,0,-36z');
expect(startPath).to.equal('M247,343m0,-18a18,18,0,1,1,0,36a18,18,0,1,1,0,-36z');
}));
@ -185,9 +181,9 @@ describe('path - bpmn renderer', function () {
// when
var gatewayPath = renderer.getShapePath(gatewayElement);
// then
expect(gatewayPath).toEqual('M418,318l25,25l-25,25l-25,-25z');
expect(gatewayPath).to.equal('M418,318l25,25l-25,25l-25,-25z');
}));
@ -200,7 +196,7 @@ describe('path - bpmn renderer', function () {
var subProcessPath = renderer.getShapePath(subProcessElement);
// then
expect(subProcessPath).toEqual('M584,243l330,0a10,10,0,0,1,10,10l0,180a10,10,0,0,1,-10,10' +
expect(subProcessPath).to.equal('M584,243l330,0a10,10,0,0,1,10,10l0,180a10,10,0,0,1,-10,10' +
'l-330,0a10,10,0,0,1,-10,-10l0,-180a10,10,0,0,1,10,-10z');
}));
@ -214,7 +210,7 @@ describe('path - bpmn renderer', function () {
var TextAnnotationPath = renderer.getShapePath(TextAnnotationElement);
// then
expect(TextAnnotationPath).toEqual('M368,156l100,0l0,80l-100,0z');
expect(TextAnnotationPath).to.equal('M368,156l100,0l0,80l-100,0z');
}));
});

View File

@ -34,20 +34,20 @@ describe('environment - mocking', function() {
it('should use spy', inject(function(eventBus) {
expect(eventBus).toEqual(mockEvents);
expect(bootstrapCalled).toBe(true);
expect(eventBus).to.eql(mockEvents);
expect(bootstrapCalled).to.be.true;
}));
it('should reparse bootstrap code', inject(function(eventBus) {
expect(bootstrapCalled).toBe(true);
expect(bootstrapCalled).to.be.true;
}));
it('should inject bpmnjs', inject(function(bpmnjs) {
expect(bpmnjs).toBeDefined();
expect(bpmnjs).to.be.defined;
}));
});
});

View File

@ -2,6 +2,8 @@
var TestHelper = require('../../../TestHelper');
var TestContainer = require('mocha-test-container-support');
var domQuery = require('min-dom/lib/query');
/* global bootstrapViewer, inject */
@ -26,7 +28,7 @@ describe('features - context-pad', function() {
describe('bootstrap', function() {
it('should bootstrap', inject(function(contextPadProvider) {
expect(contextPadProvider).toBeDefined();
expect(contextPadProvider).to.exist;
}));
});
@ -36,7 +38,7 @@ describe('features - context-pad', function() {
var container;
beforeEach(function() {
container = jasmine.getEnv().getTestContainer();
container = TestContainer.get(this);
});
it('for a diagram element', inject(function(elementRegistry, contextPad, popupMenu) {
@ -61,8 +63,8 @@ describe('features - context-pad', function() {
replaceMenuRect = domQuery('.replace-menu', container).getBoundingClientRect();
// then
expect(replaceMenuRect.left).not.toBeGreaterThan(padMenuRect.left);
expect(replaceMenuRect.top).not.toBeGreaterThan(padMenuRect.bottom + padding);
expect(replaceMenuRect.left).to.be.at.most(padMenuRect.left);
expect(replaceMenuRect.top).to.be.at.most(padMenuRect.bottom + padding);
}));
});
});

View File

@ -45,7 +45,7 @@ describe('features - label-editing', function() {
eventBus.fire('element.dblclick', { element: shape });
// then
expect(directEditing.isActive()).toBe(true);
expect(directEditing.isActive()).to.be.true;
}));
@ -69,8 +69,8 @@ describe('features - label-editing', function() {
triggerKeyEvent(textarea, 'keydown', 27);
// then
expect(directEditing.isActive()).toBe(false);
expect(task.name).toBe(oldName);
expect(directEditing.isActive()).to.be.false;
expect(task.name).to.equal(oldName);
}));
@ -95,8 +95,8 @@ describe('features - label-editing', function() {
eventBus.fire('element.mousedown', { element: canvas.getRootElement() });
// then
expect(directEditing.isActive()).toBe(false);
expect(task.name).toBe(newName);
expect(directEditing.isActive()).to.be.false;
expect(task.name).to.equal(newName);
}));
});
@ -155,7 +155,7 @@ describe('features - label-editing', function() {
directEditComplete('BAR');
// then
expect(listenerCalled).toBe(true);
expect(listenerCalled).to.be.true;
});
@ -174,7 +174,7 @@ describe('features - label-editing', function() {
// then
var label = LabelUtil.getLabel(diagramElement);
expect(label).toBe(oldLabel);
expect(label).to.eql(oldLabel);
}));
});
@ -200,7 +200,7 @@ describe('features - label-editing', function() {
directEditComplete('BAR');
// then
expect(listenerCalled).toBe(true);
expect(listenerCalled).to.be.true;
});
@ -222,7 +222,7 @@ describe('features - label-editing', function() {
directEditComplete('BAR');
// then
expect(listenerCalled).toBe(true);
expect(listenerCalled).to.be.true;
});
});
@ -244,8 +244,8 @@ describe('features - label-editing', function() {
// then
// expect editing to be active
expect(directEditing.getValue()).toBe(label);
expect(directEditing.isActive()).toBe(true);
expect(directEditing.getValue()).to.eql(label);
expect(directEditing.isActive()).to.be.true;
// when
@ -254,7 +254,7 @@ describe('features - label-editing', function() {
// then
// expect update to have happened
label = LabelUtil.getLabel(diagramElement);
expect(label).toBe('B');
expect(label).to.equal('B');
// when
@ -263,7 +263,7 @@ describe('features - label-editing', function() {
// expect no label update to have happened
label = LabelUtil.getLabel(diagramElement);
expect(label).toBe('B');
expect(label).to.equal('B');
});
}
@ -311,4 +311,4 @@ describe('features - label-editing', function() {
});
});
});

View File

@ -2,6 +2,7 @@
var TestHelper = require('../../../TestHelper');
var TestContainer = require('mocha-test-container-support');
var Modeler = require('../../../../lib/Modeler');
@ -11,7 +12,7 @@ describe('direct editing - touch integration', function() {
var container;
beforeEach(function() {
container = jasmine.getEnv().getTestContainer();
container = TestContainer.get(this);
});
@ -35,4 +36,4 @@ describe('direct editing - touch integration', function() {
createModeler(xml, done);
});
});
});

View File

@ -1,7 +1,5 @@
'use strict';
var TestHelper = require('../../../TestHelper');
/* global bootstrapModeler, inject */
var find = require('lodash/collection/find');
@ -18,14 +16,12 @@ describe('features/modeling - append shape', function() {
var diagramXML = require('../../../fixtures/bpmn/simple.bpmn');
var testModules = [ coreModule, modelingModule ];
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
describe('shape handling', function() {
it('should execute', inject(function(elementRegistry, modeling) {
// given
var startEventShape = elementRegistry.get('StartEvent_1');
@ -34,8 +30,8 @@ describe('features/modeling - append shape', function() {
target = targetShape.businessObject;
// then
expect(targetShape).toBeDefined();
expect(target.$instanceOf('bpmn:Task')).toBe(true);
expect(targetShape).to.be.defined;
expect(target.$instanceOf('bpmn:Task')).to.be.true;
}));
@ -53,13 +49,13 @@ describe('features/modeling - append shape', function() {
target = targetShape.businessObject;
// then
expect(target.di).toBeDefined();
expect(target.di.$parent).toBe(startEvent.di.$parent);
expect(target.di).to.be.defined;
expect(target.di.$parent).to.eql(startEvent.di.$parent);
expect(target.di.bounds.x).toBe(targetShape.x);
expect(target.di.bounds.y).toBe(targetShape.y);
expect(target.di.bounds.width).toBe(targetShape.width);
expect(target.di.bounds.height).toBe(targetShape.height);
expect(target.di.bounds.x).to.equal(targetShape.x);
expect(target.di.bounds.y).to.equal(targetShape.y);
expect(target.di.bounds.width).to.equal(targetShape.width);
expect(target.di.bounds.height).to.equal(targetShape.height);
}));
@ -77,7 +73,7 @@ describe('features/modeling - append shape', function() {
target = targetShape.businessObject;
// then
expect(subProcess.get('flowElements')).toContain(target);
expect(subProcess.get('flowElements')).to.include(target);
}));
@ -99,13 +95,13 @@ describe('features/modeling - append shape', function() {
var label = targetShape.label;
// then
expect(label).toBeDefined();
expect(elementRegistry.get(label.id)).toBeDefined();
expect(label).to.be.defined;
expect(elementRegistry.get(label.id)).to.be.defined;
expect(label.x).toBe(441);
expect(label.y).toBe(278);
expect(label.width).toBe(LabelUtil.DEFAULT_LABEL_SIZE.width);
expect(label.height).toBe(LabelUtil.DEFAULT_LABEL_SIZE.height);
expect(label.x).to.equal(441);
expect(label.y).to.equal(278);
expect(label.width).to.equal(LabelUtil.DEFAULT_LABEL_SIZE.width);
expect(label.height).to.equal(LabelUtil.DEFAULT_LABEL_SIZE.height);
}));
@ -123,12 +119,12 @@ describe('features/modeling - append shape', function() {
target = targetShape.businessObject;
// then
expect(target.di.label).toBeDefined();
expect(target.di.label).to.be.defined;
expect(target.di.label.bounds.x).toBe(targetShape.label.x);
expect(target.di.label.bounds.y).toBe(targetShape.label.y);
expect(target.di.label.bounds.width).toBe(targetShape.label.width);
expect(target.di.label.bounds.height).toBe(targetShape.label.height);
expect(target.di.label.bounds.x).to.equal(targetShape.label.x);
expect(target.di.label.bounds.y).to.equal(targetShape.label.y);
expect(target.di.label.bounds.width).to.equal(targetShape.label.width);
expect(target.di.label.bounds.height).to.equal(targetShape.label.height);
}));
});
@ -152,8 +148,8 @@ describe('features/modeling - append shape', function() {
});
// then
expect(connection).toBeDefined();
expect(connection.$instanceOf('bpmn:SequenceFlow')).toBe(true);
expect(connection).to.be.defined;
expect(connection.$instanceOf('bpmn:SequenceFlow')).to.be.true;
}));
});
@ -177,8 +173,8 @@ describe('features/modeling - append shape', function() {
commandStack.undo();
// then
expect(subProcess.get('flowElements')).not.toContain(target);
expect(subProcess.di.$parent.get('planeElement')).not.toContain(target.di);
expect(subProcess.get('flowElements')).not.to.include(target);
expect(subProcess.di.$parent.get('planeElement')).not.to.include(target.di);
}));
@ -202,13 +198,13 @@ describe('features/modeling - append shape', function() {
commandStack.undo();
// then
expect(connection.sourceRef).toBe(null);
expect(connection.targetRef).toBe(null);
expect(connection.$parent).toBe(null);
expect(subProcess.di.$parent.get('planeElement')).not.toContain(connection.di);
expect(connection.sourceRef).to.be.null;
expect(connection.targetRef).to.be.null;
expect(connection.$parent).to.be.null;
expect(subProcess.di.$parent.get('planeElement')).not.to.include(connection.di);
expect(targetShape.label).not.toBeDefined();
expect(elementRegistry.get(target.id + '_label')).not.toBeDefined();
expect(targetShape.label).not.to.be.defined;
expect(elementRegistry.get(target.id + '_label')).not.to.be.defined;
}));
@ -232,16 +228,16 @@ describe('features/modeling - append shape', function() {
commandStack.undo();
// then
expect(connection.sourceRef).toBe(null);
expect(connection.targetRef).toBe(null);
expect(connection.sourceRef).to.be.null;
expect(connection.targetRef).to.be.null;
expect(startEvent.get('outgoing')).not.toContain(connection);
expect(target.get('incoming')).not.toContain(connection);
expect(startEvent.get('outgoing')).not.to.include(connection);
expect(target.get('incoming')).not.to.include(connection);
expect(connection.$parent).toBe(null);
expect(subProcess.di.$parent.get('planeElement')).not.toContain(connection.di);
expect(connection.$parent).to.be.null;
expect(subProcess.di.$parent.get('planeElement')).not.to.include(connection.di);
expect(elementRegistry.get(targetShape.id)).not.toBeDefined();
expect(elementRegistry.get(targetShape.id)).not.to.be.defined;
}));
@ -265,12 +261,12 @@ describe('features/modeling - append shape', function() {
commandStack.undo();
// then
expect(connection.sourceRef).toBe(null);
expect(connection.targetRef).toBe(null);
expect(connection.$parent).toBe(null);
expect(subProcess.di.$parent.get('planeElement')).not.toContain(connection.di);
expect(connection.sourceRef).to.be.null;
expect(connection.targetRef).to.be.null;
expect(connection.$parent).to.be.null;
expect(subProcess.di.$parent.get('planeElement')).not.to.include(connection.di);
expect(elementRegistry.get(connection.id + '_label')).not.toBeDefined();
expect(elementRegistry.get(connection.id + '_label')).not.to.be.defined;
}));
@ -296,15 +292,15 @@ describe('features/modeling - append shape', function() {
// then
// expect redo to work on original target object
expect(targetShape.parent).toBe(subProcessShape);
expect(targetShape.parent).to.eql(subProcessShape);
// when
commandStack.undo();
commandStack.undo();
// then
expect(targetShape2.parent).toBe(null);
expect(elementRegistry.get(targetShape2.id)).not.toBeDefined();
expect(targetShape2.parent).to.be.null;
expect(elementRegistry.get(targetShape2.id)).not.to.be.defined;
}));
@ -330,11 +326,11 @@ describe('features/modeling - append shape', function() {
commandStack.undo();
// then
expect(connection.sourceRef).toBe(null);
expect(connection.targetRef).toBe(null);
expect(connection.$parent).toBe(null);
expect(connection.sourceRef).to.be.null;
expect(connection.targetRef).to.be.null;
expect(connection.$parent).to.be.null;
expect(subProcess.di.$parent.get('planeElement')).not.toContain(connection.di);
expect(subProcess.di.$parent.get('planeElement')).not.to.include(connection.di);
}));
});
@ -354,8 +350,8 @@ describe('features/modeling - append shape', function() {
target = targetShape.businessObject;
// then
expect(targetShape).toBeDefined();
expect(target.$instanceOf('bpmn:ExclusiveGateway')).toBe(true);
expect(targetShape).to.be.defined;
expect(target.$instanceOf('bpmn:ExclusiveGateway')).to.be.true;
}));
@ -373,7 +369,7 @@ describe('features/modeling - append shape', function() {
target = targetShape.businessObject;
// then
expect(subProcess.get('flowElements')).toContain(target);
expect(subProcess.get('flowElements')).to.include(target);
}));
@ -393,8 +389,8 @@ describe('features/modeling - append shape', function() {
commandStack.undo();
// then
expect(subProcess.get('flowElements')).not.toContain(target);
expect(subProcess.di.$parent.get('planeElement')).not.toContain(target.di);
expect(subProcess.get('flowElements')).not.to.include(target);
expect(subProcess.di.$parent.get('planeElement')).not.to.include(target.di);
}));
});

View File

@ -20,7 +20,7 @@ describe('features/bendpoints', function() {
it('should contain bendpoints', inject(function(bendpoints) {
expect(bendpoints).toBeDefined();
expect(bendpoints).to.be.defined;
}));
});

View File

@ -1,7 +1,6 @@
'use strict';
var Matchers = require('../../../Matchers'),
TestHelper = require('../../../TestHelper');
var TestHelper = require('../../../TestHelper');
/* global bootstrapModeler, inject */
@ -12,9 +11,6 @@ var modelingModule = require('../../../../lib/features/modeling'),
describe('features - bpmn-factory', function() {
beforeEach(Matchers.addDeepEquals);
var diagramXML = require('../../../fixtures/bpmn/simple.bpmn');
var testModules = [ modelingModule, coreModule ];
@ -27,24 +23,24 @@ describe('features - bpmn-factory', function() {
it('should return instance', inject(function(bpmnFactory) {
var task = bpmnFactory.create('bpmn:Task');
expect(task).toBeDefined();
expect(task.$type).toEqual('bpmn:Task');
expect(task).to.be.defined;
expect(task.$type).to.equal('bpmn:Task');
}));
it('should assign id (with semantic prefix)', inject(function(bpmnFactory) {
var task = bpmnFactory.create('bpmn:ServiceTask');
expect(task.$type).toEqual('bpmn:ServiceTask');
expect(task.id).toMatch(/^ServiceTask_/g);
expect(task.$type).to.equal('bpmn:ServiceTask');
expect(task.id).to.match(/^ServiceTask_/g);
}));
it('should assign id (with semantic prefix)', inject(function(bpmnFactory) {
var plane = bpmnFactory.create('bpmndi:BPMNPlane');
expect(plane.$type).toEqual('bpmndi:BPMNPlane');
expect(plane.id).toMatch(/^BPMNPlane_/g);
expect(plane.$type).to.equal('bpmndi:BPMNPlane');
expect(plane.id).to.match(/^BPMNPlane_/g);
}));
});
@ -64,14 +60,14 @@ describe('features - bpmn-factory', function() {
var result = bpmnFactory.createDiWaypoints(waypoints);
// then
expect(result).toDeepEqual([
{ $type: 'dc:Point', x: 0, y: 0 },
{ $type: 'dc:Point', x: 0, y: 0 }
expect(result).eql([
bpmnFactory.create('dc:Point', {x: 0, y: 0 }),
bpmnFactory.create('dc:Point', {x: 0, y: 0 })
]);
// expect original not to have been accidently serialized
expect(result[0].$attrs).toEqual({});
expect(result[0].$attrs).to.eql({});
}));
});
});
});

View File

@ -1,7 +1,6 @@
'use strict';
var Matchers = require('../../../Matchers'),
TestHelper = require('../../../TestHelper');
var TestHelper = require('../../../TestHelper');
/* global bootstrapModeler, inject */
@ -12,9 +11,6 @@ var modelingModule = require('../../../../lib/features/modeling'),
describe('features/modeling - create connection', function() {
beforeEach(Matchers.addDeepEquals);
var diagramXML = require('../../../fixtures/bpmn/sequence-flows.bpmn');
var testModules = [ coreModule, modelingModule ];
@ -24,7 +20,7 @@ describe('features/modeling - create connection', function() {
describe('connection handling', function() {
it('should execute', inject(function(elementRegistry, modeling) {
it('should execute', inject(function(elementRegistry, modeling, bpmnFactory) {
// given
var taskShape = elementRegistry.get('Task_1'),
@ -41,33 +37,35 @@ describe('features/modeling - create connection', function() {
var sequenceFlow = sequenceFlowConnection.businessObject;
// then
expect(sequenceFlowConnection).toBeDefined();
expect(sequenceFlow).toBeDefined();
expect(sequenceFlowConnection).to.be.defined;
expect(sequenceFlow).to.be.defined;
expect(sequenceFlow.sourceRef).toBe(task);
expect(sequenceFlow.targetRef).toBe(gateway);
expect(sequenceFlow.sourceRef).to.eql(task);
expect(sequenceFlow.targetRef).to.eql(gateway);
expect(task.outgoing).toContain(sequenceFlow);
expect(gateway.incoming).toContain(sequenceFlow);
expect(task.outgoing).to.include(sequenceFlow);
expect(gateway.incoming).to.include(sequenceFlow);
expect(sequenceFlow.di.$parent).toBe(task.di.$parent);
expect(sequenceFlow.di.$parent.planeElement).toContain(sequenceFlow.di);
expect(sequenceFlow.di.$parent).to.eql(task.di.$parent);
expect(sequenceFlow.di.$parent.planeElement).to.include(sequenceFlow.di);
// expect cropped connection
expect(sequenceFlowConnection.waypoints).toDeepEqual([
expect(sequenceFlowConnection.waypoints).eql([
{ 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}
]);
// expect cropped waypoints in di
expect(sequenceFlow.di.waypoint).toDeepEqual([
{ $type: 'dc:Point', x: 292, y: 376 },
{ $type: 'dc:Point', x: 410, y: 376 },
{ $type: 'dc:Point', x: 410, y: 341 },
{ $type: 'dc:Point', x: 528, y: 341 }
var diWaypoints = bpmnFactory.createDiWaypoints([
{ x: 292, y: 376 },
{ x: 410, y: 376 },
{ x: 410, y: 341 },
{ x: 528, y: 341 }
]);
// expect cropped waypoints in di
expect(sequenceFlow.di.waypoint).eql(diWaypoints);
}));
});
@ -94,12 +92,12 @@ describe('features/modeling - create connection', function() {
commandStack.undo();
// then
expect(sequenceFlow.$parent).toBe(null);
expect(sequenceFlow.sourceRef).toBe(null);
expect(sequenceFlow.targetRef).toBe(null);
expect(sequenceFlow.$parent).to.be.null;
expect(sequenceFlow.sourceRef).to.be.null;
expect(sequenceFlow.targetRef).to.be.null;
expect(task.outgoing).not.toContain(sequenceFlow);
expect(gateway.incoming).not.toContain(sequenceFlow);
expect(task.outgoing).not.to.include(sequenceFlow);
expect(gateway.incoming).not.to.include(sequenceFlow);
}));
});
@ -130,22 +128,22 @@ describe('features/modeling - create connection', function() {
commandStack.redo();
// then
expect(sequenceFlow.sourceRef).toBe(task);
expect(sequenceFlow.targetRef).toBe(gateway);
expect(sequenceFlow.sourceRef).to.eql(task);
expect(sequenceFlow.targetRef).to.eql(gateway);
expect(task.outgoing).toContain(sequenceFlow);
expect(gateway.incoming).toContain(sequenceFlow);
expect(task.outgoing).to.include(sequenceFlow);
expect(gateway.incoming).to.include(sequenceFlow);
expect(sequenceFlow.di.$parent).toBe(task.di.$parent);
expect(sequenceFlow.di.$parent.planeElement).toContain(sequenceFlow.di);
expect(sequenceFlow.di.$parent).to.eql(task.di.$parent);
expect(sequenceFlow.di.$parent.planeElement).to.include(sequenceFlow.di);
// expect cropped connection
expect(sequenceFlowConnection.waypoints).toDeepEqual(newWaypoints);
expect(sequenceFlowConnection.waypoints).eql(newWaypoints);
// expect cropped waypoints in di
expect(sequenceFlow.di.waypoint).toDeepEqual(newDiWaypoints);
expect(sequenceFlow.di.waypoint).eql(newDiWaypoints);
}));
});
});
});

View File

@ -2,8 +2,7 @@
/* global bootstrapModeler, inject */
var Matchers = require('../../../Matchers'),
TestHelper = require('../../../TestHelper');
var TestHelper = require('../../../TestHelper');
var modelingModule = require('../../../../lib/features/modeling'),
coreModule = require('../../../../lib/core');
@ -11,9 +10,6 @@ var modelingModule = require('../../../../lib/features/modeling'),
describe('features/modeling - #removeConnection', function() {
beforeEach(Matchers.addDeepEquals);
var diagramXML = require('../../../fixtures/bpmn/sequence-flows.bpmn');
var testModules = [ coreModule, modelingModule ];
@ -33,7 +29,7 @@ describe('features/modeling - #removeConnection', function() {
modeling.removeConnection(sequenceFlowShape);
// then
expect(sequenceFlow.$parent).toBeNull();
expect(sequenceFlow.$parent).to.be.null;
}));
});
@ -52,7 +48,7 @@ describe('features/modeling - #removeConnection', function() {
commandStack.undo();
// then
expect(sequenceFlow.$parent).toBe(parent);
expect(sequenceFlow.$parent).to.eql(parent);
}));
});
@ -71,7 +67,7 @@ describe('features/modeling - #removeConnection', function() {
commandStack.redo();
// then
expect(sequenceFlow.$parent).toBeNull();
expect(sequenceFlow.$parent).to.be.null;
}));
});

View File

@ -39,25 +39,25 @@ describe('features/modeling - delete participant', function() {
modeling.removeShape(participantShape);
// then
expect(participant.$parent).toBeFalsy();
expect(participant.$parent).to.not.be.ok;
var newRootShape = canvas.getRootElement(),
newRootBusinessObject = newRootShape.businessObject;
expect(newRootBusinessObject.$instanceOf('bpmn:Process')).toBe(true);
expect(newRootBusinessObject.$instanceOf('bpmn:Process')).to.be.true;
// collaboration DI is unwired
expect(participantDi.$parent).toBeFalsy();
expect(collaboration.di).toBeFalsy();
expect(participantDi.$parent).to.not.be.ok;
expect(collaboration.di).to.not.be.ok;
expect(bpmnDefinitions.rootElements).not.toContain(process);
expect(bpmnDefinitions.rootElements).not.toContain(collaboration);
expect(bpmnDefinitions.rootElements).to.not.include(process);
expect(bpmnDefinitions.rootElements).to.not.include(collaboration);
// process DI is wired
expect(diPlane.bpmnElement).toBe(newRootBusinessObject);
expect(newRootBusinessObject.di).toBe(diPlane);
expect(diPlane.bpmnElement).to.eql(newRootBusinessObject);
expect(newRootBusinessObject.di).to.eql(diPlane);
expect(bpmnDefinitions.rootElements).toContain(newRootBusinessObject);
expect(bpmnDefinitions.rootElements).to.include(newRootBusinessObject);
}));
@ -78,20 +78,20 @@ describe('features/modeling - delete participant', function() {
commandStack.undo();
// then
expect(participant.$parent).toBe(originalRootElementBo);
expect(originalRootElementBo.$parent).toBe(bpmnDefinitions);
expect(participant.$parent).to.eql(originalRootElementBo);
expect(originalRootElementBo.$parent).to.eql(bpmnDefinitions);
expect(canvas.getRootElement()).toBe(originalRootElement);
expect(canvas.getRootElement()).to.eql(originalRootElement);
// di is unwired
expect(participantDi.$parent).toBe(originalRootElementBo.di);
expect(participantDi.$parent).to.eql(originalRootElementBo.di);
// new di is wired
expect(diPlane.bpmnElement).toBe(originalRootElementBo);
expect(diPlane.bpmnElement).to.eql(originalRootElementBo);
}));
});
});
});
});

View File

@ -29,7 +29,7 @@ describe('features/modeling - #removeShape', function() {
modeling.removeShape(taskShape);
// then
expect(task.$parent).toBeNull();
expect(task.$parent).to.be.null;
}));
});
@ -48,7 +48,7 @@ describe('features/modeling - #removeShape', function() {
commandStack.undo();
// then
expect(task.$parent).toBe(parent);
expect(task.$parent).to.eql(parent);
}));
});
@ -67,7 +67,7 @@ describe('features/modeling - #removeShape', function() {
commandStack.redo();
// then
expect(task.$parent).toBeNull();
expect(task.$parent).to.be.null;
}));
});

View File

@ -30,8 +30,8 @@ describe('features/move - drop', function() {
modeling.moveShape(task_1, { x: 0, y: 200 }, parent);
// then
expect(task_1.parent).toBe(parent);
expect(task_1.businessObject.$parent).toBe(parent.businessObject);
expect(task_1.parent).to.eql(parent);
expect(task_1.businessObject.$parent).to.eql(parent.businessObject);
}));
@ -46,10 +46,10 @@ describe('features/move - drop', function() {
modeling.moveShapes([ task_1, task_2 ], { x: 0, y: 200 }, parent);
// then
expect(task_1.parent).toBe(parent);
expect(task_1.businessObject.$parent).toBe(parent.businessObject);
expect(task_2.parent).toBe(parent);
expect(task_2.businessObject.$parent).toBe(parent.businessObject);
expect(task_1.parent).to.eql(parent);
expect(task_1.businessObject.$parent).to.eql(parent.businessObject);
expect(task_2.parent).to.eql(parent);
expect(task_2.businessObject.$parent).to.eql(parent.businessObject);
}));
});
@ -72,8 +72,8 @@ describe('features/move - drop', function() {
modeling.moveShapes([ task_1 ], { x: 0, y: 200 }, parent);
// then
expect(flow.parent).toBe(null);
expect(flow.businessObject.$parent).toBe(null);
expect(flow.parent).to.be.null;
expect(flow.businessObject.$parent).to.be.null;
}));
@ -89,8 +89,8 @@ describe('features/move - drop', function() {
modeling.moveShapes([ task_1, task_2 ], { x: 0, y: 250 }, parent);
// then
expect(flow.parent).toBe(parent);
expect(flow.businessObject.$parent).toBe(parent.businessObject);
expect(flow.parent).to.eql(parent);
expect(flow.businessObject.$parent).to.eql(parent.businessObject);
}));
});
@ -111,11 +111,11 @@ describe('features/move - drop', function() {
modeling.moveShapes([ task_1 ], { x: 0, y: 200 }, parent);
// then
expect(task_1.parent).toBe(parent);
expect(task_1.businessObject.$parent).toBe(parent.businessObject);
expect(task_1.parent).to.eql(parent);
expect(task_1.businessObject.$parent).to.eql(parent.businessObject);
expect(sequenceFlow.parent).toBe(parent);
expect(sequenceFlow.businessObject.$parent).toBe(parent.businessObject);
expect(sequenceFlow.parent).to.eql(parent);
expect(sequenceFlow.businessObject.$parent).to.eql(parent.businessObject);
}));
});

View File

@ -1,7 +1,6 @@
'use strict';
var Matchers = require('../../../Matchers'),
TestHelper = require('../../../TestHelper');
var TestHelper = require('../../../TestHelper');
/* global bootstrapModeler, inject */
@ -12,9 +11,6 @@ var modelingModule = require('../../../../lib/features/modeling'),
describe('features/modeling - layout connection', function() {
beforeEach(Matchers.addDeepEquals);
var diagramXML = require('../../../fixtures/bpmn/sequence-flows.bpmn');
var testModules = [ coreModule, modelingModule ];
@ -24,7 +20,7 @@ describe('features/modeling - layout connection', function() {
describe('connection handling', function() {
it('should execute', inject(function(elementRegistry, modeling) {
it('should execute', inject(function(elementRegistry, modeling, bpmnFactory) {
// given
var sequenceFlowConnection = elementRegistry.get('SequenceFlow_1'),
@ -37,20 +33,19 @@ describe('features/modeling - layout connection', function() {
// expect cropped, repaired connection
// that was not actually modified
expect(sequenceFlowConnection.waypoints).toDeepEqual([
var waypoints = [
{ original: { x: 578, y: 341 }, x: 578, y: 341 },
{ x: 934, y: 341 },
{ x: 934, y: 436 },
{ original: { x: 832, y: 436 }, x: 832, y: 436 }
]);
];
expect(sequenceFlowConnection.waypoints).eql(waypoints);
// expect cropped waypoints in di
expect(sequenceFlow.di.waypoint).toDeepEqual([
{ $type: 'dc:Point', x: 578, y: 341 },
{ $type: 'dc:Point', x: 934, y: 341 },
{ $type: 'dc:Point', x: 934, y: 436 },
{ $type: 'dc:Point', x: 832, y: 436 }
]);
var diWaypoints = bpmnFactory.createDiWaypoints(waypoints);
expect(sequenceFlow.di.waypoint).eql(diWaypoints);
}));
});
@ -73,8 +68,8 @@ describe('features/modeling - layout connection', function() {
commandStack.undo();
// then
expect(sequenceFlowConnection.waypoints).toDeepEqual(oldWaypoints);
expect(sequenceFlow.di.waypoint).toDeepEqual(oldDiWaypoints);
expect(sequenceFlowConnection.waypoints).eql(oldWaypoints);
expect(sequenceFlow.di.waypoint).eql(oldDiWaypoints);
}));
});
@ -98,10 +93,10 @@ describe('features/modeling - layout connection', function() {
commandStack.redo();
// then
expect(sequenceFlowConnection.waypoints).toDeepEqual(newWaypoints);
expect(sequenceFlow.di.waypoint).toDeepEqual(newDiWaypoints);
expect(sequenceFlowConnection.waypoints).eql(newWaypoints);
expect(sequenceFlow.di.waypoint).eql(newDiWaypoints);
}));
});
});
});

View File

@ -1,7 +1,6 @@
'use strict';
var Matchers = require('../../../Matchers'),
TestHelper = require('../../../TestHelper');
var TestHelper = require('../../../TestHelper');
/* global bootstrapModeler, inject */
@ -12,9 +11,6 @@ var modelingModule = require('../../../../lib/features/modeling'),
describe('features/modeling - layout message flows', function() {
beforeEach(Matchers.addDeepEquals);
var diagramXML = require('../../../fixtures/bpmn/collaboration-message-flows.bpmn');
var testModules = [ coreModule, modelingModule ];
@ -34,7 +30,7 @@ describe('features/modeling - layout message flows', function() {
// then
// expect cropped, repaired manhattan connection
expect(messageFlowConnection.waypoints).toDeepEqual([
expect(messageFlowConnection.waypoints).eql([
{ original: { x: 420, y: 234 }, x: 420, y: 234 },
{ x: 420, y: 387 },
{ x: 318, y: 387 },
@ -55,7 +51,7 @@ describe('features/modeling - layout message flows', function() {
// then
// expect cropped, repaired manhattan connection
expect(messageFlowConnection.waypoints).toDeepEqual([
expect(messageFlowConnection.waypoints).eql([
{ original: { x: 610, y: 194 }, x: 610, y: 194 },
{ original: { x: 610, y: 415 }, x: 610, y: 415 }
]);
@ -74,7 +70,7 @@ describe('features/modeling - layout message flows', function() {
// then
// expect cropped, repaired manhattan connection
expect(messageFlowConnection.waypoints).toDeepEqual([
expect(messageFlowConnection.waypoints).eql([
{ original: { x: 671, y: 214 }, x: 671, y: 214 },
{ original: { x: 671, y: 465 }, x: 671, y: 465 }
]);
@ -95,7 +91,7 @@ describe('features/modeling - layout message flows', function() {
// then
// expect cropped, repaired manhattan connection
expect(messageFlowConnection.waypoints).toDeepEqual([
expect(messageFlowConnection.waypoints).eql([
{ original: { x: 671, y: 214 }, x: 671, y: 214 },
{ x: 671, y: 315 },
{ x: 471, y: 315 },
@ -103,4 +99,4 @@ describe('features/modeling - layout message flows', function() {
]);
}));
});
});

View File

@ -1,7 +1,6 @@
'use strict';
var Matchers = require('../../../Matchers'),
TestHelper = require('../../../TestHelper');
var TestHelper = require('../../../TestHelper');
/* global bootstrapModeler, inject */
@ -12,9 +11,6 @@ var modelingModule = require('../../../../lib/features/modeling'),
describe('features/modeling - move connection', function() {
beforeEach(Matchers.addDeepEquals);
var diagramXML = require('../../../fixtures/bpmn/sequence-flows.bpmn');
var testModules = [ coreModule, modelingModule ];
@ -24,7 +20,7 @@ describe('features/modeling - move connection', function() {
describe('connection handling', function() {
it('should execute', inject(function(elementRegistry, modeling) {
it('should execute', inject(function(elementRegistry, modeling, bpmnFactory) {
// given
var sequenceFlowConnection = elementRegistry.get('SequenceFlow_1'),
@ -33,23 +29,22 @@ describe('features/modeling - move connection', function() {
// when
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 }
];
// then
// expect cropped connection
expect(sequenceFlowConnection.waypoints).toDeepEqual([
{ x: 598, y: 351 },
{ x: 954, y: 351 },
{ x: 954, y: 446 },
{ x: 852, y: 446 }
]);
expect(sequenceFlowConnection.waypoints).eql(waypoints);
// expect cropped waypoints in di
expect(sequenceFlow.di.waypoint).toDeepEqual([
{ $type: 'dc:Point', x: 598, y: 351 },
{ $type: 'dc:Point', x: 954, y: 351 },
{ $type: 'dc:Point', x: 954, y: 446 },
{ $type: 'dc:Point', x: 852, y: 446 }
]);
var diWaypoints = bpmnFactory.createDiWaypoints(waypoints);
expect(sequenceFlow.di.waypoint).eql(diWaypoints);
}));
});
@ -72,8 +67,8 @@ describe('features/modeling - move connection', function() {
commandStack.undo();
// then
expect(sequenceFlowConnection.waypoints).toDeepEqual(oldWaypoints);
expect(sequenceFlow.di.waypoint).toDeepEqual(oldDiWaypoints);
expect(sequenceFlowConnection.waypoints).eql(oldWaypoints);
expect(sequenceFlow.di.waypoint).eql(oldDiWaypoints);
}));
});
@ -97,8 +92,8 @@ describe('features/modeling - move connection', function() {
commandStack.redo();
// then
expect(sequenceFlowConnection.waypoints).toDeepEqual(newWaypoints);
expect(sequenceFlow.di.waypoint).toDeepEqual(newDiWaypoints);
expect(sequenceFlowConnection.waypoints).eql(newWaypoints);
expect(sequenceFlow.di.waypoint).eql(newDiWaypoints);
}));
});

View File

@ -1,7 +1,6 @@
'use strict';
var Matchers = require('../../../Matchers'),
TestHelper = require('../../../TestHelper');
var TestHelper = require('../../../TestHelper');
/* global bootstrapModeler, inject */
@ -12,9 +11,6 @@ var modelingModule = require('../../../../lib/features/modeling'),
describe('features/modeling - move shape', function() {
beforeEach(Matchers.addDeepEquals);
var diagramXML = require('../../../fixtures/bpmn/simple.bpmn');
var testModules = [ coreModule, modelingModule ];
@ -24,7 +20,7 @@ describe('features/modeling - move shape', function() {
describe('shape', function() {
it('should move', inject(function(elementRegistry, modeling) {
it('should move', inject(function(elementRegistry, modeling, bpmnFactory) {
// given
var startEventElement = elementRegistry.get('StartEvent_1'),
@ -42,23 +38,25 @@ describe('features/modeling - move shape', function() {
modeling.moveShape(startEventElement, { x: 0, y: 50 });
// then
expect(startEvent.di.bounds.x).toBe(oldPosition.x);
expect(startEvent.di.bounds.y).toBe(oldPosition.y + 50);
expect(startEvent.di.bounds.x).to.equal(oldPosition.x);
expect(startEvent.di.bounds.y).to.equal(oldPosition.y + 50);
// expect flow layout
expect(sequenceFlowElement.waypoints).toDeepEqual([
expect(sequenceFlowElement.waypoints).to.eql([
{ original: { x: 388, y: 310 }, x: 388, y: 310 },
{ x: 404, y: 310 },
{ x: 404, y: 260 },
{ original: { x: 420, y: 260 }, x: 420, y: 260 }
]);
expect(sequenceFlow.di.waypoint).toDeepEqual([
{ $type: 'dc:Point', x: 388, y: 310 },
{ $type: 'dc:Point', x: 404, y: 310 },
{ $type: 'dc:Point', x: 404, y: 260 },
{ $type: 'dc:Point', x: 420, y: 260 }
var diWaypoints = bpmnFactory.createDiWaypoints([
{x: 388, y: 310 },
{x: 404, y: 310 },
{x: 404, y: 260 },
{x: 420, y: 260 }
]);
expect(sequenceFlow.di.waypoint).to.eql(diWaypoints);
}));
@ -77,8 +75,8 @@ describe('features/modeling - move shape', function() {
modeling.moveShape(labelElement, { x: 0, y: 50 });
// then
expect(startEvent.di.label.bounds.x).toBe(oldPosition.x);
expect(startEvent.di.label.bounds.y).toBe(oldPosition.y + 50);
expect(startEvent.di.label.bounds.x).to.equal(oldPosition.x);
expect(startEvent.di.label.bounds.y).to.equal(oldPosition.y + 50);
}));
@ -96,11 +94,11 @@ describe('features/modeling - move shape', function() {
modeling.moveShape(labelElement, { x: 0, y: 50 }, processElement);
// then
expect(labelElement.parent).toBe(processElement);
expect(labelElement.parent).to.eql(processElement);
// expect actual element + businessObject to be unchanged
expect(startEventElement.parent).toBe(subProcessElement);
expect(startEvent.$parent).toBe(subProcess);
expect(startEventElement.parent).to.eql(subProcessElement);
expect(startEvent.$parent).to.eql(subProcess);
}));
@ -123,8 +121,8 @@ describe('features/modeling - move shape', function() {
commandStack.undo();
// then
expect(startEvent.di.bounds.x).toBe(oldPosition.x);
expect(startEvent.di.bounds.y).toBe(oldPosition.y);
expect(startEvent.di.bounds.x).to.equal(oldPosition.x);
expect(startEvent.di.bounds.y).to.equal(oldPosition.y);
}));
@ -145,8 +143,8 @@ describe('features/modeling - move shape', function() {
commandStack.undo();
// then
expect(startEvent.di.label.bounds.x).toBe(oldPosition.x);
expect(startEvent.di.label.bounds.y).toBe(oldPosition.y);
expect(startEvent.di.label.bounds.x).to.equal(oldPosition.x);
expect(startEvent.di.label.bounds.y).to.equal(oldPosition.y);
}));
});
@ -173,8 +171,8 @@ describe('features/modeling - move shape', function() {
commandStack.redo();
// then
expect(startEvent.di.bounds.x).toBe(newPosition.x);
expect(startEvent.di.bounds.y).toBe(newPosition.y);
expect(startEvent.di.bounds.x).to.equal(newPosition.x);
expect(startEvent.di.bounds.y).to.equal(newPosition.y);
}));
@ -196,8 +194,8 @@ describe('features/modeling - move shape', function() {
commandStack.redo();
// then
expect(startEvent.di.label.bounds.x).toBe(newPosition.x);
expect(startEvent.di.label.bounds.y).toBe(newPosition.y);
expect(startEvent.di.label.bounds.x).to.equal(newPosition.x);
expect(startEvent.di.label.bounds.y).to.equal(newPosition.y);
}));
});
@ -224,8 +222,8 @@ describe('features/modeling - move shape', function() {
modeling.moveShapes([ startEventElement ], { x: 40, y: -80 });
// then
expect(label.x).toBe(labelPosition.x + 40);
expect(label.y).toBe(labelPosition.y - 80);
expect(label.x).to.equal(labelPosition.x + 40);
expect(label.y).to.equal(labelPosition.y - 80);
}));
@ -247,8 +245,8 @@ describe('features/modeling - move shape', function() {
modeling.moveShapes([ startEventElement, subProcessElement ], { x: 40, y: -80 });
// then
expect(flowLabel.x).toBe(labelPosition.x + 40);
expect(flowLabel.y).toBe(labelPosition.y - 80);
expect(flowLabel.x).to.equal(labelPosition.x + 40);
expect(flowLabel.y).to.equal(labelPosition.y - 80);
}));
@ -273,8 +271,8 @@ describe('features/modeling - move shape', function() {
commandStack.undo();
// then
expect(label.x).toBe(labelPosition.x);
expect(label.y).toBe(labelPosition.y);
expect(label.x).to.equal(labelPosition.x);
expect(label.y).to.equal(labelPosition.y);
}));
@ -298,8 +296,8 @@ describe('features/modeling - move shape', function() {
commandStack.undo();
// then
expect(flowLabel.x).toBe(labelPosition.x);
expect(flowLabel.y).toBe(labelPosition.y);
expect(flowLabel.x).to.equal(labelPosition.x);
expect(flowLabel.y).to.equal(labelPosition.y);
}));
});
@ -327,8 +325,8 @@ describe('features/modeling - move shape', function() {
commandStack.redo();
// then
expect(label.x).toBe(labelPosition.x + 40);
expect(label.y).toBe(labelPosition.y - 80);
expect(label.x).to.equal(labelPosition.x + 40);
expect(label.y).to.equal(labelPosition.y - 80);
}));
@ -353,8 +351,8 @@ describe('features/modeling - move shape', function() {
commandStack.redo();
// then
expect(flowLabel.x).toBe(labelPosition.x + 40);
expect(flowLabel.y).toBe(labelPosition.y - 80);
expect(flowLabel.x).to.equal(labelPosition.x + 40);
expect(flowLabel.y).to.equal(labelPosition.y - 80);
}));
});

View File

@ -1,7 +1,6 @@
'use strict';
var Matchers = require('../../../Matchers'),
TestHelper = require('../../../TestHelper');
var TestHelper = require('../../../TestHelper');
/* global bootstrapModeler, inject */
@ -12,9 +11,6 @@ var modelingModule = require('../../../../lib/features/modeling'),
describe('features/modeling - resize shape', function() {
beforeEach(Matchers.addDeepEquals);
var diagramXML = require('../../../fixtures/bpmn/simple-resizable.bpmn');
var testModules = [ coreModule, modelingModule ];
@ -25,7 +21,7 @@ describe('features/modeling - resize shape', function() {
describe('shape', function() {
it('should resize', inject(function(elementRegistry, modeling) {
it('should resize', inject(function(elementRegistry, modeling, bpmnFactory) {
// given
var subProcessElement = elementRegistry.get('SubProcess_1');
@ -41,14 +37,16 @@ describe('features/modeling - resize shape', function() {
// then
// expect flow layout
expect(sequenceFlow.di.waypoint).toDeepEqual([
{ $type: 'dc:Point', x: 589, y: 242 },
{ $type: 'dc:Point', x: 821, y: 242 }
var diWaypoints = bpmnFactory.createDiWaypoints([
{ x: 589, y: 242 },
{ x: 821, y: 242 }
]);
expect(sequenceFlow.di.waypoint).eql(diWaypoints);
}));
it('should move', inject(function(elementRegistry, modeling) {
it('should move', inject(function(elementRegistry, modeling, bpmnFactory) {
// given
var subProcessElement = elementRegistry.get('SubProcess_1');
@ -62,10 +60,12 @@ describe('features/modeling - resize shape', function() {
// then
// expect flow layout
expect(sequenceFlow.di.waypoint).toDeepEqual([
{ $type: 'dc:Point', x: 639, y: 242 },
{ $type: 'dc:Point', x: 821, y: 242 }
var diWaypoints = bpmnFactory.createDiWaypoints([
{ x: 639, y: 242 },
{ x: 821, y: 242 }
]);
expect(sequenceFlow.di.waypoint).eql(diWaypoints);
}));
});

View File

@ -1,7 +1,6 @@
'use strict';
var Matchers = require('../../../Matchers'),
TestHelper = require('../../../TestHelper');
var TestHelper = require('../../../TestHelper');
/* global bootstrapModeler, inject */
@ -12,9 +11,6 @@ var modelingModule = require('../../../../lib/features/modeling'),
describe('features/modeling - create/remove space', function() {
beforeEach(Matchers.addDeepEquals);
var diagramXML = require('../../../fixtures/bpmn/simple.bpmn');
var testModules = [ coreModule, modelingModule ];
@ -25,7 +21,7 @@ describe('features/modeling - create/remove space', function() {
describe('create space', function() {
it('should create space to the right', inject(function(elementRegistry, modeling) {
it('should create space to the right', inject(function(elementRegistry, modeling, bpmnFactory) {
// given
var sequenceFlowElement = elementRegistry.get('SequenceFlow_3'),
@ -55,21 +51,23 @@ describe('features/modeling - create/remove space', function() {
modeling.createSpace([subProcessElement, endEventElement], [], delta, direction);
// then
expect(subProcess.di.bounds.x).toBe(subProcOldPos.x + 50);
expect(subProcess.di.bounds.y).toBe(subProcOldPos.y);
expect(subProcess.di.bounds.x).to.equal(subProcOldPos.x + 50);
expect(subProcess.di.bounds.y).to.equal(subProcOldPos.y);
expect(endEvent.di.bounds.x).toBe(endEventOldPos.x + 50);
expect(endEvent.di.bounds.y).toBe(endEventOldPos.y);
expect(endEvent.di.bounds.x).to.equal(endEventOldPos.x + 50);
expect(endEvent.di.bounds.y).to.equal(endEventOldPos.y);
expect(sequenceFlow.di.waypoint).toDeepEqual([
{ $type: 'dc:Point', x: 144, y: 230 },
{ $type: 'dc:Point', x: 350, y: 230 },
var diWaypoints = bpmnFactory.createDiWaypoints([
{ x: 144, y: 230 },
{ x: 350, y: 230 }
]);
expect(sequenceFlow.di.waypoint).eql(diWaypoints);
}));
it('should create space downwards', inject(function(elementRegistry, modeling) {
it('should create space downwards', inject(function(elementRegistry, modeling, bpmnFactory) {
// given
var startEventElement = elementRegistry.get('StartEvent_2'),
startEvent = startEventElement.businessObject;
@ -105,24 +103,26 @@ describe('features/modeling - create/remove space', function() {
modeling.createSpace([startEventElement ,subProcessElement, endEventElement], [], delta, direction);
// then
expect(startEvent.di.bounds.x).toBe(startEventOldPos.x);
expect(startEvent.di.bounds.y).toBe(startEventOldPos.y + 50);
expect(startEvent.di.bounds.x).to.equal(startEventOldPos.x);
expect(startEvent.di.bounds.y).to.equal(startEventOldPos.y + 50);
expect(subProcess.di.bounds.x).toBe(subProcOldPos.x);
expect(subProcess.di.bounds.y).toBe(subProcOldPos.y + 50);
expect(subProcess.di.bounds.x).to.equal(subProcOldPos.x);
expect(subProcess.di.bounds.y).to.equal(subProcOldPos.y + 50);
expect(endEvent.di.bounds.x).toBe(endEventOldPos.x);
expect(endEvent.di.bounds.y).toBe(endEventOldPos.y + 50);
expect(endEvent.di.bounds.x).to.equal(endEventOldPos.x);
expect(endEvent.di.bounds.y).to.equal(endEventOldPos.y + 50);
expect(sequenceFlow.di.waypoint).toDeepEqual([
{ $type: 'dc:Point', x: 144, y: 280 },
{ $type: 'dc:Point', x: 300, y: 280 },
var diWaypoints = bpmnFactory.createDiWaypoints([
{ x: 144, y: 280 },
{ x: 300, y: 280 }
]);
expect(sequenceFlow.di.waypoint).eql(diWaypoints);
}));
it('should remove space to the left', inject(function(elementRegistry, modeling) {
it('should remove space to the left', inject(function(elementRegistry, modeling, bpmnFactory) {
// given
var sequenceFlowElement = elementRegistry.get('SequenceFlow_3'),
sequenceFlow = sequenceFlowElement.businessObject;
@ -150,21 +150,23 @@ describe('features/modeling - create/remove space', function() {
modeling.createSpace([subProcessElement, endEventElement], [], delta, direction);
// then
expect(subProcess.di.bounds.x).toBe(subProcOldPos.x - 50);
expect(subProcess.di.bounds.y).toBe(subProcOldPos.y);
expect(subProcess.di.bounds.x).to.equal(subProcOldPos.x - 50);
expect(subProcess.di.bounds.y).to.equal(subProcOldPos.y);
expect(endEvent.di.bounds.x).toBe(endEventOldPos.x - 50);
expect(endEvent.di.bounds.y).toBe(endEventOldPos.y);
expect(endEvent.di.bounds.x).to.equal(endEventOldPos.x - 50);
expect(endEvent.di.bounds.y).to.equal(endEventOldPos.y);
expect(sequenceFlow.di.waypoint).toDeepEqual([
{ $type: 'dc:Point', x: 144, y: 230 },
{ $type: 'dc:Point', x: 250, y: 230 },
var diWaypoints = bpmnFactory.createDiWaypoints([
{ x: 144, y: 230 },
{ x: 250, y: 230 }
]);
expect(sequenceFlow.di.waypoint).eql(diWaypoints);
}));
it('should resize to the right', inject(function(elementRegistry, modeling) {
// given
var taskElement = elementRegistry.get('Task_1'),
task = taskElement.businessObject;
@ -207,19 +209,19 @@ describe('features/modeling - create/remove space', function() {
modeling.createSpace([startEventElement, startEventElement2, taskElement], [subProcessElement], delta, direction);
// then
expect(subProcess.di.bounds.x).toBe(subProcOldPos.x + 50);
expect(subProcess.di.bounds.y).toBe(subProcOldPos.y);
expect(subProcess.di.bounds.width).toBe(subProcOldPos.width - 50);
expect(subProcess.di.bounds.height).toBe(subProcOldPos.height);
expect(subProcess.di.bounds.x).to.equal(subProcOldPos.x + 50);
expect(subProcess.di.bounds.y).to.equal(subProcOldPos.y);
expect(subProcess.di.bounds.width).to.equal(subProcOldPos.width - 50);
expect(subProcess.di.bounds.height).to.equal(subProcOldPos.height);
expect(startEvent.di.bounds.x).toBe(startEventOldPos.x + 50);
expect(startEvent.di.bounds.y).toBe(startEventOldPos.y);
expect(startEvent.di.bounds.x).to.equal(startEventOldPos.x + 50);
expect(startEvent.di.bounds.y).to.equal(startEventOldPos.y);
expect(startEvent2.di.bounds.x).toBe(startEventOldPos2.x + 50);
expect(startEvent2.di.bounds.y).toBe(startEventOldPos2.y);
expect(startEvent2.di.bounds.x).to.equal(startEventOldPos2.x + 50);
expect(startEvent2.di.bounds.y).to.equal(startEventOldPos2.y);
expect(task.di.bounds.x).toBe(taskOldPos.x + 50);
expect(task.di.bounds.y).toBe(taskOldPos.y);
expect(task.di.bounds.x).to.equal(taskOldPos.x + 50);
expect(task.di.bounds.y).to.equal(taskOldPos.y);
}));
});

View File

@ -46,11 +46,11 @@ describe('features/modeling - update properties', function() {
modeling.updateProperties(taskShape, { loopCharacteristics: loopCharacteristics });
// then
expect(taskShape.businessObject.loopCharacteristics).toBe(loopCharacteristics);
expect(taskShape.businessObject.loopCharacteristics).to.eql(loopCharacteristics);
// task shape got updated
expect(updatedElements).toContain(taskShape);
expect(updatedElements).to.include(taskShape);
}));
@ -63,10 +63,10 @@ describe('features/modeling - update properties', function() {
modeling.updateProperties(gatewayShape, { 'default': undefined });
// then
expect(gatewayShape.businessObject['default']).not.toBeDefined();
expect(gatewayShape.businessObject['default']).not.to.be.defined;
// flow got updated, too
expect(updatedElements).toContain(elementRegistry.get('SequenceFlow_1'));
expect(updatedElements).to.include(elementRegistry.get('SequenceFlow_1'));
}));
@ -79,10 +79,10 @@ describe('features/modeling - update properties', function() {
modeling.updateProperties(flowConnection, { name: 'FOO BAR' });
// then
expect(flowConnection.businessObject.name).toBe('FOO BAR');
expect(flowConnection.businessObject.name).to.equal('FOO BAR');
// flow label got updated, too
expect(updatedElements).toContain(elementRegistry.get('SequenceFlow_1_label'));
expect(updatedElements).to.include(elementRegistry.get('SequenceFlow_1_label'));
}));
@ -95,7 +95,7 @@ describe('features/modeling - update properties', function() {
modeling.updateProperties(flowConnection, { name: undefined });
// then
expect(flowConnection.businessObject.name).not.toBeDefined();
expect(flowConnection.businessObject.name).not.to.be.defined;
}));
@ -108,8 +108,8 @@ describe('features/modeling - update properties', function() {
modeling.updateProperties(flowConnection, { id: 'FOO_BAR' });
// then
expect(flowConnection.businessObject.id).toBe('FOO_BAR');
expect(flowConnection.id).toBe('FOO_BAR');
expect(flowConnection.businessObject.id).to.equal('FOO_BAR');
expect(flowConnection.id).to.equal('FOO_BAR');
}));
@ -125,8 +125,8 @@ describe('features/modeling - update properties', function() {
});
// then
expect(flowConnection.businessObject.get('xmlns:foo')).toBe('http://foo');
expect(flowConnection.businessObject.get('foo:customAttr')).toBe('FOO');
expect(flowConnection.businessObject.get('xmlns:foo')).to.equal('http://foo');
expect(flowConnection.businessObject.get('foo:customAttr')).to.equal('FOO');
}));
});
@ -146,7 +146,7 @@ describe('features/modeling - update properties', function() {
commandStack.undo();
// then
expect(taskShape.businessObject.loopCharactersistics).not.toBeDefined();
expect(taskShape.businessObject.loopCharactersistics).not.to.be.defined;
}));
@ -160,10 +160,10 @@ describe('features/modeling - update properties', function() {
commandStack.undo();
// then
expect(gatewayShape.businessObject['default']).toBeDefined();
expect(gatewayShape.businessObject['default']).to.be.defined;
// flow got updated, too
expect(updatedElements).toContain(elementRegistry.get('SequenceFlow_1'));
expect(updatedElements).to.include(elementRegistry.get('SequenceFlow_1'));
}));
@ -177,10 +177,10 @@ describe('features/modeling - update properties', function() {
commandStack.undo();
// then
expect(flowConnection.businessObject.name).toBe('default');
expect(flowConnection.businessObject.name).to.equal('default');
// flow got updated, too
expect(updatedElements).toContain(elementRegistry.get('SequenceFlow_1_label'));
expect(updatedElements).to.include(elementRegistry.get('SequenceFlow_1_label'));
}));
@ -195,7 +195,7 @@ describe('features/modeling - update properties', function() {
commandStack.undo();
// then
expect(flowConnection.businessObject.name).toBe('conditional');
expect(flowConnection.businessObject.name).to.equal('conditional');
}));
@ -209,8 +209,8 @@ describe('features/modeling - update properties', function() {
commandStack.undo();
// then
expect(flowConnection.businessObject.id).toBe('SequenceFlow_1');
expect(flowConnection.id).toBe('SequenceFlow_1');
expect(flowConnection.businessObject.id).to.equal('SequenceFlow_1');
expect(flowConnection.id).to.equal('SequenceFlow_1');
}));
@ -228,8 +228,8 @@ describe('features/modeling - update properties', function() {
commandStack.undo();
// then
expect(flowConnection.businessObject.get('xmlns:foo')).toBe(undefined);
expect(flowConnection.businessObject.get('foo:customAttr')).toBe(undefined);
expect(flowConnection.businessObject.get('xmlns:foo')).to.be.undefined;
expect(flowConnection.businessObject.get('foo:customAttr')).to.be.undefined;
}));
});
@ -250,7 +250,7 @@ describe('features/modeling - update properties', function() {
commandStack.redo();
// then
expect(taskShape.businessObject.loopCharacteristics).toBe(loopCharacteristics);
expect(taskShape.businessObject.loopCharacteristics).to.eql(loopCharacteristics);
}));
@ -265,10 +265,10 @@ describe('features/modeling - update properties', function() {
commandStack.redo();
// then
expect(gatewayShape.businessObject['default']).not.toBeDefined();
expect(gatewayShape.businessObject['default']).not.to.be.defined;
// flow got updated, too
expect(updatedElements).toContain(elementRegistry.get('SequenceFlow_1'));
expect(updatedElements).to.include(elementRegistry.get('SequenceFlow_1'));
}));
@ -283,10 +283,10 @@ describe('features/modeling - update properties', function() {
commandStack.redo();
// then
expect(flowConnection.businessObject.name).toBe('FOO BAR');
expect(flowConnection.businessObject.name).to.equal('FOO BAR');
// flow got updated, too
expect(updatedElements).toContain(elementRegistry.get('SequenceFlow_1_label'));
expect(updatedElements).to.include(elementRegistry.get('SequenceFlow_1_label'));
}));
@ -302,7 +302,7 @@ describe('features/modeling - update properties', function() {
commandStack.redo();
// then
expect(flowConnection.businessObject.name).not.toBeDefined();
expect(flowConnection.businessObject.name).not.to.be.defined;
}));
});

View File

@ -41,19 +41,19 @@ describe('features/modeling - append text-annotation', function() {
var connecting = connectingConnection.businessObject;
// then
expect(annotationShape).toBeDefined();
expect(annotation.$instanceOf('bpmn:TextAnnotation')).toBe(true);
expect(annotationShape).to.be.defined;
expect(annotation.$instanceOf('bpmn:TextAnnotation')).to.be.true;
expect(connecting.$instanceOf('bpmn:Association')).toBe(true);
expect(connecting.sourceRef).toBe(eventShape.businessObject);
expect(connecting.targetRef).toBe(annotation);
expect(connecting.$instanceOf('bpmn:Association')).to.be.true;
expect(connecting.sourceRef).to.eql(eventShape.businessObject);
expect(connecting.targetRef).to.eql(annotation);
// correctly assign artifact parent
expect(annotation.$parent).toBe(process);
expect(connecting.$parent).toBe(process);
expect(annotation.$parent).to.eql(process);
expect(connecting.$parent).to.eql(process);
expect(process.artifacts).toContain(annotation);
expect(process.artifacts).toContain(connecting);
expect(process.artifacts).to.include(annotation);
expect(process.artifacts).to.include(connecting);
}));
@ -73,16 +73,16 @@ describe('features/modeling - append text-annotation', function() {
var connecting = connectingConnection.businessObject;
// then
expect(annotationShape).toBeDefined();
expect(annotation.$instanceOf('bpmn:TextAnnotation')).toBe(true);
expect(annotationShape).to.be.defined;
expect(annotation.$instanceOf('bpmn:TextAnnotation')).to.be.true;
expect(connecting.$instanceOf('bpmn:Association')).toBe(true);
expect(connecting.sourceRef).toBe(eventShape.businessObject);
expect(connecting.targetRef).toBe(annotation);
expect(connecting.$instanceOf('bpmn:Association')).to.be.true;
expect(connecting.sourceRef).to.eql(eventShape.businessObject);
expect(connecting.targetRef).to.eql(annotation);
// correctly assign artifact parent
expect(annotation.$parent.id).toBe('Transaction_2');
expect(connecting.$parent.id).toBe('Transaction_2');
expect(annotation.$parent.id).to.equal('Transaction_2');
expect(connecting.$parent.id).to.equal('Transaction_2');
}));
});
@ -109,13 +109,13 @@ describe('features/modeling - append text-annotation', function() {
commandStack.undo();
// then
expect(connecting.sourceRef).toBe(null);
expect(connecting.targetRef).toBe(null);
expect(connecting.$parent).toBe(null);
expect(process.artifacts).not.toContain(connecting);
expect(connecting.sourceRef).to.be.null;
expect(connecting.targetRef).to.be.null;
expect(connecting.$parent).to.be.null;
expect(process.artifacts).not.to.include(connecting);
expect(annotation.$parent).toBe(null);
expect(process.artifacts).not.toContain(annotation);
expect(annotation.$parent).to.be.null;
expect(process.artifacts).not.to.include(annotation);
}));
});

View File

@ -36,27 +36,27 @@ describe('features/modeling - create participant', function() {
modeling.createShape(participantShape, { x: 350, y: 200 }, processShape);
// then
expect(participant.processRef).toBe(process);
expect(participant.processRef).to.eql(process);
var collaborationRoot = canvas.getRootElement(),
collaboration = collaborationRoot.businessObject,
collaborationDi = collaboration.di;
expect(collaboration.$instanceOf('bpmn:Collaboration')).toBe(true);
expect(collaboration.$instanceOf('bpmn:Collaboration')).to.be.true;
// participant / collaboration are wired
expect(participant.$parent).toBe(collaboration);
expect(collaboration.participants).toContain(participant);
expect(participant.$parent).to.eql(collaboration);
expect(collaboration.participants).to.include(participant);
// collaboration is added to root elements
expect(collaboration.$parent).toBe(process.$parent);
expect(collaboration.$parent).to.eql(process.$parent);
// di is wired
var participantDi = participant.di;
expect(participantDi.$parent).toBe(collaborationDi);
expect(collaborationDi.$parent).toBe(diRoot);
expect(participantDi.$parent).to.eql(collaborationDi);
expect(collaborationDi.$parent).to.eql(diRoot);
}));
@ -81,16 +81,16 @@ describe('features/modeling - create participant', function() {
// then
expect(participant.processRef).toBe(oldParticipantProcessRef);
expect(participant.processRef).to.eql(oldParticipantProcessRef);
expect(participant.$parent).toBe(null);
expect(collaboration.participants).not.toContain(participant);
expect(participant.$parent).to.be.null;
expect(collaboration.participants).not.to.include(participant);
// collaboration is detached
expect(collaboration.$parent).toBe(null);
expect(collaboration.$parent).to.be.null;
// di is wired
expect(processDi.$parent).toBe(diRoot);
expect(processDi.$parent).to.eql(diRoot);
}));
});
@ -115,15 +115,15 @@ describe('features/modeling - create participant', function() {
modeling.createShape(participantShape, { x: 350, y: 200 }, processShape);
// then
expect(participant.processRef).toBe(process);
expect(participant.processRef).to.eql(process);
var newRootShape = canvas.getRootElement(),
collaboration = newRootShape.businessObject;
expect(collaboration.$instanceOf('bpmn:Collaboration')).toBe(true);
expect(collaboration.$instanceOf('bpmn:Collaboration')).to.be.true;
expect(participant.$parent).toBe(collaboration);
expect(collaboration.participants).toContain(participant);
expect(participant.$parent).to.eql(collaboration);
expect(collaboration.participants).to.include(participant);
}));
@ -144,12 +144,12 @@ describe('features/modeling - create participant', function() {
rootShapeDi = rootElement.businessObject.di;
// then
expect(participantShape.children.length).toBe(0);
expect(processShape.children.length).toBe(9);
expect(participantShape.children.length).to.equal(0);
expect(processShape.children.length).to.equal(9);
// children di is wired
expect(startEventDi.$parent).toEqual(rootShapeDi);
expect(rootShapeDi.planeElement).toContain(startEventDi);
expect(startEventDi.$parent).to.eql(rootShapeDi);
expect(rootShapeDi.planeElement).to.include(startEventDi);
}));
@ -164,8 +164,8 @@ describe('features/modeling - create participant', function() {
rootShapeDi = rootElement.businessObject.di;
// then
expect(startEventDi.$parent).toBeFalsy();
expect(rootShapeDi.planeElement).not.toContain(startEventDi);
expect(startEventDi.$parent).to.not.be.ok;
expect(rootShapeDi.planeElement).not.to.include(startEventDi);
}));
});
@ -192,10 +192,10 @@ describe('features/modeling - create participant', function() {
modeling.createShape(participantShape, { x: 350, y: 500 }, collaborationRoot);
// then
expect(collaborationRoot.children).toContain(participantShape);
expect(collaborationRoot.children).to.include(participantShape);
expect(participant.$parent).toBe(collaboration);
expect(collaboration.participants).toContain(participant);
expect(participant.$parent).to.eql(collaboration);
expect(collaboration.participants).to.include(participant);
}));
@ -213,12 +213,12 @@ describe('features/modeling - create participant', function() {
commandStack.undo();
// then
expect(collaborationRoot.children).not.toContain(participantShape);
expect(collaborationRoot.children).not.to.include(participantShape);
expect(participant.$parent).toBeFalsy();
expect(collaboration.participants).not.toContain(participant);
expect(participant.$parent).to.not.be.ok;
expect(collaboration.participants).not.to.include(participant);
}));
});
});
});

View File

@ -1,8 +1,5 @@
'use strict';
var TestHelper = require('../../../../TestHelper'),
Matchers = require('../../../../Matchers');
/* global inject, bootstrapModeler */
@ -11,9 +8,6 @@ var modelingModule = require('../../../../../lib/features/modeling');
describe('modeling/behavior - drop on connection', function(){
beforeEach(Matchers.addDeepEquals);
var diagramXML = require('./CreateOnFlowBehavior.bpmn');
beforeEach(bootstrapModeler(diagramXML, { modules: modelingModule }));
@ -28,7 +22,7 @@ describe('modeling/behavior - drop on connection', function(){
var intermediateThrowEvent = elementFactory.createShape({ type: 'bpmn:IntermediateThrowEvent' });
// then
expect(bpmnRules.canCreate(intermediateThrowEvent, sequenceFlow)).toBe(true);
expect(bpmnRules.canCreate(intermediateThrowEvent, sequenceFlow)).to.be.true;
}));
});
@ -55,24 +49,24 @@ describe('modeling/behavior - drop on connection', function(){
var targetConnection = newShape.outgoing[0];
// new incoming connection
expect(newShape.incoming.length).toBe(1);
expect(newShape.incoming[0]).toBe(sequenceFlow);
expect(newShape.incoming.length).to.equal(1);
expect(newShape.incoming[0]).to.eql(sequenceFlow);
// new outgoing connection
expect(newShape.outgoing.length).toBe(1);
expect(targetConnection).toBeTruthy();
expect(targetConnection.type).toBe('bpmn:SequenceFlow');
expect(newShape.outgoing.length).to.equal(1);
expect(targetConnection).to.be.ok;
expect(targetConnection.type).to.equal('bpmn:SequenceFlow');
expect(startEvent.outgoing[0]).toBe(newShape.incoming[0]);
expect(task.incoming[0]).toBe(newShape.outgoing[0]);
expect(startEvent.outgoing[0]).to.equal(newShape.incoming[0]);
expect(task.incoming[0]).to.equal(newShape.outgoing[0]);
// split target at insertion point
expect(sequenceFlow.waypoints).toDeepEqual([
expect(sequenceFlow.waypoints).eql([
{ original: { x: 209, y: 120 }, x: 209, y: 120 },
{ original: { x: 340, y: 120 }, x: 322, y: 120 }
]);
expect(targetConnection.waypoints).toDeepEqual([
expect(targetConnection.waypoints).eql([
{ original: { x: 340, y: 120 }, x: 340, y: 138 },
{ x: 340, y: 299 },
{ original: { x: 502, y: 299 }, x: 502, y: 299 }
@ -95,14 +89,14 @@ describe('modeling/behavior - drop on connection', function(){
// then
// new incoming connection
expect(newShape.incoming.length).toBe(1);
expect(newShape.incoming[0]).toBe(sequenceFlow);
expect(newShape.incoming.length).to.equal(1);
expect(newShape.incoming[0]).to.eql(sequenceFlow);
// no outgoing edges
expect(newShape.outgoing.length).toBe(0);
expect(newShape.outgoing.length).to.equal(0);
// split target at insertion point
expect(sequenceFlow.waypoints).toDeepEqual([
expect(sequenceFlow.waypoints).eql([
{ original: { x: 209, y: 120 }, x: 209, y: 120 },
{ original: { x: 340, y: 120 }, x: 322, y: 120 }
]);
@ -124,14 +118,14 @@ describe('modeling/behavior - drop on connection', function(){
// then
// no incoming connection
expect(newShape.incoming.length).toBe(0);
expect(newShape.incoming.length).to.equal(0);
// no outgoing edges
expect(newShape.outgoing.length).toBe(1);
expect(newShape.outgoing[0]).toBe(sequenceFlow);
expect(newShape.outgoing.length).to.equal(1);
expect(newShape.outgoing[0]).to.eql(sequenceFlow);
// split target at insertion point
expect(sequenceFlow.waypoints).toDeepEqual([
expect(sequenceFlow.waypoints).eql([
{ original: { x: 340, y: 120 }, x: 340, y: 138 },
{ x: 340, y: 299 },
{ original: { x: 502, y: 299 }, x: 502, y: 299 }
@ -159,9 +153,9 @@ describe('modeling/behavior - drop on connection', function(){
});
// then
expect(canDrop).toBe(false);
expect(canDrop).to.be.false;
}));
});
});
});

View File

@ -19,11 +19,11 @@ function getConnection(source, target, connectionOrType) {
}
function expectConnected(source, target, connectionOrType) {
expect(getConnection(source, target, connectionOrType)).toBeDefined();
expect(getConnection(source, target, connectionOrType)).to.be.defined;
}
function expectNotConnected(source, target, connectionOrType) {
expect(getConnection(source, target, connectionOrType)).not.toBeDefined();
expect(getConnection(source, target, connectionOrType)).not.to.be.defined;
}
@ -60,7 +60,7 @@ describe('features/modeling - drop behavior', function() {
modeling.moveShapes([ taskShape ], { x: 0, y: 330 }, targetShape);
// then
expect(taskShape.parent).toBe(targetShape);
expect(taskShape.parent).to.eql(targetShape);
expectNotConnected(element('StartEvent_1'), taskShape, 'bpmn:SequenceFlow');
@ -82,7 +82,7 @@ describe('features/modeling - drop behavior', function() {
commandStack.undo();
// then
expect(taskShape.parent).toBe(oldParent);
expect(taskShape.parent).to.eql(oldParent);
expectConnected(element('StartEvent_1'), taskShape, element('SequenceFlow_3'));
@ -106,8 +106,8 @@ describe('features/modeling - drop behavior', function() {
modeling.moveShapes([ startEventShape, taskShape ], { x: 0, y: 330 }, targetShape);
// then
expect(taskShape.parent).toBe(targetShape);
expect(startEventShape.parent).toBe(targetShape);
expect(taskShape.parent).to.eql(targetShape);
expect(startEventShape.parent).to.eql(targetShape);
expectConnected(startEventShape, taskShape, element('SequenceFlow_3'));
@ -129,7 +129,7 @@ describe('features/modeling - drop behavior', function() {
commandStack.undo();
// then
expect(taskShape.parent).toBe(oldParent);
expect(taskShape.parent).to.eql(oldParent);
expectConnected(element('StartEvent_1'), taskShape, element('SequenceFlow_3'));
@ -154,7 +154,7 @@ describe('features/modeling - drop behavior', function() {
modeling.moveShapes([ subProcessShape ], { x: 0, y: 530 }, targetShape);
// then
expect(subProcessShape.parent).toBe(targetShape);
expect(subProcessShape.parent).to.eql(targetShape);
expectConnected(element('Task_2'), subProcessShape, 'bpmn:MessageFlow');
@ -212,7 +212,7 @@ describe('features/modeling - drop behavior', function() {
modeling.moveShapes([ textAnnotationShape ], { x: -200, y: 40 }, targetShape);
// then
expect(textAnnotationShape.parent).toBe(targetShape);
expect(textAnnotationShape.parent).to.eql(targetShape);
expectNotConnected(textAnnotationShape, targetShape, 'bpmn:TextAnnotation');
}));

View File

@ -35,7 +35,7 @@ describe('features/modeling - remove behavior', function() {
// then
var rootElement = canvas.getRootElement();
expect(is(rootElement, 'bpmn:Collaboration')).toBeTruthy();
expect(is(rootElement, 'bpmn:Collaboration')).to.be.ok;
}));
});
@ -68,25 +68,25 @@ describe('features/modeling - remove behavior', function() {
modeling.removeShape(participantShape);
// then
expect(participant.$parent).toBeFalsy();
expect(participant.$parent).to.not.be.ok;
var newRootShape = canvas.getRootElement(),
newRootBusinessObject = newRootShape.businessObject;
expect(newRootBusinessObject.$instanceOf('bpmn:Process')).toBe(true);
expect(newRootBusinessObject.$instanceOf('bpmn:Process')).to.be.true;
// collaboration DI is unwired
expect(participantDi.$parent).toBeFalsy();
expect(collaboration.di).toBeFalsy();
expect(participantDi.$parent).to.not.be.ok;
expect(collaboration.di).to.not.be.ok;
expect(bpmnDefinitions.rootElements).not.toContain(process);
expect(bpmnDefinitions.rootElements).not.toContain(collaboration);
expect(bpmnDefinitions.rootElements).not.to.include(process);
expect(bpmnDefinitions.rootElements).not.to.include(collaboration);
// process DI is wired
expect(diPlane.bpmnElement).toBe(newRootBusinessObject);
expect(newRootBusinessObject.di).toBe(diPlane);
expect(diPlane.bpmnElement).to.eql(newRootBusinessObject);
expect(newRootBusinessObject.di).to.eql(diPlane);
expect(bpmnDefinitions.rootElements).toContain(newRootBusinessObject);
expect(bpmnDefinitions.rootElements).to.include(newRootBusinessObject);
}));
@ -107,16 +107,16 @@ describe('features/modeling - remove behavior', function() {
commandStack.undo();
// then
expect(participant.$parent).toBe(originalRootElementBo);
expect(originalRootElementBo.$parent).toBe(bpmnDefinitions);
expect(participant.$parent).to.eql(originalRootElementBo);
expect(originalRootElementBo.$parent).to.eql(bpmnDefinitions);
expect(canvas.getRootElement()).toBe(originalRootElement);
expect(canvas.getRootElement()).to.eql(originalRootElement);
// di is unwired
expect(participantDi.$parent).toBe(originalRootElementBo.di);
expect(participantDi.$parent).to.eql(originalRootElementBo.di);
// new di is wired
expect(diPlane.bpmnElement).toBe(originalRootElementBo);
expect(diPlane.bpmnElement).to.eql(originalRootElementBo);
}));
});

View File

@ -18,8 +18,8 @@ function expectCanConnect(source, target, rules) {
source = elementRegistry.get(source);
target = elementRegistry.get(target);
expect(source).toBeDefined();
expect(target).toBeDefined();
expect(source).to.be.defined;
expect(target).to.be.defined;
if ('sequenceFlow' in rules) {
results.sequenceFlow = bpmnRules.canConnectSequenceFlow(source, target);
@ -34,7 +34,7 @@ function expectCanConnect(source, target, rules) {
}
});
expect(results).toEqual(rules);
expect(results).to.eql(rules);
}
@ -47,13 +47,13 @@ function expectCanDrop(element, target, expectedResult) {
element = elementRegistry.get(element);
target = elementRegistry.get(target);
expect(element).toBeDefined();
expect(target).toBeDefined();
expect(element).to.be.defined;
expect(target).to.be.defined;
result = bpmnRules.canDrop(element, target);
});
expect(result).toEqual(expectedResult);
expect(result).to.eql(expectedResult);
}
@ -468,4 +468,4 @@ describe('features/modeling/rules - BpmnRules', function() {
});
});
});

View File

@ -27,7 +27,7 @@ describe('features/palette', function() {
var entries = domQuery.all('.entry', paletteElement);
// then
expect(entries.length).toBe(9);
expect(entries.length).to.equal(9);
}));
});

View File

@ -57,12 +57,12 @@ describe('features/popup-menu', function() {
openPopup(task);
// then
expect(is(loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).toBe(true);
expect(is(loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.true;
expect(loopCharacteristics.isSequential).toBe(false);
expect(loopCharacteristics.isSequential).not.toBe(undefined);
expect(loopCharacteristics.isSequential).to.be.false;
expect(loopCharacteristics.isSequential).to.exist;
expect(popupMenu._getEntry('toggle-parallel-mi').active).toBe(true);
expect(popupMenu._getEntry('toggle-parallel-mi').active).to.be.true;
}));
@ -76,9 +76,9 @@ describe('features/popup-menu', function() {
openPopup(task);
// then
expect(loopCharacteristics.isSequential).toBe(true);
expect(popupMenu._getEntry('toggle-sequential-mi').active).toBe(true);
expect(is(loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).toBe(true);
expect(loopCharacteristics.isSequential).to.be.true;
expect(popupMenu._getEntry('toggle-sequential-mi').active).to.be.true;
expect(is(loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.true;
}));
@ -92,9 +92,9 @@ describe('features/popup-menu', function() {
openPopup(task);
// then
expect(loopCharacteristics.isSequential).toBe(undefined);
expect(popupMenu._getEntry('toggle-loop').active).toBe(true);
expect(is(loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).toBe(false);
expect(loopCharacteristics.isSequential).to.be.undefined;
expect(popupMenu._getEntry('toggle-loop').active).to.be.true;
expect(is(loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.false;
}));
@ -107,7 +107,7 @@ describe('features/popup-menu', function() {
openPopup(AdHocSubProcess);
// then
expect(popupMenu._getEntry('toggle-adhoc').active).toBe(true);
expect(popupMenu._getEntry('toggle-adhoc').active).to.be.true;
}));
});
@ -129,7 +129,7 @@ describe('features/popup-menu', function() {
// then
var adHocEntry = queryEntry(popupMenu, 'toggle-adhoc');
expect(domClasses(adHocEntry).has('active')).toBe(true);
expect(domClasses(adHocEntry).has('active')).to.be.true;
}));
});
@ -164,8 +164,8 @@ describe('features/popup-menu', function() {
parallelEntry = queryEntry(popupMenu, 'toggle-parallel-mi');
adHocEntry = queryEntry(popupMenu, 'toggle-adhoc');
expect(domClasses(parallelEntry).has('active')).toBe(true);
expect(domClasses(adHocEntry).has('active')).toBe(true);
expect(domClasses(parallelEntry).has('active')).to.be.true;
expect(domClasses(adHocEntry).has('active')).to.be.true;
}));
});
@ -190,8 +190,8 @@ describe('features/popup-menu', function() {
var parallelEntry = queryEntry(popupMenu, 'toggle-parallel-mi');
// then
expect(task.businessObject.loopCharacteristics).toBe(undefined);
expect(domClasses(parallelEntry).has('active')).toBe(false);
expect(task.businessObject.loopCharacteristics).to.be.undefined;
expect(domClasses(parallelEntry).has('active')).to.be.false;
}));
@ -212,9 +212,9 @@ describe('features/popup-menu', function() {
var parallelEntry = queryEntry(popupMenu, 'toggle-parallel-mi');
// then
expect(domClasses(parallelEntry).has('active')).toBe(true);
expect(task.businessObject.loopCharacteristics.isSequential).toBe(false);
expect(is(task.businessObject.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).toBe(true);
expect(domClasses(parallelEntry).has('active')).to.be.true;
expect(task.businessObject.loopCharacteristics.isSequential).to.be.false;
expect(is(task.businessObject.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.true;
}));
@ -235,7 +235,7 @@ describe('features/popup-menu', function() {
var sequentialEntry = queryEntry(popupMenu, 'toggle-sequential-mi');
// then
expect(domClasses(sequentialEntry).has('active')).toBe(false);
expect(domClasses(sequentialEntry).has('active')).to.be.false;
}));
@ -256,7 +256,7 @@ describe('features/popup-menu', function() {
var loopEntry = queryEntry(popupMenu, 'toggle-loop');
// then
expect(domClasses(loopEntry).has('active')).toBe(false);
expect(domClasses(loopEntry).has('active')).to.be.false;
}));
});
@ -280,8 +280,8 @@ describe('features/popup-menu', function() {
var sequentialEntry = queryEntry(popupMenu, 'toggle-sequential-mi');
// then
expect(task.businessObject.loopCharacteristics).toBe(undefined);
expect(domClasses(sequentialEntry).has('active')).toBe(false);
expect(task.businessObject.loopCharacteristics).to.be.undefined;
expect(domClasses(sequentialEntry).has('active')).to.be.false;
}));
@ -302,9 +302,9 @@ describe('features/popup-menu', function() {
var sequentialEntry = queryEntry(popupMenu, 'toggle-sequential-mi');
// then
expect(domClasses(sequentialEntry).has('active')).toBe(true);
expect(task.businessObject.loopCharacteristics.isSequential).toBe(true);
expect(is(task.businessObject.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).toBe(true);
expect(domClasses(sequentialEntry).has('active')).to.be.true;
expect(task.businessObject.loopCharacteristics.isSequential).to.be.true;
expect(is(task.businessObject.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.true;
}));
@ -325,7 +325,7 @@ describe('features/popup-menu', function() {
var loopEntry = queryEntry(popupMenu, 'toggle-loop');
// then
expect(domClasses(loopEntry).has('active')).toBe(false);
expect(domClasses(loopEntry).has('active')).to.be.false;
}));
@ -346,7 +346,7 @@ describe('features/popup-menu', function() {
var parallelEntry = queryEntry(popupMenu, 'toggle-parallel-mi');
// then
expect(domClasses(parallelEntry).has('active')).toBe(false);
expect(domClasses(parallelEntry).has('active')).to.be.false;
}));
});
@ -370,8 +370,8 @@ describe('features/popup-menu', function() {
var loopEntry = queryEntry(popupMenu, 'toggle-loop');
// then
expect(domClasses(loopEntry).has('active')).toBe(false);
expect(is(task.businessObject.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).toBe(undefined);
expect(domClasses(loopEntry).has('active')).to.be.false;
expect(is(task.businessObject.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.undefined;
}));
@ -392,8 +392,8 @@ describe('features/popup-menu', function() {
var loopEntry = queryEntry(popupMenu, 'toggle-loop');
// then
expect(domClasses(loopEntry).has('active')).toBe(true);
expect(is(task.businessObject.loopCharacteristics, 'bpmn:StandardLoopCharacteristics')).toBe(true);
expect(domClasses(loopEntry).has('active')).to.be.true;
expect(is(task.businessObject.loopCharacteristics, 'bpmn:StandardLoopCharacteristics')).to.be.true;
}));
@ -414,7 +414,7 @@ describe('features/popup-menu', function() {
var sequentialEntry = queryEntry(popupMenu, 'toggle-sequential-mi');
// then
expect(domClasses(sequentialEntry).has('active')).toBe(false);
expect(domClasses(sequentialEntry).has('active')).to.be.false;
}));
@ -435,7 +435,7 @@ describe('features/popup-menu', function() {
var parallelEntry = queryEntry(popupMenu, 'toggle-parallel-mi');
// then
expect(domClasses(parallelEntry).has('active')).toBe(false);
expect(domClasses(parallelEntry).has('active')).to.be.false;
}));
});
@ -457,9 +457,9 @@ describe('features/popup-menu', function() {
var sendTask = popupMenu.trigger(Events.create(entry, { x: 0, y: 0 }));
// then
expect(sendTask.businessObject.loopCharacteristics).toBeDefined();
expect(sendTask.businessObject.loopCharacteristics.isSequential).toBe(true);
expect(is(sendTask.businessObject.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).toBe(true);
expect(sendTask.businessObject.loopCharacteristics).to.be.defined;
expect(sendTask.businessObject.loopCharacteristics.isSequential).to.be.true;
expect(is(sendTask.businessObject.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.true;
}));
@ -478,9 +478,9 @@ describe('features/popup-menu', function() {
var callActivity = popupMenu.trigger(Events.create(entry, { x: 0, y: 0 }));
// then
expect(callActivity.businessObject.loopCharacteristics).toBeDefined();
expect(callActivity.businessObject.loopCharacteristics.isSequential).toBe(true);
expect(is(callActivity.businessObject.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).toBe(true);
expect(callActivity.businessObject.loopCharacteristics).to.be.defined;
expect(callActivity.businessObject.loopCharacteristics.isSequential).to.be.true;
expect(is(callActivity.businessObject.loopCharacteristics, 'bpmn:MultiInstanceLoopCharacteristics')).to.be.true;
}));
@ -499,7 +499,7 @@ describe('features/popup-menu', function() {
var transaction = popupMenu.trigger(Events.create(entry, { x: 0, y: 0 }));
// then
expect(isExpanded(transaction)).toBe(isExpanded(subProcess));
expect(isExpanded(transaction)).to.equal(isExpanded(subProcess));
}));
@ -518,7 +518,7 @@ describe('features/popup-menu', function() {
var subProcess = popupMenu.trigger(Events.create(entry, { x: 0, y: 0 }));
// then
expect(isExpanded(subProcess)).toBe(isExpanded(transaction));
expect(isExpanded(subProcess)).to.equal(isExpanded(transaction));
}));
});

View File

@ -36,8 +36,8 @@ describe('features/replace', function() {
// then
var businessObject = newElement.businessObject;
expect(newElement).toBeDefined();
expect(is(businessObject, 'bpmn:UserTask')).toBe(true);
expect(newElement).to.be.defined;
expect(is(businessObject, 'bpmn:UserTask')).to.be.true;
}));
@ -56,8 +56,8 @@ describe('features/replace', function() {
// then
var businessObject = newElement.businessObject;
expect(newElement).toBeDefined();
expect(is(businessObject, 'bpmn:InclusiveGateway')).toBe(true);
expect(newElement).to.be.defined;
expect(is(businessObject, 'bpmn:InclusiveGateway')).to.be.true;
}));
@ -74,8 +74,8 @@ describe('features/replace', function() {
var newElement = bpmnReplace.replaceElement(subProcess, newElementData);
// then
expect(newElement).toBeDefined();
expect(is(newElement.businessObject, 'bpmn:Transaction')).toBe(true);
expect(newElement).to.be.defined;
expect(is(newElement.businessObject, 'bpmn:Transaction')).to.be.true;
}));
@ -90,8 +90,8 @@ describe('features/replace', function() {
var newElement = bpmnReplace.replaceElement(transaction, newElementData);
expect(newElement).toBeDefined();
expect(is(newElement.businessObject, 'bpmn:SubProcess')).toBe(true);
expect(newElement).to.be.defined;
expect(is(newElement.businessObject, 'bpmn:SubProcess')).to.be.true;
}));
@ -112,8 +112,8 @@ describe('features/replace', function() {
var newElement = bpmnReplace.replaceElement(task, newElementData);
// then
expect(newElement.x).toBe(task.x);
expect(newElement.y).toBe(task.y);
expect(newElement.x).to.equal(task.x);
expect(newElement.y).to.equal(task.y);
}));
});
@ -134,7 +134,7 @@ describe('features/replace', function() {
var newElement = bpmnReplace.replaceElement(task, newElementData);
// then
expect(selection.get()).toContain(newElement);
expect(selection.get()).to.include(newElement);
}));
});
@ -156,7 +156,7 @@ describe('features/replace', function() {
var newElement = bpmnReplace.replaceElement(task, newElementData);
// then
expect(newElement.businessObject.name).toBe('Task Caption');
expect(newElement.businessObject.name).to.equal('Task Caption');
}));
});
@ -182,8 +182,8 @@ describe('features/replace', function() {
var target = elementRegistry.get('Task_1'),
businessObject = target.businessObject;
expect(target).toBeDefined();
expect(is(businessObject, 'bpmn:Task')).toBe(true);
expect(target).to.be.defined;
expect(is(businessObject, 'bpmn:Task')).to.be.true;
}));
@ -212,8 +212,8 @@ describe('features/replace', function() {
// then
var businessObject = servicetask.businessObject;
expect(servicetask).toBeDefined();
expect(is(businessObject, 'bpmn:ServiceTask')).toBe(true);
expect(servicetask).to.be.defined;
expect(is(businessObject, 'bpmn:ServiceTask')).to.be.true;
}));
});
@ -240,10 +240,10 @@ describe('features/replace', function() {
target = outgoing.target;
expect(incoming).toBeDefined();
expect(outgoing).toBeDefined();
expect(source).toBe(elementRegistry.get('StartEvent_1'));
expect(target).toBe(elementRegistry.get('ExclusiveGateway_1'));
expect(incoming).to.be.defined;
expect(outgoing).to.be.defined;
expect(source).to.eql(elementRegistry.get('StartEvent_1'));
expect(target).to.eql(elementRegistry.get('ExclusiveGateway_1'));
}));
@ -264,8 +264,8 @@ describe('features/replace', function() {
outgoing = newElement.outgoing[0];
expect(incoming).toBeUndefined();
expect(outgoing).toBeUndefined();
expect(incoming).to.be.undefined;
expect(outgoing).to.be.undefined;
}));
@ -286,8 +286,8 @@ describe('features/replace', function() {
outgoing = newElement.outgoing[0];
expect(incoming).toBeUndefined();
expect(outgoing).toBeUndefined();
expect(incoming).to.be.undefined;
expect(outgoing).to.be.undefined;
}));
@ -315,10 +315,10 @@ describe('features/replace', function() {
target = outgoing.target;
expect(incoming).toBeDefined();
expect(outgoing).toBeDefined();
expect(source).toBe(elementRegistry.get('StartEvent_1'));
expect(target).toBe(elementRegistry.get('ExclusiveGateway_1'));
expect(incoming).to.be.defined;
expect(outgoing).to.be.defined;
expect(source).to.eql(elementRegistry.get('StartEvent_1'));
expect(target).to.eql(elementRegistry.get('ExclusiveGateway_1'));
}));
@ -343,9 +343,9 @@ describe('features/replace', function() {
target = outgoing.target;
expect(incoming).toBeUndefined();
expect(outgoing).toBeDefined();
expect(target).toBe(elementRegistry.get('Task_1'));
expect(incoming).to.be.undefined;
expect(outgoing).to.be.defined;
expect(target).to.eql(elementRegistry.get('Task_1'));
}));
@ -370,9 +370,9 @@ describe('features/replace', function() {
source = incoming.source;
expect(incoming).toBeDefined();
expect(outgoing).toBeUndefined();
expect(source).toBe(elementRegistry.get('ExclusiveGateway_1'));
expect(incoming).to.be.defined;
expect(outgoing).to.be.undefined;
expect(source).to.eql(elementRegistry.get('ExclusiveGateway_1'));
}));
});
@ -401,10 +401,10 @@ describe('features/replace', function() {
target = outgoing.target;
expect(incoming).toBeDefined();
expect(outgoing).toBeDefined();
expect(source).toBe(elementRegistry.get('StartEvent_1'));
expect(target).toBe(elementRegistry.get('ExclusiveGateway_1'));
expect(incoming).to.be.defined;
expect(outgoing).to.be.defined;
expect(source).to.eql(elementRegistry.get('StartEvent_1'));
expect(target).to.eql(elementRegistry.get('ExclusiveGateway_1'));
}));
@ -427,8 +427,8 @@ describe('features/replace', function() {
outgoing = newElement.outgoing[0];
expect(incoming).toBeUndefined();
expect(outgoing).toBeUndefined();
expect(incoming).to.be.undefined;
expect(outgoing).to.be.undefined;
}));
@ -451,8 +451,8 @@ describe('features/replace', function() {
outgoing = newElement.outgoing[0];
expect(incoming).toBeUndefined();
expect(outgoing).toBeUndefined();
expect(incoming).to.be.undefined;
expect(outgoing).to.be.undefined;
}));
});
@ -483,13 +483,13 @@ describe('features/replace', function() {
var transactionChildren = transaction.get('flowElements');
var subProcessChildren = subProcess.get('flowElements');
expect(transactionChildren).toContain(startEventShape.businessObject);
expect(transactionChildren).toContain(taskShape.businessObject);
expect(transactionChildren).toContain(sequenceFlowConnection.businessObject);
expect(transactionChildren).to.include(startEventShape.businessObject);
expect(transactionChildren).to.include(taskShape.businessObject);
expect(transactionChildren).to.include(sequenceFlowConnection.businessObject);
expect(subProcessChildren).not.toContain(startEventShape.businessObject);
expect(subProcessChildren).not.toContain(taskShape.businessObject);
expect(subProcessChildren).not.toContain(sequenceFlowConnection.businessObject);
expect(subProcessChildren).not.to.include(startEventShape.businessObject);
expect(subProcessChildren).not.to.include(taskShape.businessObject);
expect(subProcessChildren).not.to.include(sequenceFlowConnection.businessObject);
}));
});
@ -509,8 +509,8 @@ describe('features/replace', function() {
var newElement = bpmnReplace.replaceElement(element, newElementData);
// then
expect(is(newElement, 'bpmn:AdHocSubProcess')).toBe(true);
expect(isExpanded(newElement)).toBe(true);
expect(is(newElement, 'bpmn:AdHocSubProcess')).to.be.true;
expect(isExpanded(newElement)).to.be.true;
}));
@ -527,9 +527,9 @@ describe('features/replace', function() {
var newElement = bpmnReplace.replaceElement(element, newElementData);
// then
expect(is(newElement, 'bpmn:SubProcess')).toBe(true);
expect(is(newElement, 'bpmn:AdHocSubProcess')).toBe(false);
expect(isExpanded(newElement)).toBe(true);
expect(is(newElement, 'bpmn:SubProcess')).to.be.true;
expect(is(newElement, 'bpmn:AdHocSubProcess')).to.be.false;
expect(isExpanded(newElement)).to.be.true;
}));
@ -546,8 +546,8 @@ describe('features/replace', function() {
var newElement = bpmnReplace.replaceElement(element, newElementData);
// then
expect(is(newElement, 'bpmn:AdHocSubProcess')).toBe(true);
expect(isExpanded(newElement)).not.toBe(true);
expect(is(newElement, 'bpmn:AdHocSubProcess')).to.be.true;
expect(isExpanded(newElement)).not.to.be.true;
}));
@ -564,9 +564,9 @@ describe('features/replace', function() {
var newElement = bpmnReplace.replaceElement(element, newElementData);
// then
expect(is(newElement, 'bpmn:SubProcess')).toBe(true);
expect(is(newElement, 'bpmn:AdHocSubProcess')).toBe(false);
expect(isExpanded(newElement)).not.toBe(true);
expect(is(newElement, 'bpmn:SubProcess')).to.be.true;
expect(is(newElement, 'bpmn:AdHocSubProcess')).to.be.false;
expect(isExpanded(newElement)).not.to.be.true;
}));
});

View File

@ -30,7 +30,7 @@ describe('features/replace - chooser', function() {
bpmnReplace.openChooser({ x: 100, y: 100 }, element);
// then
expect(null).toBeDefined();
expect(null).to.be.defined;
}));
@ -43,7 +43,7 @@ describe('features/replace - chooser', function() {
bpmnReplace.openChooser({ x: 100, y: 100 }, element);
// then
expect(null).toBeDefined();
expect(null).to.be.defined;
}));
@ -56,7 +56,7 @@ describe('features/replace - chooser', function() {
bpmnReplace.openChooser({ x: 100, y: 100 }, element);
// then
expect(null).toBeDefined();
expect(null).to.be.defined;
}));
});

View File

@ -34,9 +34,9 @@ describe('features/replace', function() {
bpmnReplace.replaceElement(element, target);
// then
expect(elementRegistry.get('Association_0gzxvep')).toBeDefined();
expect(elementRegistry.get('SequenceFlow_1rme11l')).toBeDefined();
expect(elementRegistry.get('SequenceFlow_0608fzs')).not.toBeDefined();
expect(elementRegistry.get('Association_0gzxvep')).to.be.defined;
expect(elementRegistry.get('SequenceFlow_1rme11l')).to.be.defined;
expect(elementRegistry.get('SequenceFlow_0608fzs')).not.to.be.defined;
}));
@ -52,8 +52,8 @@ describe('features/replace', function() {
bpmnReplace.replaceElement(element, target);
// then
expect(elementRegistry.get('Association_1ncsghq')).toBeDefined();
expect(elementRegistry.get('SequenceFlow_0fn1a6r')).not.toBeDefined();
expect(elementRegistry.get('Association_1ncsghq')).to.be.defined;
expect(elementRegistry.get('SequenceFlow_0fn1a6r')).not.to.be.defined;
}));
@ -69,8 +69,8 @@ describe('features/replace', function() {
bpmnReplace.replaceElement(element, target);
// then
expect(elementRegistry.get('Association_06tpzma')).toBeDefined();
expect(elementRegistry.get('SequenceFlow_19u6x8u')).not.toBeDefined();
expect(elementRegistry.get('Association_06tpzma')).to.be.defined;
expect(elementRegistry.get('SequenceFlow_19u6x8u')).not.to.be.defined;
}));
});

View File

@ -60,7 +60,7 @@ describe('features/snapping - BpmnSnapping', function() {
dragging.end(createEvent({ x: 65, y: 65 }));
// then
expect(bounds(participantShape)).toEqual({
expect(bounds(participantShape)).to.eql({
width: 600, height: 250, x: 18, y: -8
});
}));
@ -83,7 +83,7 @@ describe('features/snapping - BpmnSnapping', function() {
dragging.end(createEvent({ x: 400, y: 400 }));
// then
expect(bounds(participantShape)).toEqual({
expect(bounds(participantShape)).to.eql({
width: 600, height: 250, x: 100, y: 52
});
}));
@ -122,7 +122,7 @@ describe('features/snapping - BpmnSnapping', function() {
dragging.end(createEvent({ x: 400, y: 400 }));
// then
expect(bounds(participantShape)).toEqual({
expect(bounds(participantShape)).to.eql({
x: 100, y: 275, width: 600, height: 250
});
}));
@ -161,7 +161,7 @@ describe('features/snapping - BpmnSnapping', function() {
dragging.end(createEvent({ x: 400, y: 400 }));
// then
expect(bounds(participantShape)).toEqual({
expect(bounds(participantShape)).to.eql({
x: 100, y: 275, width: 600, height: 250
});
}));
@ -196,8 +196,8 @@ describe('features/snapping - BpmnSnapping', function() {
dragging.move(createEvent({ x: 0, y: 0 }));
dragging.end();
expect(participant.width).toEqual(497);
expect(participant.height).toEqual(252);
expect(participant.width).to.equal(497);
expect(participant.height).to.equal(252);
}));
@ -209,8 +209,8 @@ describe('features/snapping - BpmnSnapping', function() {
dragging.move(createEvent({ x: 500, y: 500 }));
dragging.end();
expect(participant.width).toEqual(467);
expect(participant.height).toEqual(287);
expect(participant.width).to.equal(467);
expect(participant.height).to.equal(287);
}));
@ -222,8 +222,8 @@ describe('features/snapping - BpmnSnapping', function() {
dragging.move(createEvent({ x: 0, y: 0 }));
dragging.end();
expect(participant.width).toEqual(300);
expect(participant.height).toEqual(150);
expect(participant.width).to.equal(300);
expect(participant.height).to.equal(150);
}));
@ -235,8 +235,8 @@ describe('features/snapping - BpmnSnapping', function() {
dragging.move(createEvent({ x: 500, y: 500 }));
dragging.end();
expect(participant.width).toEqual(300);
expect(participant.height).toEqual(150);
expect(participant.width).to.equal(300);
expect(participant.height).to.equal(150);
}));
@ -248,8 +248,8 @@ describe('features/snapping - BpmnSnapping', function() {
dragging.move(createEvent({ x: 0, y: 0 }));
dragging.end();
expect(participant.width).toEqual(320);
expect(participant.height).toEqual(150);
expect(participant.width).to.equal(320);
expect(participant.height).to.equal(150);
}));
@ -261,8 +261,8 @@ describe('features/snapping - BpmnSnapping', function() {
dragging.move(createEvent({ x: 500, y: 500 }));
dragging.end();
expect(participant.width).toEqual(353);
expect(participant.height).toEqual(177);
expect(participant.width).to.equal(353);
expect(participant.height).to.equal(177);
}));
});
@ -276,8 +276,8 @@ describe('features/snapping - BpmnSnapping', function() {
dragging.move(createEvent({ x: -453, y: -624 }));
dragging.end();
expect(subProcess.width).toEqual(140);
expect(subProcess.height).toEqual(120);
expect(subProcess.width).to.equal(140);
expect(subProcess.height).to.equal(120);
}));
@ -289,8 +289,8 @@ describe('features/snapping - BpmnSnapping', function() {
dragging.move(createEvent({ x: -614, y: -310 }));
dragging.end();
expect(participant.width).toEqual(300);
expect(participant.height).toEqual(150);
expect(participant.width).to.equal(300);
expect(participant.height).to.equal(150);
}));
@ -302,8 +302,8 @@ describe('features/snapping - BpmnSnapping', function() {
dragging.move(createEvent({ x: -592, y: -452 }));
dragging.end();
expect(textAnnotation.width).toEqual(50);
expect(textAnnotation.height).toEqual(50);
expect(textAnnotation.width).to.equal(50);
expect(textAnnotation.height).to.equal(50);
}));
});

View File

@ -2,6 +2,7 @@
var TestHelper = require('../../TestHelper');
var TestContainer = require('mocha-test-container-support');
var Diagram = require('diagram-js/lib/Diagram'),
BpmnModdle = require('bpmn-moddle'),
@ -16,7 +17,7 @@ describe('import - Importer', function() {
var container;
beforeEach(function() {
container = jasmine.getEnv().getTestContainer();
container = TestContainer.get(this);
});
@ -63,7 +64,7 @@ describe('import - Importer', function() {
runImport(diagram, xml, function(err, warnings) {
// then
expect(eventCount).toEqual(9);
expect(eventCount).to.equal(9);
done(err);
});
@ -95,7 +96,7 @@ describe('import - Importer', function() {
runImport(diagram, xml, function(err, warnings) {
// then
expect(events).toEqual([
expect(events).to.eql([
{ type: 'add', semantic: 'Process_1', di: 'BPMNPlane_1', diagramElement: 'Process_1' },
{ type: 'add', semantic: 'SubProcess_1', di: '_BPMNShape_SubProcess_2', diagramElement: 'SubProcess_1' },
{ type: 'add', semantic: 'StartEvent_1', di: '_BPMNShape_StartEvent_2', diagramElement: 'StartEvent_1' },
@ -133,7 +134,7 @@ describe('import - Importer', function() {
runImport(diagram, xml, function(err, warnings) {
// then
expect(events).toEqual([
expect(events).to.eql([
{ type: 'add', semantic: '_Collaboration_2', di: 'BPMNPlane_1', diagramElement: '_Collaboration_2' },
{ type: 'add', semantic: 'Participant_2', di: '_BPMNShape_Participant_2', diagramElement: 'Participant_2' },
{ type: 'add', semantic: 'Lane_1', di: '_BPMNShape_Lane_2', diagramElement: 'Lane_1' },
@ -178,11 +179,11 @@ describe('import - Importer', function() {
var anyChild = elements[1];
// assume
expect(root.businessObject.$instanceOf('bpmn:Process')).toBe(true);
expect(anyChild.parent).toBe(root);
expect(root.businessObject.$instanceOf('bpmn:Process')).to.be.true;
expect(anyChild.parent).to.eql(root);
// then
expect(canvas.getRootElement()).toBe(root);
expect(canvas.getRootElement()).to.eql(root);
});
@ -193,10 +194,10 @@ describe('import - Importer', function() {
var startEventShape = elements[2];
// then
expect(startEventShape.type).toBe('bpmn:StartEvent');
expect(startEventShape.parent).toBe(subProcessShape);
expect(startEventShape.type).to.equal('bpmn:StartEvent');
expect(startEventShape.parent).to.eql(subProcessShape);
expect(subProcessShape.children.length).toBe(5);
expect(subProcessShape.children.length).to.equal(5);
});
@ -207,10 +208,10 @@ describe('import - Importer', function() {
var label = startEventShape.label;
// then
expect(label).toBeDefined();
expect(label.id).toBe(startEventShape.id + '_label');
expect(label).to.be.defined;
expect(label.id).to.equal(startEventShape.id + '_label');
expect(label.labelTarget).toBe(startEventShape);
expect(label.labelTarget).to.eql(startEventShape);
});
@ -224,11 +225,11 @@ describe('import - Importer', function() {
startEvent = startEventShape.businessObject;
// then
expect(subProcess).toBeDefined();
expect(subProcess.$instanceOf('bpmn:SubProcess')).toBe(true);
expect(subProcess).to.be.defined;
expect(subProcess.$instanceOf('bpmn:SubProcess')).to.be.true;
expect(startEvent).toBeDefined();
expect(startEvent.$instanceOf('bpmn:StartEvent')).toBe(true);
expect(startEvent).to.be.defined;
expect(startEvent.$instanceOf('bpmn:StartEvent')).to.be.true;
});
@ -245,11 +246,11 @@ describe('import - Importer', function() {
startEventDi = startEvent.di;
// then
expect(subProcessDi).toBeDefined();
expect(subProcessDi.bpmnElement).toBe(subProcess);
expect(subProcessDi).to.be.defined;
expect(subProcessDi.bpmnElement).to.eql(subProcess);
expect(startEventDi).toBeDefined();
expect(startEventDi.bpmnElement).toBe(startEvent);
expect(startEventDi).to.be.defined;
expect(startEventDi.bpmnElement).to.eql(startEvent);
});
});
@ -265,7 +266,7 @@ describe('import - Importer', function() {
// when
runImport(diagram, xml, function(err, warnings) {
expect(warnings.length).toBe(1);
expect(warnings.length).to.equal(1);
done(err);
});
@ -283,8 +284,8 @@ describe('import - Importer', function() {
var expectedMessage =
'multiple DI elements defined for <bpmn:InclusiveGateway id="InclusiveGateway_1" />';
expect(warnings.length).toBe(1);
expect(warnings[0].message).toBe(expectedMessage);
expect(warnings.length).to.equal(1);
expect(warnings[0].message).to.equal(expectedMessage);
done(err);
});
@ -303,7 +304,7 @@ describe('import - Importer', function() {
var element = elementRegistry.get('GATEWAY_1');
expect(element.businessObject.eventGatewayType).toEqual('Exclusive');
expect(element.businessObject.eventGatewayType).to.equal('Exclusive');
done();
});
@ -323,7 +324,7 @@ describe('import - Importer', function() {
runImport(diagram, xml, function(err, warnings) {
// then
expect(warnings.length).toBe(0);
expect(warnings.length).to.equal(0);
done(err);
});
@ -339,10 +340,10 @@ describe('import - Importer', function() {
runImport(diagram, xml, function(err, warnings) {
// then
expect(warnings.length).toBe(0);
expect(warnings.length).to.equal(0);
expect(diagram.get('elementRegistry').get('_b467921a-ef7b-44c5-bf78-fd624c400d17')).toBeDefined();
expect(diagram.get('elementRegistry').get('_c311cc87-677e-47a4-bdb1-8744c4ec3147')).toBeDefined();
expect(diagram.get('elementRegistry').get('_b467921a-ef7b-44c5-bf78-fd624c400d17')).to.be.defined;
expect(diagram.get('elementRegistry').get('_c311cc87-677e-47a4-bdb1-8744c4ec3147')).to.be.defined;
done(err);
});
@ -368,12 +369,12 @@ describe('import - Importer', function() {
runImport(diagram, xml1, function(err, warnings) {
//round up
expect(events.ID_End.x).toBe(Math.round(340.6));
expect(events.ID_End.y).toBe(Math.round(136.6));
expect(events.ID_End.x).to.equal(Math.round(340.6));
expect(events.ID_End.y).to.equal(Math.round(136.6));
//round down
expect(events.ID_Start.x).toBe(Math.round(120.4));
expect(events.ID_Start.y).toBe(Math.round(135.4));
expect(events.ID_Start.x).to.equal(Math.round(120.4));
expect(events.ID_Start.y).to.equal(Math.round(135.4));
done(err);
});
@ -394,8 +395,8 @@ describe('import - Importer', function() {
runImport(diagram, xml1, function(err, warnings) {
//round down
expect(events.ID_Start.height).toBe(Math.round(30.4));
expect(events.ID_Start.width).toBe(Math.round(30.4));
expect(events.ID_Start.height).to.equal(Math.round(30.4));
expect(events.ID_Start.width).to.equal(Math.round(30.4));
done(err);
});

View File

@ -26,7 +26,7 @@ describe('import - associations', function() {
var association = elementRegistry.get('Association_1');
// then
expect(association).toBeDefined();
expect(association).to.be.defined;
done();
})();
@ -52,7 +52,7 @@ describe('import - associations', function() {
var association = elementRegistry.get('Association_1');
// then
expect(association).toBeDefined();
expect(association).to.be.defined;
done();
})();
@ -83,8 +83,8 @@ describe('import - associations', function() {
var dataOutputAssociation = elementRegistry.get('DataOutputAssociation_1');
// then
expect(dataInputAssociation).toBeDefined();
expect(dataOutputAssociation).toBeDefined();
expect(dataInputAssociation).to.be.defined;
expect(dataOutputAssociation).to.be.defined;
done();
})();
@ -111,8 +111,8 @@ describe('import - associations', function() {
var dataOutputAssociation = elementRegistry.get('DataOutputAssociation_1');
// then
expect(dataInputAssociation).toBeDefined();
expect(dataOutputAssociation).toBeDefined();
expect(dataInputAssociation).to.be.defined;
expect(dataOutputAssociation).to.be.defined;
done();
})();

View File

@ -18,8 +18,8 @@ describe('import - collapsed container', function() {
var collapsedShape = elementRegistry.get('SubProcess_1');
var childShape = elementRegistry.get('IntermediateCatchEvent_1');
expect(collapsedShape.collapsed).toBe(true);
expect(childShape.hidden).toBe(true);
expect(collapsedShape.collapsed).to.be.true;
expect(childShape.hidden).to.be.true;
}));
@ -27,8 +27,8 @@ describe('import - collapsed container', function() {
var collapsedShape = elementRegistry.get('Transaction_1');
var childShape = elementRegistry.get('UserTask_1');
expect(collapsedShape.collapsed).toBe(true);
expect(childShape.hidden).toBe(true);
expect(collapsedShape.collapsed).to.be.true;
expect(childShape.hidden).to.be.true;
}));
@ -36,8 +36,8 @@ describe('import - collapsed container', function() {
var collapsedShape = elementRegistry.get('AdHocSubProcess_1');
var childShape = elementRegistry.get('StartEvent_1');
expect(collapsedShape.collapsed).toBe(true);
expect(childShape.hidden).toBe(true);
expect(collapsedShape.collapsed).to.be.true;
expect(childShape.hidden).to.be.true;
}));
@ -46,18 +46,18 @@ describe('import - collapsed container', function() {
var childShape = elementRegistry.get('SubProcess_5');
var nestedChildShape = elementRegistry.get('Task_3');
expect(collapsedShape.collapsed).toBe(true);
expect(childShape.hidden).toBe(true);
expect(nestedChildShape.hidden).toBe(true);
expect(collapsedShape.collapsed).to.be.true;
expect(childShape.hidden).to.be.true;
expect(nestedChildShape.hidden).to.be.true;
}));
it('should import collapsed with nested elements', inject(function(elementRegistry) {
var hiddenEventShape = elementRegistry.get('StartEvent_2');
expect(hiddenEventShape.label.hidden).toBe(true);
expect(hiddenEventShape.label.hidden).to.be.true;
var hiddenDataShape = elementRegistry.get('DataObjectReference_1');
expect(hiddenDataShape.label.hidden).toBe(true);
expect(hiddenDataShape.label.hidden).to.be.true;
}));
@ -65,8 +65,8 @@ describe('import - collapsed container', function() {
var expandedShape = elementRegistry.get('SubProcess_3');
var childShape = elementRegistry.get('Task_2');
expect(expandedShape.collapsed).toBe(false);
expect(childShape.hidden).toBe(false);
expect(expandedShape.collapsed).to.be.false;
expect(childShape.hidden).to.be.false;
}));
});
@ -83,8 +83,8 @@ describe('import - collapsed container', function() {
var expandedShape = elementRegistry.get('SubProcess_1');
var childShape = elementRegistry.get('Task_1');
expect(expandedShape.collapsed).toBe(true);
expect(childShape.hidden).toBe(true);
expect(expandedShape.collapsed).to.be.true;
expect(childShape.hidden).to.be.true;
}));
@ -92,8 +92,8 @@ describe('import - collapsed container', function() {
var expandedShape = elementRegistry.get('SubProcess_2');
var childShape = elementRegistry.get('StartEvent_1');
expect(expandedShape.collapsed).toBe(false);
expect(childShape.hidden).toBe(false);
expect(expandedShape.collapsed).to.be.false;
expect(childShape.hidden).to.be.false;
}));
@ -101,8 +101,8 @@ describe('import - collapsed container', function() {
var expandedShape = elementRegistry.get('SubProcess_4');
var childShape = elementRegistry.get('Task_2');
expect(expandedShape.collapsed).toBe(true);
expect(childShape.hidden).toBe(true);
expect(expandedShape.collapsed).to.be.true;
expect(childShape.hidden).to.be.true;
}));
@ -110,8 +110,8 @@ describe('import - collapsed container', function() {
var expandedShape = elementRegistry.get('SubProcess_3');
var childShape = elementRegistry.get('StartEvent_2');
expect(expandedShape.collapsed).toBe(false);
expect(childShape.hidden).toBe(false);
expect(expandedShape.collapsed).to.be.false;
expect(childShape.hidden).to.be.false;
}));
});

View File

@ -55,8 +55,8 @@ describe('import - labels', function() {
sequenceFlow = elementRegistry.get('SequenceFlow_1');
// then
expect(bounds(endEvent.label)).toEqual({ x: 211, y: 256, width: 119, height: 44 });
expect(bounds(sequenceFlow.label)).toEqual({ x: 432, y: 317, width: 99, height: 22 });
expect(bounds(endEvent.label)).to.eql({ x: 211, y: 256, width: 119, height: 44 });
expect(bounds(sequenceFlow.label)).to.eql({ x: 432, y: 317, width: 99, height: 22 });
done();
})();