From 991ab38c3d7d3a4b44b9dfa567d076ce408ded6a Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Fri, 19 Jul 2019 13:48:28 +0200 Subject: [PATCH] feat(test): expose BpmnJS set and clear utilities --- test/helper/index.js | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) 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 + '"]')) {