diff --git a/test/helper/index.js b/test/helper/index.js index 8c73bc3b..58902959 100644 --- a/test/helper/index.js +++ b/test/helper/index.js @@ -112,14 +112,13 @@ export function bootstrapBpmnJS(BpmnJS, diagram, options, locals) { ); } - // clean up old bpmn-js instance - if (BPMN_JS) { - BPMN_JS.destroy(); - } + clearBpmnJS(); - BPMN_JS = new BpmnJS(_options); + var instance = new BpmnJS(_options); - BPMN_JS.importXML(diagram, done); + setBpmnJS(instance); + + instance.importXML(diagram, done); }; } @@ -227,6 +226,19 @@ export function getBpmnJS() { return BPMN_JS; } +export function clearBpmnJS() { + + // clean up old bpmn-js instance + if (BPMN_JS) { + BPMN_JS.destroy(); + + BPMN_JS = null; + } +} + +export function setBpmnJS(instance) { + BPMN_JS = instance; +} export function insertCSS(name, css) { if (document.querySelector('[data-css-file="' + name + '"]')) {