'use strict'; var Modeler = require('../../lib/Modeler'); describe('Modeler', function() { var container; beforeEach(function() { container = jasmine.getEnv().getTestContainer(); }); function createModeler(xml, done) { var modeler = new Modeler({ container: container }); modeler.importXML(xml, function(err, warnings) { done(err, warnings, modeler); }); } it('should import simple process', function(done) { var xml = require('../fixtures/bpmn/simple.bpmn'); createModeler(xml, done); }); it('should import collaboration', function(done) { var xml = require('../fixtures/bpmn/collaboration-message-flows.bpmn'); createModeler(xml, done); }); it('should import empty definitions', function(done) { var xml = require('../fixtures/bpmn/empty-definitions.bpmn'); createModeler(xml, done); }); it('should re-import simple process', function(done) { var xml = require('../fixtures/bpmn/simple.bpmn'); // given createModeler(xml, function(err, warnings, modeler) { if (err) { return done(err); } // when // mimic re-import of same diagram modeler.importXML(xml, function(err, warnings) { if (err) { return done(err); } // then expect(warnings.length).toBe(0); done(); }); }); }); describe('overlay support', function() { it('should allow to add overlays', function(done) { var xml = require('../fixtures/bpmn/simple.bpmn'); createModeler(xml, function(err, warnings, viewer) { // given var overlays = viewer.get('overlays'), elementRegistry = viewer.get('elementRegistry'); // assume expect(overlays).toBeDefined(); expect(elementRegistry).toBeDefined(); // when overlays.add('SubProcess_1', 'badge', { position: { bottom: 0, right: 0 }, html: '