From 911e991bc8d6f7e4e9c895817d91ee00fd77d62d Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Tue, 5 Aug 2014 08:17:22 +0200 Subject: [PATCH] chore(tests): instantiate modeler only when neccessary This commit replaces the test helper #bootstrapBpmnJS with either This ensures we can have different Modeler/Viewer specific bootstrap code being called based on whether we test modeling or viewing only features. --- test/TestHelper.js | 148 ++++++++++++------ test/spec/ModelerSpec.js | 2 - test/spec/ViewerSpec.js | 2 +- test/spec/draw/BpmnRendererSpec.js | 48 +++--- test/spec/environment/MockingSpec.js | 4 +- .../context-pad/ContextPadProviderSpec.js | 4 +- .../label-editing/LabelEditingProviderSpec.js | 4 +- .../label-editing/TouchIntegrationSpec.js | 4 +- .../spec/features/modeling/AppendShapeSpec.js | 4 +- .../spec/features/modeling/BpmnFactorySpec.js | 4 +- .../features/modeling/CreateConnectionSpec.js | 4 +- .../features/modeling/LayoutConnectionSpec.js | 4 +- test/spec/features/modeling/MoveShapeSpec.js | 4 +- .../features/touch/TouchInteractionSpec.js | 4 +- .../spec/features/zoomscoll/ZoomScrollSpec.js | 4 +- test/spec/import/ImporterSpec.js | 2 - .../import/elements/CollapsedImportSpec.js | 6 +- test/spec/import/elements/LabelImportSpec.js | 12 +- 18 files changed, 154 insertions(+), 110 deletions(-) diff --git a/test/TestHelper.js b/test/TestHelper.js index 441be208..cc45b86b 100644 --- a/test/TestHelper.js +++ b/test/TestHelper.js @@ -1,7 +1,9 @@ 'use strict'; var _ = require('lodash'); -var BpmnJS = require('../lib/Modeler'); + +var Modeler = require('../lib/Modeler'), + Viewer = require('../lib/Viewer'); // enhance jasmine with test container API require('jasmine-test-container-support').extend(jasmine); @@ -17,8 +19,53 @@ function options(opts) { OPTIONS = opts; } + +function bootstrapBpmnJS(BpmnJS, options, locals) { + + var testContainer = jasmine.getEnv().getTestContainer(); + + var _options = options, + _locals = locals; + + if (_locals === undefined && _.isFunction(_options)) { + _locals = _options; + _options = null; + } + + if (_.isFunction(_options)) { + _options = _options(); + } + + if (_.isFunction(_locals)) { + _locals = _locals(); + } + + _options = _.extend({ container: testContainer }, OPTIONS || {}, _options || {}); + + if (_locals) { + var mockModule = {}; + + _.forEach(_locals, function(v, k) { + mockModule[k] = ['value', v]; + }); + + _options.modules = [].concat(_options.modules || [], [ mockModule ]); + } + + _options.modules = _.unique(_options.modules); + + if (!_options.modules.length) { + _options.modules = undefined; + } + + BPMN_JS = new BpmnJS(_options); + + return BPMN_JS; +} + + /** - * Bootstrap BpmnJS given the specified options and a number of locals (i.e. services) + * Bootstrap the Modeler given the specified options and a number of locals (i.e. services) * * @example * @@ -26,7 +73,7 @@ function options(opts) { * * var mockEvents; * - * beforeEach(bootstrapBpmnJS(function() { + * beforeEach(bootstrapModeler('some-xml', function() { * mockEvents = new Events(); * * return { @@ -36,62 +83,24 @@ function options(opts) { * * }); * + * @param {String} xml document to display * @param {Object} (options) optional options to be passed to the diagram upon instantiation * @param {Object|Function} locals the local overrides to be used by the diagram or a function that produces them * @return {Function} a function to be passed to beforeEach */ -function bootstrapBpmnJS(diagram, options, locals) { +function bootstrapModeler(diagram, options, locals) { return function(done) { - - var testContainer = jasmine.getEnv().getTestContainer(); - - var _diagram = diagram, - _options = options, - _locals = locals; - - if (_locals === undefined && _.isFunction(_options)) { - _locals = _options; - _options = null; - } - - if (_.isFunction(_options)) { - _options = _options(); - } - - if (_.isFunction(_locals)) { - _locals = _locals(); - } - - _options = _.extend({ container: testContainer }, OPTIONS || {}, _options || {}); - - if (_locals) { - var mockModule = {}; - - _.forEach(_locals, function(v, k) { - mockModule[k] = ['value', v]; - }); - - _options.modules = [].concat(_options.modules || [], [ mockModule ]); - } - - _options.modules = _.unique(_options.modules); - - if (_options.modules.length == 0) { - _options.modules = undefined; - } - - BPMN_JS = new BpmnJS(_options); + // bootstrap + var modeler = bootstrapBpmnJS(Modeler, options, locals); // import diagram - BPMN_JS.importXML(_diagram, done); + modeler.importXML(diagram, done); }; } /** - * Injects services of an instantiated diagram into the argument. - * - * Use it in conjunction with {@link #bootstrapBpmnJS}. + * Bootstrap the Viewer given the specified options and a number of locals (i.e. services) * * @example * @@ -99,7 +108,45 @@ function bootstrapBpmnJS(diagram, options, locals) { * * var mockEvents; * - * beforeEach(bootstrapBpmnJS(...)); + * beforeEach(bootstrapViewer('some-xml', function() { + * mockEvents = new Events(); + * + * return { + * events: mockEvents + * }; + * })); + * + * }); + * + * @param {String} xml document to display + * @param {Object} (options) optional options to be passed to the diagram upon instantiation + * @param {Object|Function} locals the local overrides to be used by the diagram or a function that produces them + * @return {Function} a function to be passed to beforeEach + */ +function bootstrapViewer(diagram, options, locals) { + + return function(done) { + // bootstrap + var viewer = bootstrapBpmnJS(Viewer, options, locals); + + // import diagram + viewer.importXML(diagram, done); + }; +} + + +/** + * Injects services of an instantiated diagram into the argument. + * + * Use it in conjunction with {@link #bootstrapModeler} or {@link #bootstrapViewer}. + * + * @example + * + * describe(function() { + * + * var mockEvents; + * + * beforeEach(bootstrapViewer(...)); * * it('should provide mocked events', inject(function(events) { * expect(events).toBe(mockEvents); @@ -114,7 +161,7 @@ function inject(fn) { return function() { if (!BPMN_JS) { - throw new Error('no bootstraped bpmn-js instance, ensure you created it via #bootstrapBpmnJS'); + throw new Error('no bootstraped bpmn-js instance, ensure you created it via #boostrap(Modeler|Viewer)'); } BPMN_JS.invoke(fn); @@ -122,5 +169,6 @@ function inject(fn) { } -module.exports.bootstrapBpmnJS = (window || global).bootstrapBpmnJS = bootstrapBpmnJS; +module.exports.bootstrapModeler = (window || global).bootstrapModeler = bootstrapModeler; +module.exports.bootstrapViewer = (window || global).bootstrapViewer = bootstrapViewer; module.exports.inject = (window || global).inject = inject; \ No newline at end of file diff --git a/test/spec/ModelerSpec.js b/test/spec/ModelerSpec.js index 56c72db7..076bf940 100644 --- a/test/spec/ModelerSpec.js +++ b/test/spec/ModelerSpec.js @@ -3,8 +3,6 @@ var Matchers = require('../Matchers'), TestHelper = require('../TestHelper'); -/* global bootstrapBpmnJS, inject */ - var fs = require('fs'); diff --git a/test/spec/ViewerSpec.js b/test/spec/ViewerSpec.js index 46d7b38e..401f35a2 100644 --- a/test/spec/ViewerSpec.js +++ b/test/spec/ViewerSpec.js @@ -3,7 +3,7 @@ var Matchers = require('../Matchers'), TestHelper = require('../TestHelper'); -/* global bootstrapBpmnJS, inject */ +/* global bootstrapViewer, inject */ var fs = require('fs'); diff --git a/test/spec/draw/BpmnRendererSpec.js b/test/spec/draw/BpmnRendererSpec.js index 3c63b47f..9233159a 100644 --- a/test/spec/draw/BpmnRendererSpec.js +++ b/test/spec/draw/BpmnRendererSpec.js @@ -3,7 +3,7 @@ var Matchers = require('../../Matchers'), TestHelper = require('../../TestHelper'); -/* global bootstrapBpmnJS, inject */ +/* global bootstrapViewer, inject */ var fs = require('fs'); @@ -16,135 +16,135 @@ describe('draw - bpmn renderer', function() { it('should render activity markers', function(done) { var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/activity-markers.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); it('should render activity markers (combination)', function(done) { var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/activity-markers-combination.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); it('should render conditional flows', function(done) { var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/conditional-flow.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); it('should render conditional default flows', function(done) { var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/conditional-flow-default.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); it('should render NO conditional flow (gateway)', function(done) { var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/conditional-flow-gateways.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); it('should render conditional flow (typed task)', function(done) { var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/conditional-flow-typed-task.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); it('should render data objects', function(done) { var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/data-objects.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); it('should render events', function(done) { var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/events.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); it('should render events (interrupting)', function(done) { var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/events-interrupting.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); it('should render event subprocesses (collapsed)', function(done) { var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/event-subprocesses-collapsed.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); it('should render event subprocesses (expanded)', function(done) { var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/event-subprocesses-expanded.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); it('should render gateways', function(done) { var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/gateways.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); it('should render group', function(done) { var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/group.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); it('should render message marker', function(done) { var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/message-marker.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); it('should render pools', function(done) { var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/pools.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); it('should render pool collection marker', function(done) { var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/pools-with-collection-marker.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); it('should render task types', function(done) { var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/task-types.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); it('should render text annotations', function(done) { var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/text-annotation.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); it('should render flow markers', function(done) { var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/flow-markers.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); it('should render xor gateways blank and with X', function(done) { var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/xor.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); it('should render boundary events with correct z-index', function(done) { var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/boundary-event-z-index.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); it('should render boundary events without flowNodeRef', function(done) { var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/boundary-event-without-refnode.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); it('should render boundary event only once if referenced incorrectly via flowNodeRef (robustness)', function(done) { var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/boundary-event-with-refnode.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); }); \ No newline at end of file diff --git a/test/spec/environment/MockingSpec.js b/test/spec/environment/MockingSpec.js index 5a4cecdc..06e1e1a9 100644 --- a/test/spec/environment/MockingSpec.js +++ b/test/spec/environment/MockingSpec.js @@ -2,7 +2,7 @@ var TestHelper = require('../../TestHelper'); -/* global bootstrapBpmnJS, inject */ +/* global bootstrapViewer, inject */ var fs = require('fs'); @@ -17,7 +17,7 @@ describe('environment - mocking', function() { var mockEvents, bootstrapCalled; - beforeEach(bootstrapBpmnJS(diagramXML, { + beforeEach(bootstrapViewer(diagramXML, { modules: Viewer.prototype._modules }, function() { mockEvents = new Events(); diff --git a/test/spec/features/context-pad/ContextPadProviderSpec.js b/test/spec/features/context-pad/ContextPadProviderSpec.js index e7b39fe0..5ad10266 100644 --- a/test/spec/features/context-pad/ContextPadProviderSpec.js +++ b/test/spec/features/context-pad/ContextPadProviderSpec.js @@ -3,7 +3,7 @@ var Matchers = require('../../../Matchers'), TestHelper = require('../../../TestHelper'); -/* global bootstrapBpmnJS, inject */ +/* global bootstrapViewer, inject */ var fs = require('fs'); @@ -21,7 +21,7 @@ describe('features - context-pad', function() { var testModules = [ contextPadModule, bpmnModule ]; - beforeEach(bootstrapBpmnJS(diagramXML, { modules: testModules })); + beforeEach(bootstrapViewer(diagramXML, { modules: testModules })); describe('bootstrap', function() { diff --git a/test/spec/features/label-editing/LabelEditingProviderSpec.js b/test/spec/features/label-editing/LabelEditingProviderSpec.js index 764d7e6c..bc335346 100644 --- a/test/spec/features/label-editing/LabelEditingProviderSpec.js +++ b/test/spec/features/label-editing/LabelEditingProviderSpec.js @@ -3,7 +3,7 @@ var Matchers = require('../../../Matchers'), TestHelper = require('../../../TestHelper'); -/* global bootstrapBpmnJS, inject */ +/* global bootstrapViewer, inject */ var fs = require('fs'); @@ -26,7 +26,7 @@ describe('features - label-editing', function() { var testModules = [ labelEditingModule, bpmnModule ]; - beforeEach(bootstrapBpmnJS(diagramXML, { modules: testModules })); + beforeEach(bootstrapViewer(diagramXML, { modules: testModules })); describe('basics', function() { diff --git a/test/spec/features/label-editing/TouchIntegrationSpec.js b/test/spec/features/label-editing/TouchIntegrationSpec.js index a6550ef5..dc327748 100644 --- a/test/spec/features/label-editing/TouchIntegrationSpec.js +++ b/test/spec/features/label-editing/TouchIntegrationSpec.js @@ -3,7 +3,7 @@ var Matchers = require('../../../Matchers'), TestHelper = require('../../../TestHelper'); -/* global bootstrapBpmnJS, inject */ +/* global bootstrapViewer, inject */ var fs = require('fs'); @@ -47,7 +47,7 @@ describe('direct editing - touch integration', function() { var testModules = [ labelEditingModule, touchModule ]; - beforeEach(bootstrapBpmnJS(diagramXML, { modules: testModules })); + beforeEach(bootstrapViewer(diagramXML, { modules: testModules })); it('should work via dbltap (manual test)', function() { }); }); diff --git a/test/spec/features/modeling/AppendShapeSpec.js b/test/spec/features/modeling/AppendShapeSpec.js index 8afcf1f4..aa469180 100644 --- a/test/spec/features/modeling/AppendShapeSpec.js +++ b/test/spec/features/modeling/AppendShapeSpec.js @@ -3,7 +3,7 @@ var Matchers = require('../../../Matchers'), TestHelper = require('../../../TestHelper'); -/* global bootstrapBpmnJS, inject */ +/* global bootstrapModeler, inject */ var _ = require('lodash'); @@ -25,7 +25,7 @@ describe('features/modeling - append shape', function() { var testModules = [ drawModule, modelingModule ]; - beforeEach(bootstrapBpmnJS(diagramXML, { modules: testModules })); + beforeEach(bootstrapModeler(diagramXML, { modules: testModules })); describe('shape handling', function() { diff --git a/test/spec/features/modeling/BpmnFactorySpec.js b/test/spec/features/modeling/BpmnFactorySpec.js index aec08aff..2ae14379 100644 --- a/test/spec/features/modeling/BpmnFactorySpec.js +++ b/test/spec/features/modeling/BpmnFactorySpec.js @@ -3,7 +3,7 @@ var Matchers = require('../../../Matchers'), TestHelper = require('../../../TestHelper'); -/* global bootstrapBpmnJS, inject */ +/* global bootstrapModeler, inject */ var fs = require('fs'); @@ -20,7 +20,7 @@ describe('features - bpmn-factory', function() { var testModules = [ modelingModule ]; - beforeEach(bootstrapBpmnJS(diagramXML, { modules: testModules })); + beforeEach(bootstrapModeler(diagramXML, { modules: testModules })); describe('create di', function() { diff --git a/test/spec/features/modeling/CreateConnectionSpec.js b/test/spec/features/modeling/CreateConnectionSpec.js index cc16072f..7ba83d05 100644 --- a/test/spec/features/modeling/CreateConnectionSpec.js +++ b/test/spec/features/modeling/CreateConnectionSpec.js @@ -3,7 +3,7 @@ var Matchers = require('../../../Matchers'), TestHelper = require('../../../TestHelper'); -/* global bootstrapBpmnJS, inject */ +/* global bootstrapModeler, inject */ var _ = require('lodash'); @@ -22,7 +22,7 @@ describe('features/modeling - create connection', function() { var testModules = [ drawModule, modelingModule ]; - beforeEach(bootstrapBpmnJS(diagramXML, { modules: testModules })); + beforeEach(bootstrapModeler(diagramXML, { modules: testModules })); describe('connection handling', function() { diff --git a/test/spec/features/modeling/LayoutConnectionSpec.js b/test/spec/features/modeling/LayoutConnectionSpec.js index 6f3fe3fb..1f576af7 100644 --- a/test/spec/features/modeling/LayoutConnectionSpec.js +++ b/test/spec/features/modeling/LayoutConnectionSpec.js @@ -3,7 +3,7 @@ var Matchers = require('../../../Matchers'), TestHelper = require('../../../TestHelper'); -/* global bootstrapBpmnJS, inject */ +/* global bootstrapModeler, inject */ var _ = require('lodash'); @@ -22,7 +22,7 @@ describe('features/modeling - layout connection', function() { var testModules = [ drawModule, modelingModule ]; - beforeEach(bootstrapBpmnJS(diagramXML, { modules: testModules })); + beforeEach(bootstrapModeler(diagramXML, { modules: testModules })); describe('connection handling', function() { diff --git a/test/spec/features/modeling/MoveShapeSpec.js b/test/spec/features/modeling/MoveShapeSpec.js index 194384c0..9d14f3d9 100644 --- a/test/spec/features/modeling/MoveShapeSpec.js +++ b/test/spec/features/modeling/MoveShapeSpec.js @@ -3,7 +3,7 @@ var Matchers = require('../../../Matchers'), TestHelper = require('../../../TestHelper'); -/* global bootstrapBpmnJS, inject */ +/* global bootstrapModeler, inject */ var _ = require('lodash'); @@ -22,7 +22,7 @@ describe('features/modeling - move shape', function() { var testModules = [ drawModule, modelingModule ]; - beforeEach(bootstrapBpmnJS(diagramXML, { modules: testModules })); + beforeEach(bootstrapModeler(diagramXML, { modules: testModules })); describe('shape handling', function() { diff --git a/test/spec/features/touch/TouchInteractionSpec.js b/test/spec/features/touch/TouchInteractionSpec.js index cc697acc..cca3952d 100644 --- a/test/spec/features/touch/TouchInteractionSpec.js +++ b/test/spec/features/touch/TouchInteractionSpec.js @@ -3,7 +3,7 @@ var Matchers = require('../../../Matchers'), TestHelper = require('../../../TestHelper'); -/* global bootstrapBpmnJS, inject */ +/* global bootstrapViewer, inject */ var fs = require('fs'); @@ -22,7 +22,7 @@ describe('features - touch', function() { var testModules = [ touchModule, bpmnModule ]; - beforeEach(bootstrapBpmnJS(diagramXML, { modules: testModules })); + beforeEach(bootstrapViewer(diagramXML, { modules: testModules })); describe('bootstrap', function() { diff --git a/test/spec/features/zoomscoll/ZoomScrollSpec.js b/test/spec/features/zoomscoll/ZoomScrollSpec.js index 855993d6..a173b314 100644 --- a/test/spec/features/zoomscoll/ZoomScrollSpec.js +++ b/test/spec/features/zoomscoll/ZoomScrollSpec.js @@ -3,7 +3,7 @@ var Matchers = require('../../../Matchers'), TestHelper = require('../../../TestHelper'); -/* global bootstrapBpmnJS, inject */ +/* global bootstrapViewer, inject */ var fs = require('fs'); @@ -24,7 +24,7 @@ describe('features - zoomscroll', function() { var testModules = [ zoomscrollModule, bpmnModule ]; - beforeEach(bootstrapBpmnJS(diagramXML, { modules: testModules })); + beforeEach(bootstrapViewer(diagramXML, { modules: testModules })); describe('bootstrap', function() { diff --git a/test/spec/import/ImporterSpec.js b/test/spec/import/ImporterSpec.js index 0d5bd579..871654cc 100644 --- a/test/spec/import/ImporterSpec.js +++ b/test/spec/import/ImporterSpec.js @@ -3,8 +3,6 @@ var Matchers = require('../../Matchers'), TestHelper = require('../../TestHelper'); -/* global bootstrapBpmnJS, inject */ - var fs = require('fs'); diff --git a/test/spec/import/elements/CollapsedImportSpec.js b/test/spec/import/elements/CollapsedImportSpec.js index 951edab4..e80d402a 100644 --- a/test/spec/import/elements/CollapsedImportSpec.js +++ b/test/spec/import/elements/CollapsedImportSpec.js @@ -3,7 +3,7 @@ var Matchers = require('../../../Matchers'), TestHelper = require('../../../TestHelper'); -/* global bootstrapBpmnJS, inject */ +/* global bootstrapViewer, inject */ var fs = require('fs'); @@ -18,7 +18,7 @@ describe('import - collapsed container', function() { var diagramXML = fs.readFileSync('test/fixtures/bpmn/import/collapsed.bpmn', 'utf8'); - beforeEach(bootstrapBpmnJS(diagramXML)); + beforeEach(bootstrapViewer(diagramXML)); it('should import collapsed subProcess', inject(function(elementRegistry) { @@ -83,7 +83,7 @@ describe('import - collapsed container', function() { var diagramXML = fs.readFileSync('test/fixtures/bpmn/import/collapsed-collaboration.bpmn', 'utf8'); - beforeEach(bootstrapBpmnJS(diagramXML)); + beforeEach(bootstrapViewer(diagramXML)); it('should import collapsed subProcess in pool', inject(function(elementRegistry) { diff --git a/test/spec/import/elements/LabelImportSpec.js b/test/spec/import/elements/LabelImportSpec.js index 34f3bb8e..698eddd2 100644 --- a/test/spec/import/elements/LabelImportSpec.js +++ b/test/spec/import/elements/LabelImportSpec.js @@ -3,7 +3,7 @@ var Matchers = require('../../../Matchers'), TestHelper = require('../../../TestHelper'); -/* global bootstrapBpmnJS, inject */ +/* global bootstrapViewer, inject */ var fs = require('fs'); @@ -18,19 +18,19 @@ describe('import - labels', function() { it('on flow nodes', function(done) { var xml = fs.readFileSync('test/fixtures/bpmn/import/labels/embedded.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); it('on pools and lanes', function(done) { var xml = fs.readFileSync('test/fixtures/bpmn/import/labels/collaboration.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); it('on message flows', function(done) { var xml = fs.readFileSync('test/fixtures/bpmn/import/labels/collaboration-message-flows.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); }); @@ -40,13 +40,13 @@ describe('import - labels', function() { it('with di', function(done) { var xml = fs.readFileSync('test/fixtures/bpmn/import/labels/external.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); it('without di', function(done) { var xml = fs.readFileSync('test/fixtures/bpmn/import/labels/external-no-di.bpmn', 'utf8'); - bootstrapBpmnJS(xml)(done); + bootstrapViewer(xml)(done); }); });