diff --git a/lib/Viewer.js b/lib/Viewer.js index c91ae7e7..07ba5b7f 100644 --- a/lib/Viewer.js +++ b/lib/Viewer.js @@ -378,6 +378,10 @@ Viewer.prototype.attachTo = function(parentNode) { this._emit('attach', {}); }; +Viewer.prototype.getDefinitions = function() { + return this._definitions; +}; + Viewer.prototype.detach = function() { var container = this._container, diff --git a/test/spec/ViewerSpec.js b/test/spec/ViewerSpec.js index 8ddea97a..ca04e804 100644 --- a/test/spec/ViewerSpec.js +++ b/test/spec/ViewerSpec.js @@ -29,7 +29,21 @@ describe('Viewer', function() { it('should import simple process', function(done) { var xml = require('../fixtures/bpmn/simple.bpmn'); - createViewer(xml, done); + + // when + createViewer(xml, function(err, warnings, viewer) { + + // then + expect(err).not.to.exist; + expect(warnings).to.be.empty; + + var definitions = viewer.getDefinitions(); + + expect(definitions).to.exist; + expect(definitions).to.eql(viewer._definitions); + + done(); + }); });