chore(Viewer): re-expose loaded definitions

The previous release kinda removed access to the currently
loaded definitions.

This restores access by exposing it by `Viewer#getDefinitions()`.
This commit is contained in:
Nico Rehwaldt 2017-11-23 09:48:21 +01:00
parent 6bb1128ccc
commit 2ef82970fd
2 changed files with 19 additions and 1 deletions

View File

@ -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,

View File

@ -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();
});
});