fix(BpmnTreeWalker): do not fail if no di
This commit is contained in:
parent
60b27e393f
commit
1d46d915d1
|
@ -14,7 +14,7 @@ function BpmnTraverser(visitor) {
|
|||
}
|
||||
|
||||
function is(element, type) {
|
||||
return element.__isInstanceOf(type);
|
||||
return element.__instanceOf(type);
|
||||
}
|
||||
|
||||
function visit(element, di, ctx) {
|
||||
|
@ -82,8 +82,15 @@ function BpmnTraverser(visitor) {
|
|||
}
|
||||
|
||||
if (!diagram) {
|
||||
if (diagrams && diagrams.length) {
|
||||
diagram = diagrams[0];
|
||||
}
|
||||
}
|
||||
|
||||
// no diagram -> nothing to import
|
||||
if (!diagram) {
|
||||
return;
|
||||
}
|
||||
|
||||
var rootElement = diagram.plane.bpmnElement;
|
||||
|
||||
|
|
|
@ -36,4 +36,15 @@ describe('Importer', function() {
|
|||
diagram.importDefinitions(result, done);
|
||||
});
|
||||
});
|
||||
|
||||
it('should import empty definitions', function(done) {
|
||||
|
||||
var xml = fs.readFileSync('test/fixtures/bpmn/empty-definitions.bpmn', 'utf8');
|
||||
|
||||
read(xml, function(err, result) {
|
||||
var diagram = new Diagram(container);
|
||||
|
||||
diagram.importDefinitions(result, done);
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue