feat(tests): gracefully handle missing jasmine-test-container-support

This allows us to smoothly transition into a jasmine-free world.
This commit is contained in:
Nico Rehwaldt 2014-08-08 08:49:12 +02:00
parent 08f45fd444
commit 2202bb07fa
1 changed files with 14 additions and 4 deletions

View File

@ -5,9 +5,12 @@ var _ = require('lodash');
var Modeler = require('../lib/Modeler'),
Viewer = require('../lib/Viewer');
// enhance jasmine with test container API
require('jasmine-test-container-support').extend(jasmine);
try {
// enhance jasmine with test container API
require('jasmine-test-container-support').extend(jasmine);
} catch (e) {
// no test container :-(
}
var OPTIONS, BPMN_JS;
@ -22,7 +25,14 @@ function options(opts) {
function bootstrapBpmnJS(BpmnJS, options, locals) {
var testContainer = jasmine.getEnv().getTestContainer();
var testContainer;
try {
testContainer = jasmine.getEnv().getTestContainer();
} catch (e) {
testContainer = document.createElement('div');
document.body.appendChild(testContainer);
}
var _options = options,
_locals = locals;