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