2014-06-17 09:49:15 +00:00
|
|
|
'use strict';
|
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
import {
|
|
|
|
bootstrapViewer,
|
|
|
|
inject
|
|
|
|
} from 'test/TestHelper';
|
2014-06-17 09:49:15 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
import Events from 'diagram-js/lib/core/EventBus';
|
2014-06-17 09:49:15 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
import Viewer from '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
|
|
|
});
|