feat(Modeler): include bpmn-js-cli

This commit is contained in:
Nico Rehwaldt 2014-08-08 14:42:50 +02:00
parent 2202bb07fa
commit ac3669f0ca
3 changed files with 55 additions and 7 deletions

View File

@ -52,19 +52,34 @@ Modeler.prototype.createModdle = function() {
return moddle; return moddle;
}; };
// modules the modeler is composed of
Modeler.prototype._modules = Modeler.prototype._modules.concat([ Modeler.prototype._interactionModules = [
// non-modeling components // non-modeling components
require('./features/label-editing'), require('./features/label-editing'),
require('./features/zoomscroll'), require('./features/zoomscroll'),
require('./features/touch'), require('./features/touch'),
require('./features/movecanvas'), require('./features/movecanvas')
];
Modeler.prototype._modelingModules = [
// modeling components // modeling components
require('bpmn-js-cli'),
require('./features/modeling'), require('./features/modeling'),
require('diagram-js/lib/features/move'), require('diagram-js/lib/features/move'),
require('./features/context-pad') 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; module.exports = Modeler;

View File

@ -49,17 +49,22 @@
"karma-jasmine": "https://github.com/Nikku/karma-jasmine/archive/jasmine-v2.0.0-latest-1.tar.gz", "karma-jasmine": "https://github.com/Nikku/karma-jasmine/archive/jasmine-v2.0.0-latest-1.tar.gz",
"karma-phantomjs-launcher": "^0.1.2", "karma-phantomjs-launcher": "^0.1.2",
"load-grunt-tasks": "^0.3.0", "load-grunt-tasks": "^0.3.0",
"time-grunt": "^0.3.2" "time-grunt": "^0.3.2",
"diagram-js": "~0.4.0"
}, },
"dependencies": { "dependencies": {
"bpmn-moddle": "~0.3.0", "bpmn-moddle": "~0.3.0",
"diagram-js": "~0.4.0",
"diagram-js-direct-editing": "0.3.0", "diagram-js-direct-editing": "0.3.0",
"didi": "~0.0.4", "didi": "~0.0.4",
"jquery": "~2.1.0", "jquery": "~2.1.0",
"jquery-mousewheel": "~3.1.11", "jquery-mousewheel": "~3.1.11",
"lodash": "~2.4.0", "lodash": "~2.4.0",
"object-refs": "^0.1.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"
} }
} }

View File

@ -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) { it('should handle errors', function(done) {
var xml = 'invalid stuff'; var xml = 'invalid stuff';