diff --git a/package.json b/package.json index 7b3dd451..1cea5314 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,6 @@ ], "license": "http://bpmn.io/license", "devDependencies": { - "brfs": "^1.2.0", "browserify": "^8.1.0", "browserify-derequire": "^0.9.1", "bundle-collapser": "^1.1.1", @@ -52,6 +51,7 @@ "karma-phantomjs-launcher": "^0.1.2", "load-grunt-tasks": "^0.3.0", "source-map-concat": "^0.4.0", + "stringify": "^3.1.0", "time-grunt": "^0.3.2", "uglify-js": "^2.4.16" }, diff --git a/test/TestHelper.js b/test/TestHelper.js index 718a644f..46008ca4 100644 --- a/test/TestHelper.js +++ b/test/TestHelper.js @@ -2,10 +2,8 @@ var TestHelper = module.exports = require('./helper'); -var fs = require('fs'); - -TestHelper.insertCSS('diagram-js.css', fs.readFileSync(__dirname + '/../node_modules/diagram-js/assets/diagram-js.css', 'utf8')); -TestHelper.insertCSS('bpmn-embedded.css', fs.readFileSync(__dirname + '/../assets/bpmn-font/css/bpmn-embedded.css', 'utf8')); +TestHelper.insertCSS('diagram-js.css', require('diagram-js/assets/diagram-js.css')); +TestHelper.insertCSS('bpmn-embedded.css', require('../assets/bpmn-font/css/bpmn-embedded.css')); TestHelper.insertCSS('diagram-js-testing.css', '.test-container .result { height: 500px; }' + '.test-container > div' diff --git a/test/config/karma.unit.js b/test/config/karma.unit.js index e9bbde22..068e7430 100644 --- a/test/config/karma.unit.js +++ b/test/config/karma.unit.js @@ -1,3 +1,5 @@ +'use strict'; + module.exports = function(karma) { karma.set({ @@ -27,7 +29,7 @@ module.exports = function(karma) { // browserify configuration browserify: { debug: true, - transform: [ 'brfs' ] + transform: [ [ 'stringify', { global: true, extensions: [ '.bpmn', '.xml', '.css' ] } ] ] } }); }; diff --git a/test/helper/index.js b/test/helper/index.js index fffaf330..42a4b113 100644 --- a/test/helper/index.js +++ b/test/helper/index.js @@ -1,3 +1,5 @@ +'use strict'; + /** * A helper file that may be used in test cases for bpmn-js and extensions. * @@ -43,14 +45,6 @@ try { var OPTIONS, BPMN_JS; -function options(opts) { - if (isFunction(opts)) { - opts = opts(); - } - - OPTIONS = opts; -} - function bootstrapBpmnJS(BpmnJS, options, locals) { diff --git a/test/integration/SimpleModelingSpec.js b/test/integration/SimpleModelingSpec.js index 6478911c..8cb54428 100644 --- a/test/integration/SimpleModelingSpec.js +++ b/test/integration/SimpleModelingSpec.js @@ -1,10 +1,6 @@ 'use strict'; -var Matchers = require('../Matchers'), - TestHelper = require('../TestHelper'); - - -var fs = require('fs'); +var TestHelper = require('../TestHelper'); var Modeler = require('../../lib/Modeler'); diff --git a/test/integration/model/BpmnModdleSpec.js b/test/integration/model/BpmnModdleSpec.js index 5741694f..f20f9c22 100644 --- a/test/integration/model/BpmnModdleSpec.js +++ b/test/integration/model/BpmnModdleSpec.js @@ -44,9 +44,7 @@ describe('bpmn-moddle', function() { it('should parse complex xml', function(done) { - var fs = require('fs'); - - var xml = fs.readFileSync('test/fixtures/bpmn/complex.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/complex.bpmn'); var start = new Date().getTime(); diff --git a/test/spec/ModelerSpec.js b/test/spec/ModelerSpec.js index abfca2b0..53afbd1a 100644 --- a/test/spec/ModelerSpec.js +++ b/test/spec/ModelerSpec.js @@ -1,8 +1,6 @@ 'use strict'; -var fs = require('fs'); - var Modeler = require('../../lib/Modeler'); @@ -25,20 +23,20 @@ describe('Modeler', function() { it('should import simple process', function(done) { - var xml = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8'); + var xml = require('../fixtures/bpmn/simple.bpmn'); createModeler(xml, done); }); it('should import empty definitions', function(done) { - var xml = fs.readFileSync('test/fixtures/bpmn/empty-definitions.bpmn', 'utf8'); + var xml = require('../fixtures/bpmn/empty-definitions.bpmn'); createModeler(xml, done); }); it('should re-import simple process', function(done) { - var xml = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8'); + var xml = require('../fixtures/bpmn/simple.bpmn'); // given createModeler(xml, function(err, warnings, modeler) { @@ -69,7 +67,7 @@ describe('Modeler', function() { it('should allow to add overlays', function(done) { - var xml = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8'); + var xml = require('../fixtures/bpmn/simple.bpmn'); createModeler(xml, function(err, warnings, viewer) { @@ -117,7 +115,7 @@ describe('Modeler', function() { it('should allow to edit bendpoints', function(done) { - var xml = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8'); + var xml = require('../fixtures/bpmn/simple.bpmn'); createModeler(xml, function(err, warnings, viewer) { @@ -167,7 +165,7 @@ describe('Modeler', function() { it('should be available via di as ', function(done) { - var xml = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8'); + var xml = require('../fixtures/bpmn/simple.bpmn'); createModeler(xml, function(err, warnings, modeler) { diff --git a/test/spec/NavigatedViewerSpec.js b/test/spec/NavigatedViewerSpec.js index 34da3a14..3bd23c71 100644 --- a/test/spec/NavigatedViewerSpec.js +++ b/test/spec/NavigatedViewerSpec.js @@ -2,8 +2,6 @@ var TestHelper = require('../TestHelper'); -var fs = require('fs'); - var NavigatedViewer = require('../../lib/NavigatedViewer'); @@ -26,18 +24,17 @@ describe('NavigatedViewer', function() { it('should import simple process', function(done) { - - var xml = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8'); - + var xml = require('../fixtures/bpmn/simple.bpmn'); createViewer(xml, done); }); describe('navigation features', function() { - var xml = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8'); + var xml = require('../fixtures/bpmn/simple.bpmn'); it('should include zoomScroll', function(done) { + createViewer(xml, function(err, warnings, viewer) { expect(viewer.get('zoomScroll')).toBeDefined(); diff --git a/test/spec/ViewerSpec.js b/test/spec/ViewerSpec.js index 951bc24e..bb63ab59 100644 --- a/test/spec/ViewerSpec.js +++ b/test/spec/ViewerSpec.js @@ -3,8 +3,6 @@ require('../TestHelper'); -var fs = require('fs'); - var Viewer = require('../../lib/Viewer'); @@ -27,24 +25,20 @@ describe('Viewer', function() { it('should import simple process', function(done) { - - var xml = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8'); - + var xml = require('../fixtures/bpmn/simple.bpmn'); createViewer(xml, done); }); it('should import empty definitions', function(done) { - - var xml = fs.readFileSync('test/fixtures/bpmn/empty-definitions.bpmn', 'utf8'); - + var xml = require('../fixtures/bpmn/empty-definitions.bpmn'); createViewer(xml, done); }); it('should re-import simple process', function(done) { - var xml = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8'); + var xml = require('../fixtures/bpmn/simple.bpmn'); // given createViewer(xml, function(err, warnings, viewer) { @@ -75,7 +69,7 @@ describe('Viewer', function() { // given var viewer = new Viewer({ container: container }); - var xml = fs.readFileSync('test/fixtures/bpmn/empty-definitions.bpmn', 'utf8'); + var xml = require('../fixtures/bpmn/empty-definitions.bpmn'); var events = []; @@ -111,7 +105,7 @@ describe('Viewer', function() { it('should allow to add overlays', function(done) { - var xml = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8'); + var xml = require('../fixtures/bpmn/simple.bpmn'); createViewer(xml, function(err, warnings, viewer) { @@ -184,7 +178,7 @@ describe('Viewer', function() { it('should handle invalid BPMNPlane#bpmnElement', function(done) { - var xml = fs.readFileSync('test/fixtures/bpmn/error/di-plane-no-bpmn-element.bpmn', 'utf8'); + var xml = require('../fixtures/bpmn/error/di-plane-no-bpmn-element.bpmn'); // when createViewer(xml, function(err, warnings) { @@ -207,7 +201,7 @@ describe('Viewer', function() { it('should handle invalid namespaced element', function(done) { - var xml = fs.readFileSync('test/fixtures/bpmn/error/categoryValue.bpmn', 'utf8'); + var xml = require('../fixtures/bpmn/error/categoryValue.bpmn'); // when createViewer(xml, function(err, warnings) { @@ -227,7 +221,7 @@ describe('Viewer', function() { it('should handle missing namespace', function(done) { - var xml = fs.readFileSync('test/fixtures/bpmn/error/missing-namespace.bpmn', 'utf8'); + var xml = require('../fixtures/bpmn/error/missing-namespace.bpmn'); // when createViewer(xml, function(err, warnings) { @@ -254,7 +248,7 @@ describe('Viewer', function() { it('should be available via di as ', function(done) { - var xml = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8'); + var xml = require('../fixtures/bpmn/simple.bpmn'); createViewer(xml, function(err, warnings, viewer) { @@ -295,7 +289,7 @@ describe('Viewer', function() { it('should export svg', function(done) { // given - var xml = fs.readFileSync('test/fixtures/bpmn/empty-definitions.bpmn', 'utf8'); + var xml = require('../fixtures/bpmn/empty-definitions.bpmn'); createViewer(xml, function(err, warnings, viewer) { @@ -322,7 +316,7 @@ describe('Viewer', function() { it('should export complex svg', function(done) { // given - var xml = fs.readFileSync('test/fixtures/bpmn/complex.bpmn', 'utf8'); + var xml = require('../fixtures/bpmn/complex.bpmn'); createViewer(xml, function(err, warnings, viewer) { @@ -354,7 +348,7 @@ describe('Viewer', function() { it('should remove outer-makers on export', function(done) { // given - var xml = fs.readFileSync('test/fixtures/bpmn/complex.bpmn', 'utf8'); + var xml = require('../fixtures/bpmn/complex.bpmn'); function appendTestRect(svgDoc) { var rect = document.createElementNS(svgDoc.namespaceURI, 'rect'); rect.setAttribute('class', 'outer-bound-marker'); @@ -409,7 +403,7 @@ describe('Viewer', function() { ]; // given - var xml = fs.readFileSync('test/fixtures/bpmn/empty-definitions.bpmn', 'utf8'); + var xml = require('../fixtures/bpmn/empty-definitions.bpmn'); var viewer; @@ -473,7 +467,7 @@ describe('Viewer', function() { it('should provide custom moddle extensions', function(done) { - var xml = fs.readFileSync('test/fixtures/bpmn/extension/camunda.bpmn', 'utf8'); + var xml = require('../fixtures/bpmn/extension/camunda.bpmn'); // given viewer = new Viewer({ diff --git a/test/spec/draw/BpmnRendererSpec.js b/test/spec/draw/BpmnRendererSpec.js index ef01c35e..8c889ec7 100644 --- a/test/spec/draw/BpmnRendererSpec.js +++ b/test/spec/draw/BpmnRendererSpec.js @@ -1,151 +1,147 @@ 'use strict'; -var Matchers = require('../../Matchers'); +var TestHelper = require('../../TestHelper'); - -var fs = require('fs'); +/* global bootstrapViewer */ describe('draw - bpmn renderer', function() { - beforeEach(Matchers.addDeepEquals); - - it('should render activity markers', function(done) { - var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/activity-markers.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/draw/activity-markers.bpmn'); bootstrapViewer(xml)(done); }); it('should render activity markers (combination)', function(done) { - var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/activity-markers-combination.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/draw/activity-markers-combination.bpmn'); bootstrapViewer(xml)(done); }); it('should render conditional flows', function(done) { - var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/conditional-flow.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/draw/conditional-flow.bpmn'); bootstrapViewer(xml)(done); }); it('should render conditional default flows', function(done) { - var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/conditional-flow-default.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/draw/conditional-flow-default.bpmn'); 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'); + var xml = require('../../fixtures/bpmn/draw/conditional-flow-gateways.bpmn'); 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'); + var xml = require('../../fixtures/bpmn/draw/conditional-flow-typed-task.bpmn'); bootstrapViewer(xml)(done); }); it('should render data objects', function(done) { - var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/data-objects.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/draw/data-objects.bpmn'); bootstrapViewer(xml)(done); }); it('should render events', function(done) { - var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/events.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/draw/events.bpmn'); bootstrapViewer(xml)(done); }); it('should render events (interrupting)', function(done) { - var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/events-interrupting.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/draw/events-interrupting.bpmn'); bootstrapViewer(xml)(done); }); it('should render event subprocesses (collapsed)', function(done) { - var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/event-subprocesses-collapsed.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/draw/event-subprocesses-collapsed.bpmn'); bootstrapViewer(xml)(done); }); it('should render event subprocesses (expanded)', function(done) { - var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/event-subprocesses-expanded.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/draw/event-subprocesses-expanded.bpmn'); bootstrapViewer(xml)(done); }); it('should render gateways', function(done) { - var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/gateways.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/draw/gateways.bpmn'); bootstrapViewer(xml)(done); }); it('should render group', function(done) { - var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/group.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/draw/group.bpmn'); bootstrapViewer(xml)(done); }); it('should render message marker', function(done) { - var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/message-marker.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/draw/message-marker.bpmn'); bootstrapViewer(xml)(done); }); it('should render pools', function(done) { - var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/pools.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/draw/pools.bpmn'); 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'); + var xml = require('../../fixtures/bpmn/draw/pools-with-collection-marker.bpmn'); bootstrapViewer(xml)(done); }); it('should render task types', function(done) { - var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/task-types.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/draw/task-types.bpmn'); bootstrapViewer(xml)(done); }); it('should render text annotations', function(done) { - var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/text-annotation.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/draw/text-annotation.bpmn'); bootstrapViewer(xml)(done); }); it('should render flow markers', function(done) { - var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/flow-markers.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/flow-markers.bpmn'); 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'); + var xml = require('../../fixtures/bpmn/draw/xor.bpmn'); 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'); + var xml = require('../../fixtures/bpmn/draw/boundary-event-z-index.bpmn'); 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'); + var xml = require('../../fixtures/bpmn/draw/boundary-event-without-refnode.bpmn'); 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'); + var xml = require('../../fixtures/bpmn/draw/boundary-event-with-refnode.bpmn'); bootstrapViewer(xml)(done); }); it('should render gateway event if attribute is missing in XML', function(done) { - var xml = fs.readFileSync(__dirname + '/../../fixtures/bpmn/draw/gateway-type-default.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/draw/gateway-type-default.bpmn'); bootstrapViewer(xml)(done); }); diff --git a/test/spec/environment/MockingSpec.js b/test/spec/environment/MockingSpec.js index 06e1e1a9..87ec55eb 100644 --- a/test/spec/environment/MockingSpec.js +++ b/test/spec/environment/MockingSpec.js @@ -4,8 +4,6 @@ var TestHelper = require('../../TestHelper'); /* global bootstrapViewer, inject */ -var fs = require('fs'); - var Events = require('diagram-js/lib/core/EventBus'); var Viewer = require('../../../lib/Viewer'); @@ -13,7 +11,7 @@ var Viewer = require('../../../lib/Viewer'); describe('environment - mocking', function() { - var diagramXML = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8'); + var diagramXML = require('../../fixtures/bpmn/simple.bpmn'); var mockEvents, bootstrapCalled; diff --git a/test/spec/features/context-pad/ContextPadProviderSpec.js b/test/spec/features/context-pad/ContextPadProviderSpec.js index 009dfb61..d2220672 100644 --- a/test/spec/features/context-pad/ContextPadProviderSpec.js +++ b/test/spec/features/context-pad/ContextPadProviderSpec.js @@ -1,13 +1,10 @@ 'use strict'; -var Matchers = require('../../../Matchers'), - TestHelper = require('../../../TestHelper'); +var TestHelper = require('../../../TestHelper'); /* global bootstrapViewer, inject */ -var fs = require('fs'); - var contextPadModule = require('../../../../lib/features/context-pad'), bpmnModule = require('../../../../lib/core'), popupModule = require('diagram-js/lib/features/popup-menu'), @@ -16,10 +13,7 @@ var contextPadModule = require('../../../../lib/features/context-pad'), describe('features - context-pad', function() { - beforeEach(Matchers.addDeepEquals); - - - var diagramXML = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8'); + var diagramXML = require('../../../fixtures/bpmn/simple.bpmn'); var testModules = [ contextPadModule, bpmnModule, popupModule, replaceModule ]; diff --git a/test/spec/features/label-editing/LabelEditingProviderSpec.js b/test/spec/features/label-editing/LabelEditingProviderSpec.js index 88f3ebe6..ef818516 100644 --- a/test/spec/features/label-editing/LabelEditingProviderSpec.js +++ b/test/spec/features/label-editing/LabelEditingProviderSpec.js @@ -5,9 +5,6 @@ require('../../../TestHelper'); /* global bootstrapViewer, inject */ -var fs = require('fs'); - - var labelEditingModule = require('../../../../lib/features/label-editing'), coreModule = require('../../../../lib/core'); @@ -30,7 +27,7 @@ function triggerKeyEvent(element, event, code) { describe('features - label-editing', function() { - var diagramXML = fs.readFileSync('test/fixtures/bpmn/features/label-editing/labels.bpmn', 'utf8'); + var diagramXML = require('../../../fixtures/bpmn/features/label-editing/labels.bpmn'); var testModules = [ labelEditingModule, coreModule ]; diff --git a/test/spec/features/label-editing/TouchIntegrationSpec.js b/test/spec/features/label-editing/TouchIntegrationSpec.js index 50cd6311..1b4df813 100644 --- a/test/spec/features/label-editing/TouchIntegrationSpec.js +++ b/test/spec/features/label-editing/TouchIntegrationSpec.js @@ -6,9 +6,6 @@ var TestHelper = require('../../../TestHelper'); var Modeler = require('../../../../lib/Modeler'); -var fs = require('fs'); - - describe('direct editing - touch integration', function() { var container; @@ -28,13 +25,13 @@ describe('direct editing - touch integration', function() { it('should work on modeler (manual test)', function(done) { - var xml = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8'); + var xml = require('../../../fixtures/bpmn/simple.bpmn'); createModeler(xml, done); }); it('should edit labels via double tap (manual test)', function(done) { - var xml = fs.readFileSync('test/fixtures/bpmn/features/label-editing/labels.bpmn', 'utf8'); + var xml = require('../../../fixtures/bpmn/features/label-editing/labels.bpmn'); createModeler(xml, done); }); diff --git a/test/spec/features/modeling/AppendShapeSpec.js b/test/spec/features/modeling/AppendShapeSpec.js index e50de7a3..138fac96 100644 --- a/test/spec/features/modeling/AppendShapeSpec.js +++ b/test/spec/features/modeling/AppendShapeSpec.js @@ -6,8 +6,6 @@ var TestHelper = require('../../../TestHelper'); var find = require('lodash/collection/find'); -var fs = require('fs'); - var modelingModule = require('../../../../lib/features/modeling'), coreModule = require('../../../../lib/core'); @@ -17,7 +15,7 @@ var LabelUtil = require('../../../../lib/util/Label'); describe('features/modeling - append shape', function() { - var diagramXML = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8'); + var diagramXML = require('../../../fixtures/bpmn/simple.bpmn'); var testModules = [ coreModule, modelingModule ]; diff --git a/test/spec/features/modeling/BendpointsSpec.js b/test/spec/features/modeling/BendpointsSpec.js index e0b13d04..3b77da2a 100644 --- a/test/spec/features/modeling/BendpointsSpec.js +++ b/test/spec/features/modeling/BendpointsSpec.js @@ -4,9 +4,6 @@ var TestHelper = require('../../../TestHelper'); /* global bootstrapModeler, inject */ -var _ = require('lodash'); - -var fs = require('fs'); var modelingModule = require('../../../../lib/features/modeling'), bendpointsModule = require('diagram-js/lib/features/bendpoints'), @@ -15,7 +12,7 @@ var modelingModule = require('../../../../lib/features/modeling'), describe('features/bendpoints', function() { - var diagramXML = fs.readFileSync('test/fixtures/bpmn/features/drop/drop.bpmn', 'utf8'); + var diagramXML = require('../../../fixtures/bpmn/features/drop/drop.bpmn'); var testModules = [ coreModule, bendpointsModule, modelingModule ]; diff --git a/test/spec/features/modeling/BpmnFactorySpec.js b/test/spec/features/modeling/BpmnFactorySpec.js index d1c29bdd..c4a9c33f 100644 --- a/test/spec/features/modeling/BpmnFactorySpec.js +++ b/test/spec/features/modeling/BpmnFactorySpec.js @@ -6,8 +6,6 @@ var Matchers = require('../../../Matchers'), /* global bootstrapModeler, inject */ -var fs = require('fs'); - var modelingModule = require('../../../../lib/features/modeling'), coreModule = require('../../../../lib/core'); @@ -17,7 +15,7 @@ describe('features - bpmn-factory', function() { beforeEach(Matchers.addDeepEquals); - var diagramXML = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8'); + var diagramXML = require('../../../fixtures/bpmn/simple.bpmn'); var testModules = [ modelingModule, coreModule ]; diff --git a/test/spec/features/modeling/CreateConnectionSpec.js b/test/spec/features/modeling/CreateConnectionSpec.js index 16de72e4..5db88db1 100644 --- a/test/spec/features/modeling/CreateConnectionSpec.js +++ b/test/spec/features/modeling/CreateConnectionSpec.js @@ -5,9 +5,6 @@ var Matchers = require('../../../Matchers'), /* global bootstrapModeler, inject */ -var _ = require('lodash'); - -var fs = require('fs'); var modelingModule = require('../../../../lib/features/modeling'), coreModule = require('../../../../lib/core'); @@ -18,7 +15,7 @@ describe('features/modeling - create connection', function() { beforeEach(Matchers.addDeepEquals); - var diagramXML = fs.readFileSync('test/fixtures/bpmn/sequence-flows.bpmn', 'utf8'); + var diagramXML = require('../../../fixtures/bpmn/sequence-flows.bpmn'); var testModules = [ coreModule, modelingModule ]; diff --git a/test/spec/features/modeling/DeleteConnectionSpec.js b/test/spec/features/modeling/DeleteConnectionSpec.js index d220b494..8148b844 100644 --- a/test/spec/features/modeling/DeleteConnectionSpec.js +++ b/test/spec/features/modeling/DeleteConnectionSpec.js @@ -5,10 +5,6 @@ var Matchers = require('../../../Matchers'), TestHelper = require('../../../TestHelper'); -var _ = require('lodash'); - -var fs = require('fs'); - var modelingModule = require('../../../../lib/features/modeling'), coreModule = require('../../../../lib/core'); @@ -18,7 +14,7 @@ describe('features/modeling - #removeConnection', function() { beforeEach(Matchers.addDeepEquals); - var diagramXML = fs.readFileSync('test/fixtures/bpmn/sequence-flows.bpmn', 'utf8'); + var diagramXML = require('../../../fixtures/bpmn/sequence-flows.bpmn'); var testModules = [ coreModule, modelingModule ]; @@ -67,8 +63,7 @@ describe('features/modeling - #removeConnection', function() { // given var sequenceFlowShape = elementRegistry.get('SequenceFlow_2'), - sequenceFlow = sequenceFlowShape.businessObject, - parent = sequenceFlow.$parent; + sequenceFlow = sequenceFlowShape.businessObject; // when modeling.removeConnection(sequenceFlowShape); diff --git a/test/spec/features/modeling/DeleteShapeSpec.js b/test/spec/features/modeling/DeleteShapeSpec.js index 5ba5b4b2..0f3ff6da 100644 --- a/test/spec/features/modeling/DeleteShapeSpec.js +++ b/test/spec/features/modeling/DeleteShapeSpec.js @@ -2,12 +2,7 @@ /* global bootstrapModeler, inject */ -var Matchers = require('../../../Matchers'), - TestHelper = require('../../../TestHelper'); - -var _ = require('lodash'); - -var fs = require('fs'); +var TestHelper = require('../../../TestHelper'); var modelingModule = require('../../../../lib/features/modeling'), coreModule = require('../../../../lib/core'); @@ -15,10 +10,7 @@ var modelingModule = require('../../../../lib/features/modeling'), describe('features/modeling - #removeShape', function() { - beforeEach(Matchers.addDeepEquals); - - - var diagramXML = fs.readFileSync('test/fixtures/bpmn/sequence-flows.bpmn', 'utf8'); + var diagramXML = require('../../../fixtures/bpmn/sequence-flows.bpmn'); var testModules = [ coreModule, modelingModule ]; @@ -67,8 +59,7 @@ describe('features/modeling - #removeShape', function() { // given var taskShape = elementRegistry.get('Task_1'), - task = taskShape.businessObject, - parent = task.$parent; + task = taskShape.businessObject; // when modeling.removeShape(taskShape); diff --git a/test/spec/features/modeling/DropSpec.js b/test/spec/features/modeling/DropSpec.js index ff0ee5c9..7be6e438 100644 --- a/test/spec/features/modeling/DropSpec.js +++ b/test/spec/features/modeling/DropSpec.js @@ -4,18 +4,14 @@ var TestHelper = require('../../../TestHelper'); /* global bootstrapModeler, inject */ -var _ = require('lodash'); - -var fs = require('fs'); - var modelingModule = require('../../../../lib/features/modeling'), coreModule = require('../../../../lib/core'); describe('features/move - drop', function() { - var diagramXML = fs.readFileSync('test/fixtures/bpmn/features/drop/drop.bpmn', 'utf8'); - var diagramXML2 = fs.readFileSync('test/fixtures/bpmn/features/drop/recursive-task.bpmn', 'utf8'); + var diagramXML = require('../../../fixtures/bpmn/features/drop/drop.bpmn'); + var diagramXML2 = require('../../../fixtures/bpmn/features/drop/recursive-task.bpmn'); var testModules = [ coreModule, modelingModule ]; diff --git a/test/spec/features/modeling/LayoutConnectionSpec.js b/test/spec/features/modeling/LayoutConnectionSpec.js index bb46bee4..83c89708 100644 --- a/test/spec/features/modeling/LayoutConnectionSpec.js +++ b/test/spec/features/modeling/LayoutConnectionSpec.js @@ -5,9 +5,6 @@ var Matchers = require('../../../Matchers'), /* global bootstrapModeler, inject */ -var _ = require('lodash'); - -var fs = require('fs'); var modelingModule = require('../../../../lib/features/modeling'), coreModule = require('../../../../lib/core'); @@ -18,7 +15,7 @@ describe('features/modeling - layout connection', function() { beforeEach(Matchers.addDeepEquals); - var diagramXML = fs.readFileSync('test/fixtures/bpmn/sequence-flows.bpmn', 'utf8'); + var diagramXML = require('../../../fixtures/bpmn/sequence-flows.bpmn'); var testModules = [ coreModule, modelingModule ]; diff --git a/test/spec/features/modeling/MoveConnectionSpec.js b/test/spec/features/modeling/MoveConnectionSpec.js index 917c5797..bb2e8753 100644 --- a/test/spec/features/modeling/MoveConnectionSpec.js +++ b/test/spec/features/modeling/MoveConnectionSpec.js @@ -5,9 +5,6 @@ var Matchers = require('../../../Matchers'), /* global bootstrapModeler, inject */ -var _ = require('lodash'); - -var fs = require('fs'); var modelingModule = require('../../../../lib/features/modeling'), coreModule = require('../../../../lib/core'); @@ -18,7 +15,7 @@ describe('features/modeling - move connection', function() { beforeEach(Matchers.addDeepEquals); - var diagramXML = fs.readFileSync('test/fixtures/bpmn/sequence-flows.bpmn', 'utf8'); + var diagramXML = require('../../../fixtures/bpmn/sequence-flows.bpmn'); var testModules = [ coreModule, modelingModule ]; diff --git a/test/spec/features/modeling/MoveShapeSpec.js b/test/spec/features/modeling/MoveShapeSpec.js index 04dcb964..945d8a2c 100644 --- a/test/spec/features/modeling/MoveShapeSpec.js +++ b/test/spec/features/modeling/MoveShapeSpec.js @@ -5,9 +5,6 @@ var Matchers = require('../../../Matchers'), /* global bootstrapModeler, inject */ -var _ = require('lodash'); - -var fs = require('fs'); var modelingModule = require('../../../../lib/features/modeling'), coreModule = require('../../../../lib/core'); @@ -18,7 +15,7 @@ describe('features/modeling - move shape', function() { beforeEach(Matchers.addDeepEquals); - var diagramXML = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8'); + var diagramXML = require('../../../fixtures/bpmn/simple.bpmn'); var testModules = [ coreModule, modelingModule ]; diff --git a/test/spec/features/modeling/UpdatePropertiesSpec.js b/test/spec/features/modeling/UpdatePropertiesSpec.js index d7b975bd..ae73c255 100644 --- a/test/spec/features/modeling/UpdatePropertiesSpec.js +++ b/test/spec/features/modeling/UpdatePropertiesSpec.js @@ -5,17 +5,13 @@ var TestHelper = require('../../../TestHelper'); /* global bootstrapModeler, inject */ -var _ = require('lodash'); - -var fs = require('fs'); - var modelingModule = require('../../../../lib/features/modeling'), coreModule = require('../../../../lib/core'); describe('features/modeling - update properties', function() { - var diagramXML = fs.readFileSync('test/fixtures/bpmn/conditions.bpmn', 'utf8'); + var diagramXML = require('../../../fixtures/bpmn/conditions.bpmn'); var testModules = [ coreModule, modelingModule ]; diff --git a/test/spec/features/modeling/append/TextAnnotationSpec.js b/test/spec/features/modeling/append/TextAnnotationSpec.js index 0f57bb89..4af60d4d 100644 --- a/test/spec/features/modeling/append/TextAnnotationSpec.js +++ b/test/spec/features/modeling/append/TextAnnotationSpec.js @@ -1,27 +1,19 @@ 'use strict'; -var Matchers = require('../../../../Matchers'), - TestHelper = require('../../../../TestHelper'); +var TestHelper = require('../../../../TestHelper'); /* global bootstrapModeler, inject */ -var find = require('lodash/collection/find'); -var fs = require('fs'); +var find = require('lodash/collection/find'); var modelingModule = require('../../../../../lib/features/modeling'), coreModule = require('../../../../../lib/core'); -var LabelUtil = require('../../../../../lib/util/Label'); - - describe('features/modeling - append text-annotation', function() { - beforeEach(Matchers.addDeepEquals); - - - var diagramXML = fs.readFileSync('test/fixtures/bpmn/containers.bpmn', 'utf8'); + var diagramXML = require('../../../../fixtures/bpmn/containers.bpmn'); var testModules = [ coreModule, modelingModule ]; diff --git a/test/spec/features/replace/BpmnReplaceSpec.js b/test/spec/features/replace/BpmnReplaceSpec.js index a5503188..d013dcd2 100644 --- a/test/spec/features/replace/BpmnReplaceSpec.js +++ b/test/spec/features/replace/BpmnReplaceSpec.js @@ -4,8 +4,6 @@ var TestHelper = require('../../../TestHelper'); /* global bootstrapModeler, inject */ -var fs = require('fs'); - var modelingModule = require('../../../../lib/features/modeling'), replaceModule = require('../../../../lib/features/replace'), coreModule = require('../../../../lib/core'); @@ -14,7 +12,7 @@ var modelingModule = require('../../../../lib/features/modeling'), describe('features/replace', function() { - var diagramXML = fs.readFileSync('test/fixtures/bpmn/features/replace/01_replace.bpmn', 'utf8'); + var diagramXML = require('../../../fixtures/bpmn/features/replace/01_replace.bpmn'); var testModules = [ coreModule, modelingModule, replaceModule ]; diff --git a/test/spec/features/replace/ReplaceOptionsChooserSpec.js b/test/spec/features/replace/ReplaceOptionsChooserSpec.js index 496838a9..8ffe9aef 100644 --- a/test/spec/features/replace/ReplaceOptionsChooserSpec.js +++ b/test/spec/features/replace/ReplaceOptionsChooserSpec.js @@ -4,8 +4,6 @@ var TestHelper = require('../../../TestHelper'); /* global bootstrapModeler, inject */ -var fs = require('fs'); - var modelingModule = require('../../../../lib/features/modeling'), replaceModule = require('../../../../lib/features/replace'), coreModule = require('../../../../lib/core'); @@ -14,7 +12,7 @@ var modelingModule = require('../../../../lib/features/modeling'), describe('features/replace - chooser', function() { - var diagramXML = fs.readFileSync('test/fixtures/bpmn/features/replace/01_replace.bpmn', 'utf8'); + var diagramXML = require('../../../fixtures/bpmn/features/replace/01_replace.bpmn'); var testModules = [ coreModule, modelingModule, replaceModule ]; diff --git a/test/spec/features/replace/ReplaceRulesSpec.js b/test/spec/features/replace/ReplaceRulesSpec.js index 0ee1100c..c4ba9317 100644 --- a/test/spec/features/replace/ReplaceRulesSpec.js +++ b/test/spec/features/replace/ReplaceRulesSpec.js @@ -4,8 +4,6 @@ var TestHelper = require('../../../TestHelper'); /* global bootstrapModeler, inject */ -var fs = require('fs'); - var modelingModule = require('../../../../lib/features/modeling'), replaceModule = require('../../../../lib/features/replace'), coreModule = require('../../../../lib/core'); @@ -14,7 +12,7 @@ var modelingModule = require('../../../../lib/features/modeling'), describe('features/replace', function() { - var diagramXML = fs.readFileSync('test/fixtures/bpmn/features/replace/association-gateways.bpmn', 'utf8'); + var diagramXML = require('../../../fixtures/bpmn/features/replace/association-gateways.bpmn'); var testModules = [ coreModule, modelingModule, replaceModule ]; diff --git a/test/spec/features/rules/ModelingRulesSpec.js b/test/spec/features/rules/ModelingRulesSpec.js index c3d65ade..65ce9353 100644 --- a/test/spec/features/rules/ModelingRulesSpec.js +++ b/test/spec/features/rules/ModelingRulesSpec.js @@ -1,11 +1,7 @@ 'use strict'; -var Matchers = require('../../../Matchers'); - /* global bootstrapModeler, inject */ -var fs = require('fs'); - var modelingModule = require('../../../../lib/features/modeling'), rulesModule = require('../../../../lib/features/modeling/rules'), coreModule = require('../../../../lib/core'); @@ -13,15 +9,12 @@ var modelingModule = require('../../../../lib/features/modeling'), describe('features/ModelingRules', function() { - beforeEach(Matchers.addDeepEquals); + var sequenceXML = require('../../../fixtures/bpmn/sequence-flows.bpmn'); + var eventGatewaysEdgeXML = require('../../../fixtures/bpmn/features/rules/event-based-gateway-outgoing-edge.bpmn'); + var linkEventXML = require('../../../fixtures/bpmn/features/rules/link-event.bpmn'); + var textAnnotationXML = require('../../../fixtures/bpmn/features/rules/text-annotation-association.bpmn'); - var sequenceXML = fs.readFileSync('test/fixtures/bpmn/sequence-flows.bpmn', 'utf8'); - var eventGatewaysEdgeXML = - fs.readFileSync('test/fixtures/bpmn/features/rules/event-based-gateway-outgoing-edge.bpmn', 'utf8'); - var linkEventXML = fs.readFileSync('test/fixtures/bpmn/features/rules/link-event.bpmn', 'utf8'); - var textAnnotationXML = fs.readFileSync('test/fixtures/bpmn/features/rules/text-annotation-association.bpmn', 'utf8'); - var testModules = [ coreModule, modelingModule, rulesModule ]; @@ -49,11 +42,13 @@ describe('features/ModelingRules', function() { })); }); + describe('eventbased gateway', function() { beforeEach(bootstrapModeler(eventGatewaysEdgeXML, { modules: testModules })); - it('should allow catching message intermediate event on outgoing edges', inject(function(elementRegistry, modeling, rules) { + it('should allow catching message intermediate event on outgoing edges', + inject(function(elementRegistry, modeling, rules) { // given var eventGateway = elementRegistry.get('EventBasedGateway_1'), @@ -72,7 +67,9 @@ describe('features/ModelingRules', function() { expect(allowed).toBe(true); })); - it('should allow catching timer intermediate event on outgoing edges', inject(function(elementRegistry, modeling, rules) { + + it('should allow catching timer intermediate event on outgoing edges', + inject(function(elementRegistry, modeling, rules) { // given var eventGateway = elementRegistry.get('EventBasedGateway_1'), @@ -91,7 +88,9 @@ describe('features/ModelingRules', function() { expect(allowed).toBe(true); })); - it('should allow catching condition intermediate event on outgoing edges', inject(function(elementRegistry, modeling, rules) { + + it('should allow catching condition intermediate event on outgoing edges', + inject(function(elementRegistry, modeling, rules) { // given var eventGateway = elementRegistry.get('EventBasedGateway_1'), @@ -110,7 +109,9 @@ describe('features/ModelingRules', function() { expect(allowed).toBe(true); })); - it('should allow catching signal intermediate event on outgoing edges', inject(function(elementRegistry, modeling, rules) { + + it('should allow catching signal intermediate event on outgoing edges', + inject(function(elementRegistry, modeling, rules) { // given var eventGateway = elementRegistry.get('EventBasedGateway_1'), @@ -129,7 +130,9 @@ describe('features/ModelingRules', function() { expect(allowed).toBe(true); })); - it('should allow receive task on outgoing edges', inject(function(elementRegistry, modeling, rules) { + + it('should allow receive task on outgoing edges', + inject(function(elementRegistry, modeling, rules) { // given var eventGateway = elementRegistry.get('EventBasedGateway_1'), @@ -148,7 +151,9 @@ describe('features/ModelingRules', function() { expect(allowed).toBe(true); })); - it('should not allow throw event on outgoing edges', inject(function(elementRegistry, modeling, rules) { + + it('should not allow throw event on outgoing edges', + inject(function(elementRegistry, modeling, rules) { // given var eventGateway = elementRegistry.get('EventBasedGateway_1'), @@ -167,7 +172,9 @@ describe('features/ModelingRules', function() { expect(allowed).toBe(false); })); - it('should not allow task on outgoing edges', inject(function(elementRegistry, modeling, rules) { + + it('should not allow task on outgoing edges', + inject(function(elementRegistry, modeling, rules) { // given var eventGateway = elementRegistry.get('EventBasedGateway_1'), @@ -189,7 +196,6 @@ describe('features/ModelingRules', function() { }); - describe('catch link events', function() { beforeEach(bootstrapModeler(linkEventXML, { modules: testModules })); @@ -213,7 +219,9 @@ describe('features/ModelingRules', function() { expect(allowed).toBe(false); })); - it('should be allowed to have outgoing sequence flows ', inject(function(elementRegistry, modeling, rules) { + + it('should be allowed to have outgoing sequence flows ', + inject(function(elementRegistry, modeling, rules) { // given var catchEvent = elementRegistry.get('IntermediateCatchEvent'), @@ -230,15 +238,15 @@ describe('features/ModelingRules', function() { // connection should not be allowed expect(allowed).toBe(true); })); - }); + }); describe('throwing link events', function() { beforeEach(bootstrapModeler(linkEventXML, { modules: testModules })); - it('should not have outgoing sequence flows ', inject(function(elementRegistry, modeling, rules) { + it('should not have outgoing sequence flows', inject(function(elementRegistry, modeling, rules) { // given var catchEvent = elementRegistry.get('IntermediateThrowEvent'), @@ -257,7 +265,9 @@ describe('features/ModelingRules', function() { expect(allowed).toBe(false); })); - it('should be allowed to have incoming sequence flows ', inject(function(elementRegistry, modeling, rules) { + + it('should be allowed to have incoming sequence flows ', + inject(function(elementRegistry, modeling, rules) { // given var catchEvent = elementRegistry.get('IntermediateThrowEvent'), @@ -275,8 +285,10 @@ describe('features/ModelingRules', function() { // connection should not be allowed expect(allowed).toBe(true); })); + }); + describe('Association', function() { beforeEach(bootstrapModeler(textAnnotationXML, { modules: testModules })); @@ -297,5 +309,7 @@ describe('features/ModelingRules', function() { // then expect(allowed).toBe(true); })); + }); + }); diff --git a/test/spec/import/ImporterSpec.js b/test/spec/import/ImporterSpec.js index 47dec191..f7488960 100644 --- a/test/spec/import/ImporterSpec.js +++ b/test/spec/import/ImporterSpec.js @@ -3,8 +3,6 @@ var TestHelper = require('../../TestHelper'); -var fs = require('fs'); - var Diagram = require('diagram-js/lib/Diagram'), BpmnModdle = require('bpmn-moddle'), Importer = require('../../../lib/import/Importer'), @@ -52,7 +50,7 @@ describe('import - importer', function() { it('should fire during import', function(done) { // given - var xml = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/simple.bpmn'); var eventCount = 0; @@ -79,7 +77,7 @@ describe('import - importer', function() { it('should import simple process', function(done) { // given - var xml = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/simple.bpmn'); var events = []; @@ -117,7 +115,7 @@ describe('import - importer', function() { it('should import collaboration', function(done) { // given - var xml = fs.readFileSync('test/fixtures/bpmn/collaboration.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/collaboration.bpmn'); var events = []; @@ -154,7 +152,7 @@ describe('import - importer', function() { describe('model wiring', function() { - var xml = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/simple.bpmn'); var elements; @@ -262,7 +260,7 @@ describe('import - importer', function() { it('should import invalid flowElement', function(done) { // given - var xml = fs.readFileSync('test/fixtures/bpmn/error/invalid-flow-element.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/error/invalid-flow-element.bpmn'); // when runImport(diagram, xml, function(err, warnings) { @@ -277,7 +275,7 @@ describe('import - importer', function() { it('should import multiple dis', function(done) { // given - var xml = fs.readFileSync('test/fixtures/bpmn/error/multiple-dis.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/error/multiple-dis.bpmn'); // when runImport(diagram, xml, function(err, warnings) { @@ -296,7 +294,7 @@ describe('import - importer', function() { it('should extend missing attribute with default value', function(done) { // given - var xml = fs.readFileSync('test/fixtures//bpmn/draw/gateway-type-default.bpmn', 'utf8'); + var xml = require('../../fixtures//bpmn/draw/gateway-type-default.bpmn'); // when runImport(diagram, xml, function(err, warnings) { @@ -319,7 +317,7 @@ describe('import - importer', function() { it('should import complex', function(done) { // given - var xml = fs.readFileSync('test/fixtures/bpmn/complex.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/complex.bpmn'); // when runImport(diagram, xml, function(err, warnings) { @@ -335,7 +333,7 @@ describe('import - importer', function() { it('should import dangling process message flows', function(done) { // given - var xml = fs.readFileSync('test/fixtures/bpmn/import/dangling-process-message-flow.bpmn', 'utf8'); + var xml = require('../../fixtures/bpmn/import/dangling-process-message-flow.bpmn'); // when runImport(diagram, xml, function(err, warnings) { @@ -354,7 +352,7 @@ describe('import - importer', function() { describe('position', function() { - var xml1 = fs.readFileSync('test/fixtures/bpmn/import/position/position-testcase.bpmn', 'utf8'); + var xml1 = require('../../fixtures/bpmn/import/position/position-testcase.bpmn'); it('should round shape\'s x and y coordinates', function(done) { diff --git a/test/spec/import/elements/AssociationSpec.js b/test/spec/import/elements/AssociationSpec.js index e8af83ed..27719785 100644 --- a/test/spec/import/elements/AssociationSpec.js +++ b/test/spec/import/elements/AssociationSpec.js @@ -5,18 +5,13 @@ var TestHelper = require('../../../TestHelper'); /* global bootstrapViewer, inject */ -var _ = require('lodash'); - -var fs = require('fs'); - - describe('import - associations', function() { describe('should import association', function() { it('connecting task -> text annotation', function(done) { - var xml = fs.readFileSync('test/fixtures/bpmn/import/association/text-annotation.bpmn', 'utf8'); + var xml = require('../../../fixtures/bpmn/import/association/text-annotation.bpmn'); // given bootstrapViewer(xml)(function(err) { @@ -42,7 +37,7 @@ describe('import - associations', function() { it('connecting boundary -> compensate task', function(done) { - var xml = fs.readFileSync('test/fixtures/bpmn/import/association/compensation.bpmn', 'utf8'); + var xml = require('../../../fixtures/bpmn/import/association/compensation.bpmn'); // given bootstrapViewer(xml)(function(err) { @@ -72,7 +67,7 @@ describe('import - associations', function() { it('task -> data object -> task', function(done) { - var xml = fs.readFileSync('test/fixtures/bpmn/import/association/data-association.bpmn', 'utf8'); + var xml = require('../../../fixtures/bpmn/import/association/data-association.bpmn'); // given bootstrapViewer(xml)(function(err) { @@ -100,7 +95,7 @@ describe('import - associations', function() { it('data input -> task -> data output', function(done) { - var xml = fs.readFileSync('test/fixtures/bpmn/import/association/data-input-output.bpmn', 'utf8'); + var xml = require('../../../fixtures/bpmn/import/association/data-input-output.bpmn'); // given bootstrapViewer(xml)(function(err) { diff --git a/test/spec/import/elements/CollapsedSpec.js b/test/spec/import/elements/CollapsedSpec.js index 19e8b587..52ec97f5 100644 --- a/test/spec/import/elements/CollapsedSpec.js +++ b/test/spec/import/elements/CollapsedSpec.js @@ -1,22 +1,15 @@ 'use strict'; -var Matchers = require('../../../Matchers'), - TestHelper = require('../../../TestHelper'); +var TestHelper = require('../../../TestHelper'); /* global bootstrapViewer, inject */ -var fs = require('fs'); - - describe('import - collapsed container', function() { - beforeEach(Matchers.addDeepEquals); - - describe('in process', function() { - var diagramXML = fs.readFileSync('test/fixtures/bpmn/import/collapsed.bpmn', 'utf8'); + var diagramXML = require('../../../fixtures/bpmn/import/collapsed.bpmn'); beforeEach(bootstrapViewer(diagramXML)); @@ -81,7 +74,7 @@ describe('import - collapsed container', function() { describe('in collaboration', function() { - var diagramXML = fs.readFileSync('test/fixtures/bpmn/import/collapsed-collaboration.bpmn', 'utf8'); + var diagramXML = require('../../../fixtures/bpmn/import/collapsed-collaboration.bpmn'); beforeEach(bootstrapViewer(diagramXML)); @@ -122,4 +115,5 @@ describe('import - collapsed container', function() { })); }); + }); \ No newline at end of file diff --git a/test/spec/import/elements/LabelSpec.js b/test/spec/import/elements/LabelSpec.js index def96598..7e17217c 100644 --- a/test/spec/import/elements/LabelSpec.js +++ b/test/spec/import/elements/LabelSpec.js @@ -6,8 +6,6 @@ var TestHelper = require('../../../TestHelper'); var pick = require('lodash/object/pick'); -var fs = require('fs'); - function bounds(element) { return pick(element, [ 'x', 'y', 'width', 'height' ]); @@ -16,23 +14,22 @@ function bounds(element) { describe('import - labels', function() { - describe('should import embedded labels', function() { it('on flow nodes', function(done) { - var xml = fs.readFileSync('test/fixtures/bpmn/import/labels/embedded.bpmn', 'utf8'); + var xml = require('../../../fixtures/bpmn/import/labels/embedded.bpmn'); bootstrapViewer(xml)(done); }); it('on pools and lanes', function(done) { - var xml = fs.readFileSync('test/fixtures/bpmn/import/labels/collaboration.bpmn', 'utf8'); + var xml = require('../../../fixtures/bpmn/import/labels/collaboration.bpmn'); bootstrapViewer(xml)(done); }); it('on message flows', function(done) { - var xml = fs.readFileSync('test/fixtures/bpmn/import/labels/collaboration-message-flows.bpmn', 'utf8'); + var xml = require('../../../fixtures/bpmn/import/labels/collaboration-message-flows.bpmn'); bootstrapViewer(xml)(done); }); @@ -42,7 +39,7 @@ describe('import - labels', function() { describe('should import external labels', function() { it('with di', function(done) { - var xml = fs.readFileSync('test/fixtures/bpmn/import/labels/external.bpmn', 'utf8'); + var xml = require('../../../fixtures/bpmn/import/labels/external.bpmn'); // given bootstrapViewer(xml)(function(err) { @@ -69,7 +66,7 @@ describe('import - labels', function() { it('without di', function(done) { - var xml = fs.readFileSync('test/fixtures/bpmn/import/labels/external-no-di.bpmn', 'utf8'); + var xml = require('../../../fixtures/bpmn/import/labels/external-no-di.bpmn'); bootstrapViewer(xml)(done); });