diff --git a/lib/Modeler.js b/lib/Modeler.js index 831419d0..f79a7b3d 100644 --- a/lib/Modeler.js +++ b/lib/Modeler.js @@ -52,19 +52,34 @@ Modeler.prototype.createModdle = function() { return moddle; }; -// modules the modeler is composed of -Modeler.prototype._modules = Modeler.prototype._modules.concat([ + +Modeler.prototype._interactionModules = [ // non-modeling components require('./features/label-editing'), require('./features/zoomscroll'), require('./features/touch'), - require('./features/movecanvas'), + require('./features/movecanvas') +]; +Modeler.prototype._modelingModules = [ // modeling components + require('bpmn-js-cli'), require('./features/modeling'), require('diagram-js/lib/features/move'), require('./features/context-pad') -]); +]; + + +// modules the modeler is composed of +// +// - viewer modules +// - interaction modules +// - modeling modules + +Modeler.prototype._modules = [].concat( + Modeler.prototype._modules, + Modeler.prototype._interactionModules, + Modeler.prototype._modelingModules); module.exports = Modeler; diff --git a/package.json b/package.json index bb80acd9..d5e48a98 100644 --- a/package.json +++ b/package.json @@ -49,17 +49,22 @@ "karma-jasmine": "https://github.com/Nikku/karma-jasmine/archive/jasmine-v2.0.0-latest-1.tar.gz", "karma-phantomjs-launcher": "^0.1.2", "load-grunt-tasks": "^0.3.0", - "time-grunt": "^0.3.2" + "time-grunt": "^0.3.2", + "diagram-js": "~0.4.0" }, "dependencies": { "bpmn-moddle": "~0.3.0", - "diagram-js": "~0.4.0", "diagram-js-direct-editing": "0.3.0", "didi": "~0.0.4", "jquery": "~2.1.0", "jquery-mousewheel": "~3.1.11", "lodash": "~2.4.0", "object-refs": "^0.1.0", - "ids": "0.0.3" + "ids": "0.0.3", + "bpmn-js": "^0.4.1", + "bpmn-js-cli": "^0.1.1" + }, + "peerDependencies": { + "diagram-js": "~0.4.0" } } diff --git a/test/spec/ModelerSpec.js b/test/spec/ModelerSpec.js index 00a648eb..e51b0b47 100644 --- a/test/spec/ModelerSpec.js +++ b/test/spec/ModelerSpec.js @@ -88,6 +88,34 @@ describe('modeler', function() { }); + describe('cli support', function() { + + it('should ship with cli', function(done) { + + var xml = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8'); + + createModeler(xml, function(err, viewer) { + + // given + var cli = viewer.get('cli'); + + // assume + expect(cli).toBeDefined(); + + // when + var subProcessShape = cli.element('SubProcess_1'); + + // then + expect(subProcessShape.id).toEqual('SubProcess_1'); + + done(err); + }); + + }); + + }); + + it('should handle errors', function(done) { var xml = 'invalid stuff';