test(Viewer): split config -> container handling into own describe

This commit is contained in:
Nico Rehwaldt 2019-04-12 11:57:57 +02:00 committed by Nico Rehwaldt
parent a78f8037c7
commit b1ee678fe3
1 changed files with 26 additions and 19 deletions

View File

@ -589,33 +589,40 @@ describe('Viewer', function() {
}); });
it('should attach the viewer to the given parent', function(done) {
var xml = require('../fixtures/bpmn/simple.bpmn'); describe('container', function() {
var viewer = new Viewer({ container: container }); it('should attach if provided', function(done) {
viewer.importXML(xml, function(err, warnings) { var xml = require('../fixtures/bpmn/simple.bpmn');
expect(viewer._container.parentNode).to.equal(container); var viewer = new Viewer({ container: container });
done(err, warnings); viewer.importXML(xml, function(err, warnings) {
expect(viewer._container.parentNode).to.equal(container);
done(err, warnings);
});
}); });
it('should not attach if absent', function(done) {
var xml = require('../fixtures/bpmn/simple.bpmn');
var viewer = new Viewer();
viewer.importXML(xml, function(err, warnings) {
expect(viewer._container.parentNode).to.equal(null);
done(err, warnings);
});
});
}); });
it('should not attach the viewer automatically if no parent was given', function(done) {
var xml = require('../fixtures/bpmn/simple.bpmn');
var viewer = new Viewer();
viewer.importXML(xml, function(err, warnings) {
expect(viewer._container.parentNode).to.equal(null);
done(err, warnings);
});
});
}); });