2014-06-17 11:49:15 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var TestHelper = require('../../TestHelper');
|
|
|
|
|
2014-08-05 08:17:22 +02:00
|
|
|
/* global bootstrapViewer, inject */
|
2014-06-17 11:49:15 +02:00
|
|
|
|
|
|
|
var Events = require('diagram-js/lib/core/EventBus');
|
|
|
|
|
2014-08-01 07:16:59 +02:00
|
|
|
var Viewer = require('../../../lib/Viewer');
|
2014-06-30 16:56:43 +02:00
|
|
|
|
2014-06-17 11:49:15 +02:00
|
|
|
|
2014-06-18 11:45:30 +02:00
|
|
|
describe('environment - mocking', function() {
|
2014-06-17 11:49:15 +02:00
|
|
|
|
2015-03-31 14:17:15 +02:00
|
|
|
var diagramXML = require('../../fixtures/bpmn/simple.bpmn');
|
2014-06-17 11:49:15 +02:00
|
|
|
|
|
|
|
var mockEvents, bootstrapCalled;
|
|
|
|
|
2014-08-05 08:17:22 +02:00
|
|
|
beforeEach(bootstrapViewer(diagramXML, {
|
2014-06-30 16:56:43 +02:00
|
|
|
modules: Viewer.prototype._modules
|
|
|
|
}, function() {
|
2014-06-17 11:49:15 +02:00
|
|
|
mockEvents = new Events();
|
|
|
|
|
|
|
|
bootstrapCalled = true;
|
|
|
|
|
|
|
|
return {
|
|
|
|
eventBus: mockEvents
|
|
|
|
};
|
|
|
|
}));
|
|
|
|
|
|
|
|
afterEach(function() {
|
|
|
|
bootstrapCalled = false;
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('should use spy', inject(function(eventBus) {
|
|
|
|
|
2015-07-15 17:22:19 +02:00
|
|
|
expect(eventBus).to.eql(mockEvents);
|
|
|
|
expect(bootstrapCalled).to.be.true;
|
2014-06-17 11:49:15 +02:00
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('should reparse bootstrap code', inject(function(eventBus) {
|
|
|
|
|
2015-07-15 17:22:19 +02:00
|
|
|
expect(bootstrapCalled).to.be.true;
|
2014-06-17 11:49:15 +02:00
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('should inject bpmnjs', inject(function(bpmnjs) {
|
|
|
|
|
2015-07-15 17:22:19 +02:00
|
|
|
expect(bpmnjs).to.be.defined;
|
2014-06-17 11:49:15 +02:00
|
|
|
}));
|
|
|
|
|
2015-07-15 17:22:19 +02:00
|
|
|
});
|