fix(viewer): moddle extensions

Remove .only from test, replace merge with assign, add extra test

Relates to #471
This commit is contained in:
Vladimirs Katusenoks 2016-02-25 14:07:23 +01:00
parent 0fb1bf616e
commit c793c01169
2 changed files with 14 additions and 7 deletions

View File

@ -9,8 +9,7 @@
var assign = require('lodash/object/assign'),
omit = require('lodash/object/omit'),
isString = require('lodash/lang/isString'),
isNumber = require('lodash/lang/isNumber'),
merge = require('lodash/object/merge');
isNumber = require('lodash/lang/isNumber');
var domify = require('min-dom/lib/domify'),
domQuery = require('min-dom/lib/query'),
@ -204,7 +203,7 @@ Viewer.prototype.saveXML = function(options, done) {
};
Viewer.prototype.createModdle = function() {
return new BpmnModdle(merge(this.options.moddleExtensions, this._moddleExtensions));
return new BpmnModdle(assign({}, this._moddleExtensions, this.options.moddleExtensions));
};
/**

View File

@ -4,6 +4,8 @@ var TestContainer = require('mocha-test-container-support');
var Viewer = require('../../lib/Viewer');
var inherits = require('inherits');
describe('Viewer', function() {
@ -545,17 +547,23 @@ describe('Viewer', function() {
});
it.only('should allow to add default custom moddle extensions', function(done) {
it('should allow to add default custom moddle extensions', function(done) {
// given
var xml = require('../fixtures/bpmn/extension/custom.bpmn'),
additionalModdleDescriptors = {
custom: require('../fixtures/json/model/custom')
};
Viewer.prototype._moddleExtensions = additionalModdleDescriptors;
function CustomViewer(options) {
Viewer.call(this, options);
}
// given
viewer = new Viewer({
inherits(CustomViewer, Viewer);
CustomViewer.prototype._moddleExtensions = additionalModdleDescriptors;
viewer = new CustomViewer({
container: container,
moddleExtensions: {
camunda: camundaPackage