bpmn-moddle
Advanced tools
Comparing version 0.7.0 to 0.8.0
'use strict'; | ||
var isString = require('lodash/lang/isString'), | ||
isFunction = require('lodash/lang/isFunction'); | ||
isFunction = require('lodash/lang/isFunction'), | ||
assign = require('lodash/object/assign'); | ||
@@ -32,5 +33,6 @@ var Moddle = require('moddle'), | ||
* @param {String} xmlStr | ||
* @param {String} [typeName] name of the root element, defaults to 'bpmn:Definitions' | ||
* @param {Object} [options] options to pass to the underlying reader | ||
* @param {Function} done callback that is invoked with (err, result, parseContext) once the import completes | ||
* @param {String} [typeName='bpmn:Definitions'] name of the root element | ||
* @param {Object} [options] options to pass to the underlying reader | ||
* @param {Function} done callback that is invoked with (err, result, parseContext) | ||
* once the import completes | ||
*/ | ||
@@ -50,3 +52,3 @@ BpmnModdle.prototype.fromXML = function(xmlStr, typeName, options, done) { | ||
var reader = new XmlReader(this, options); | ||
var reader = new XmlReader(assign({ model: this, lax: true }, options)); | ||
var rootHandler = reader.handler(typeName); | ||
@@ -53,0 +55,0 @@ |
{ | ||
"name": "bpmn-moddle", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "A moddle wrapper for BPMN 2.0", | ||
@@ -46,4 +46,4 @@ "scripts": { | ||
"moddle": "^0.6.0", | ||
"moddle-xml": "^0.6.0" | ||
"moddle-xml": "^0.7.0" | ||
} | ||
} |
@@ -132,3 +132,3 @@ 'use strict'; | ||
// when | ||
fromFile('test/fixtures/bpmn/documentation.bpmn', 'bpmn:Definitions', function(err, result) { | ||
fromFile('test/fixtures/bpmn/documentation.bpmn', function(err, result) { | ||
@@ -173,3 +173,3 @@ // then | ||
// when | ||
fromFile('test/fixtures/bpmn/escalation-error.bpmn', 'bpmn:Definitions', function(err, result) { | ||
fromFile('test/fixtures/bpmn/escalation-error.bpmn', function(err, result) { | ||
@@ -195,3 +195,3 @@ // then | ||
// when | ||
fromFile('test/fixtures/bpmn/extension-elements.bpmn', 'bpmn:Definitions', function(err, result) { | ||
fromFile('test/fixtures/bpmn/extension-elements.bpmn', function(err, result) { | ||
@@ -359,3 +359,3 @@ expect(result).to.jsonEqual({ | ||
// when | ||
fromFile('test/fixtures/bpmn/category.bpmn', 'bpmn:Definitions', function(err, result) { | ||
fromFile('test/fixtures/bpmn/category.bpmn', function(err, result) { | ||
@@ -668,3 +668,3 @@ if (err) { | ||
// when | ||
fromFile('test/fixtures/bpmn/extension-elements.bpmn', 'bpmn:Definitions', function(err, result) { | ||
fromFile('test/fixtures/bpmn/extension-elements.bpmn', function(err, result) { | ||
@@ -699,3 +699,3 @@ expect(result).to.jsonEqual({ | ||
// when | ||
fromFile('test/fixtures/bpmn/empty-definitions.bpmn', 'bpmn:Definitions', function(err, result) { | ||
fromFile('test/fixtures/bpmn/empty-definitions.bpmn', function(err, result) { | ||
@@ -721,3 +721,3 @@ var expected = { | ||
// when | ||
fromFile('test/fixtures/bpmn/empty-definitions-default-ns.bpmn', 'bpmn:Definitions', function(err, result) { | ||
fromFile('test/fixtures/bpmn/empty-definitions-default-ns.bpmn', function(err, result) { | ||
@@ -743,3 +743,3 @@ var expected = { | ||
// when | ||
fromFile('test/fixtures/bpmn/simple.bpmn', 'bpmn:Definitions', function(err, result) { | ||
fromFile('test/fixtures/bpmn/simple.bpmn', function(err, result) { | ||
@@ -759,3 +759,3 @@ // then | ||
// when | ||
fromFile('test/fixtures/bpmn/simple-default-ns.bpmn', 'bpmn:Definitions', function(err, result) { | ||
fromFile('test/fixtures/bpmn/simple-default-ns.bpmn', function(err, result) { | ||
@@ -776,3 +776,3 @@ expect(result.id).to.equal('simple'); | ||
// when | ||
fromFile('test/fixtures/bpmn/error/no-xml.txt', 'bpmn:Definitions', function(err, result) { | ||
fromFile('test/fixtures/bpmn/error/no-xml.txt', function(err, result) { | ||
@@ -789,3 +789,3 @@ expect(err).not.to.eql(null); | ||
// when | ||
fromFile('test/fixtures/bpmn/error/binary.png', 'bpmn:Definitions', function(err, result) { | ||
fromFile('test/fixtures/bpmn/error/binary.png', function(err, result) { | ||
@@ -803,6 +803,9 @@ expect(err).not.to.eql(null); | ||
// when | ||
fromFile('test/fixtures/bpmn/error/invalid-child.bpmn', 'bpmn:Definitions', function(err, result) { | ||
fromFile('test/fixtures/bpmn/error/undeclared-ns-child.bpmn', function(err, result, context) { | ||
expect(err).not.to.eql(null); | ||
var warnings = context.warnings; | ||
expect(err).not.to.exist; | ||
expect(warnings.length).to.eql(1); | ||
done(); | ||
@@ -812,4 +815,49 @@ }); | ||
it('when importing invalid categoryValue / reference', function(done) { | ||
// when | ||
fromFile('test/fixtures/bpmn/error/categoryValue.bpmn', function(err, result, context) { | ||
var warnings = context.warnings; | ||
// then | ||
expect(err).not.to.exist; | ||
// wrong <categoryValue> + unresolvable reference | ||
expect(warnings.length).to.eql(2); | ||
var invalidElementWarning = warnings[0]; | ||
var unresolvableReferenceWarning = warnings[1]; | ||
expect(invalidElementWarning.message).to.eql( | ||
'unparsable content <categoryValue> detected\n\t' + | ||
'line: 2\n\t' + | ||
'column: 89\n\t' + | ||
'nested error: unrecognized element <bpmn:categoryValue>'); | ||
expect(unresolvableReferenceWarning.message).to.eql( | ||
'unresolved reference <sid-afd7e63e-916e-4bd0-a9f0-98cbff749193>'); | ||
done(); | ||
}); | ||
}); | ||
it('when importing valid bpmn / unrecognized element', function(done) { | ||
// when | ||
fromFile('test/fixtures/bpmn/error/unrecognized-child.bpmn', function(err, result, context) { | ||
var warnings = context.warnings; | ||
expect(err).not.to.exist; | ||
expect(warnings.length).to.eql(1); | ||
done(); | ||
}); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
901469
85
5670
+ Addedmoddle-xml@0.7.0(transitive)
- Removedmoddle-xml@0.6.0(transitive)
Updatedmoddle-xml@^0.7.0