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 {
|
2020-04-29 09:02:42 +00:00
|
|
|
createViewer
|
2019-07-19 11:49:24 +00:00
|
|
|
} from 'test/TestHelper';
|
|
|
|
|
2020-12-21 12:32:16 +00:00
|
|
|
var singleStart = window.__env__ && window.__env__.SINGLE_START === 'navigated-viewer';
|
|
|
|
|
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
|
|
|
});
|
|
|
|
|
2019-07-19 11:49:24 +00:00
|
|
|
|
2020-12-21 12:32:16 +00:00
|
|
|
(singleStart ? it.only : it)('should import simple process', function() {
|
2020-04-29 09:02:42 +00:00
|
|
|
var xml = require('../fixtures/bpmn/simple.bpmn');
|
|
|
|
return createViewer(container, NavigatedViewer, xml).then(function(result) {
|
2019-07-19 11:49:24 +00:00
|
|
|
|
2020-04-29 09:02:42 +00:00
|
|
|
expect(result.error).not.to.exist;
|
2015-01-10 11:04:26 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
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
|
|
|
|
2020-04-29 09:02:42 +00:00
|
|
|
it('should include zoomScroll', function() {
|
2015-03-31 12:17:15 +00:00
|
|
|
|
2020-04-29 09:02:42 +00:00
|
|
|
return createViewer(container, NavigatedViewer, xml).then(function(result) {
|
|
|
|
|
|
|
|
var viewer = result.viewer;
|
|
|
|
var err = result.error;
|
2015-01-10 11:04:26 +00:00
|
|
|
|
2020-04-29 09:02:42 +00:00
|
|
|
expect(err).not.to.exist;
|
|
|
|
expect(viewer.get('zoomScroll')).to.exist;
|
2015-01-10 11:04:26 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2020-04-29 09:02:42 +00:00
|
|
|
it('should include moveCanvas', function() {
|
|
|
|
return createViewer(container, NavigatedViewer, xml).then(function(result) {
|
2015-01-10 11:04:26 +00:00
|
|
|
|
2020-04-29 09:02:42 +00:00
|
|
|
var viewer = result.viewer;
|
|
|
|
var err = result.error;
|
|
|
|
|
|
|
|
expect(err).not.to.exist;
|
|
|
|
expect(viewer.get('moveCanvas')).to.exist;
|
2015-01-10 11:04:26 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
2015-07-15 15:22:19 +00:00
|
|
|
});
|