2014-05-06 10:00:06 +02:00
|
|
|
'use strict';
|
|
|
|
|
2014-10-30 12:07:28 +01:00
|
|
|
var TestHelper = require('../../../TestHelper');
|
2014-06-18 11:45:30 +02:00
|
|
|
|
2014-08-05 08:17:22 +02:00
|
|
|
/* global bootstrapViewer, inject */
|
2014-04-25 16:14:36 +02:00
|
|
|
|
2015-02-02 14:46:21 +01:00
|
|
|
var pick = require('lodash/object/pick');
|
2014-10-30 12:07:28 +01:00
|
|
|
|
2014-06-18 11:45:30 +02:00
|
|
|
var fs = require('fs');
|
2014-04-25 16:14:36 +02:00
|
|
|
|
|
|
|
|
2014-10-30 12:07:28 +01:00
|
|
|
function bounds(element) {
|
2015-02-02 14:46:21 +01:00
|
|
|
return pick(element, [ 'x', 'y', 'width', 'height' ]);
|
2014-10-30 12:07:28 +01:00
|
|
|
}
|
|
|
|
|
2014-04-25 16:14:36 +02:00
|
|
|
|
2014-10-30 12:07:28 +01:00
|
|
|
describe('import - labels', function() {
|
2014-04-25 16:14:36 +02:00
|
|
|
|
|
|
|
|
2014-05-06 10:00:06 +02:00
|
|
|
describe('should import embedded labels', function() {
|
|
|
|
|
|
|
|
it('on flow nodes', function(done) {
|
2014-06-13 10:58:38 +02:00
|
|
|
var xml = fs.readFileSync('test/fixtures/bpmn/import/labels/embedded.bpmn', 'utf8');
|
2014-08-05 08:17:22 +02:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-04-25 16:14:36 +02:00
|
|
|
});
|
2014-05-06 10:00:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
it('on pools and lanes', function(done) {
|
2014-06-13 10:58:38 +02:00
|
|
|
var xml = fs.readFileSync('test/fixtures/bpmn/import/labels/collaboration.bpmn', 'utf8');
|
2014-08-05 08:17:22 +02:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-05-06 10:00:06 +02:00
|
|
|
});
|
|
|
|
|
2014-06-17 11:03:03 +02:00
|
|
|
|
|
|
|
it('on message flows', function(done) {
|
|
|
|
var xml = fs.readFileSync('test/fixtures/bpmn/import/labels/collaboration-message-flows.bpmn', 'utf8');
|
2014-08-05 08:17:22 +02:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-06-17 11:03:03 +02:00
|
|
|
});
|
|
|
|
|
2014-04-25 16:14:36 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
describe('should import external labels', function() {
|
|
|
|
|
|
|
|
it('with di', function(done) {
|
2014-06-13 10:58:38 +02:00
|
|
|
var xml = fs.readFileSync('test/fixtures/bpmn/import/labels/external.bpmn', 'utf8');
|
2014-10-30 12:07:28 +01:00
|
|
|
|
|
|
|
// given
|
|
|
|
bootstrapViewer(xml)(function(err) {
|
|
|
|
|
|
|
|
if (err) {
|
|
|
|
return done(err);
|
|
|
|
}
|
|
|
|
|
|
|
|
// when
|
|
|
|
inject(function(elementRegistry) {
|
|
|
|
|
2014-11-17 17:36:22 +01:00
|
|
|
var endEvent = elementRegistry.get('EndEvent_1'),
|
|
|
|
sequenceFlow = elementRegistry.get('SequenceFlow_1');
|
2014-10-30 12:07:28 +01:00
|
|
|
|
|
|
|
// then
|
|
|
|
expect(bounds(endEvent.label)).toEqual({ x: 211, y: 256, width: 119, height: 44 });
|
|
|
|
expect(bounds(sequenceFlow.label)).toEqual({ x: 432, y: 317, width: 99, height: 22 });
|
|
|
|
|
|
|
|
done();
|
|
|
|
})();
|
|
|
|
|
|
|
|
});
|
2014-04-25 16:14:36 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('without di', function(done) {
|
2014-06-13 10:58:38 +02:00
|
|
|
var xml = fs.readFileSync('test/fixtures/bpmn/import/labels/external-no-di.bpmn', 'utf8');
|
2014-08-05 08:17:22 +02:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-04-25 16:14:36 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|