2018-04-02 19:01:53 +00:00
|
|
|
import NavigatedViewer from 'lib/NavigatedViewer';
|
2015-01-10 11:04:26 +00:00
|
|
|
|
2018-10-26 22:51:34 +00:00
|
|
|
import EditorActionsModule from 'lib/features/editor-actions';
|
|
|
|
|
2018-05-23 12:27:32 +00:00
|
|
|
import TestContainer from 'mocha-test-container-support';
|
2015-01-10 11:04:26 +00:00
|
|
|
|
2019-07-19 11:49:24 +00:00
|
|
|
import {
|
|
|
|
setBpmnJS,
|
|
|
|
clearBpmnJS
|
|
|
|
} from 'test/TestHelper';
|
|
|
|
|
2018-10-26 22:51:34 +00:00
|
|
|
|
2015-01-10 11:04:26 +00:00
|
|
|
describe('NavigatedViewer', function() {
|
|
|
|
|
|
|
|
var container;
|
|
|
|
|
|
|
|
beforeEach(function() {
|
2018-05-23 12:27:32 +00:00
|
|
|
container = TestContainer.get(this);
|
2015-01-10 11:04:26 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
function createViewer(xml, done) {
|
2019-07-19 11:49:24 +00:00
|
|
|
|
|
|
|
clearBpmnJS();
|
|
|
|
|
2018-05-23 12:27:32 +00:00
|
|
|
var viewer = new NavigatedViewer({
|
|
|
|
container: container
|
|
|
|
});
|
2015-01-10 11:04:26 +00:00
|
|
|
|
2019-07-19 11:49:24 +00:00
|
|
|
setBpmnJS(viewer);
|
|
|
|
|
2015-01-10 11:04:26 +00:00
|
|
|
viewer.importXML(xml, function(err, warnings) {
|
|
|
|
done(err, warnings, viewer);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
it('should import simple process', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../fixtures/bpmn/simple.bpmn');
|
2015-01-10 11:04:26 +00:00
|
|
|
createViewer(xml, done);
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2018-10-26 22:51:34 +00:00
|
|
|
describe('editor actions support', function() {
|
|
|
|
|
|
|
|
it('should not ship per default', function() {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var navigatedViewer = new NavigatedViewer();
|
|
|
|
|
|
|
|
// when
|
|
|
|
var editorActions = navigatedViewer.get('editorActions', false);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(editorActions).not.to.exist;
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('should ship non-modeling actions if included', function() {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var expectedActions = [
|
|
|
|
'stepZoom',
|
|
|
|
'zoom',
|
|
|
|
'moveCanvas',
|
|
|
|
'selectElements'
|
|
|
|
];
|
|
|
|
|
|
|
|
var navigatedViewer = new NavigatedViewer({
|
|
|
|
additionalModules: [
|
|
|
|
EditorActionsModule
|
|
|
|
]
|
|
|
|
});
|
|
|
|
|
|
|
|
// when
|
|
|
|
var editorActions = navigatedViewer.get('editorActions');
|
|
|
|
|
|
|
|
// then
|
|
|
|
var actualActions = editorActions.getActions();
|
|
|
|
|
|
|
|
expect(actualActions).to.eql(expectedActions);
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2015-01-10 11:04:26 +00:00
|
|
|
describe('navigation features', function() {
|
|
|
|
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../fixtures/bpmn/simple.bpmn');
|
2015-01-10 11:04:26 +00:00
|
|
|
|
|
|
|
it('should include zoomScroll', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
|
2015-01-10 11:04:26 +00:00
|
|
|
createViewer(xml, function(err, warnings, viewer) {
|
2015-12-01 07:27:45 +00:00
|
|
|
expect(viewer.get('zoomScroll')).to.exist;
|
2015-01-10 11:04:26 +00:00
|
|
|
|
|
|
|
done(err);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('should include moveCanvas', function(done) {
|
|
|
|
createViewer(xml, function(err, warnings, viewer) {
|
2015-12-01 07:27:45 +00:00
|
|
|
expect(viewer.get('moveCanvas')).to.exist;
|
2015-01-10 11:04:26 +00:00
|
|
|
|
|
|
|
done(err);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2015-07-15 15:22:19 +00:00
|
|
|
});
|