2014-05-27 15:48:04 +00:00
|
|
|
'use strict';
|
|
|
|
|
2015-04-17 14:40:45 +00:00
|
|
|
var Matchers = require('../../Matchers'),
|
|
|
|
TestHelper = require('../../TestHelper');
|
2014-04-25 11:31:18 +00:00
|
|
|
|
2015-04-17 14:40:45 +00:00
|
|
|
var coreModule = require('../../../lib/core'),
|
|
|
|
rendererModule = require('../../../lib/draw');
|
|
|
|
|
|
|
|
/* global bootstrapViewer, bootstrapModeler, inject */
|
2014-04-25 11:31:18 +00:00
|
|
|
|
|
|
|
|
2014-06-18 09:45:30 +00:00
|
|
|
describe('draw - bpmn renderer', function() {
|
2014-04-25 11:31:18 +00:00
|
|
|
|
2014-05-27 15:48:04 +00:00
|
|
|
it('should render activity markers', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/draw/activity-markers.bpmn');
|
2014-08-05 06:17:22 +00:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-05-21 11:51:59 +00:00
|
|
|
});
|
2014-05-09 13:20:29 +00:00
|
|
|
|
2014-05-18 10:20:11 +00:00
|
|
|
|
2014-05-27 15:48:04 +00:00
|
|
|
it('should render activity markers (combination)', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/draw/activity-markers-combination.bpmn');
|
2014-08-05 06:17:22 +00:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-05-19 14:22:55 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
2014-05-27 15:48:04 +00:00
|
|
|
it('should render conditional flows', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/draw/conditional-flow.bpmn');
|
2014-08-05 06:17:22 +00:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-05-18 10:20:11 +00:00
|
|
|
});
|
|
|
|
|
2014-05-16 12:45:48 +00:00
|
|
|
|
2014-05-27 15:48:04 +00:00
|
|
|
it('should render conditional default flows', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/draw/conditional-flow-default.bpmn');
|
2014-08-05 06:17:22 +00:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-05-16 12:45:48 +00:00
|
|
|
});
|
|
|
|
|
2014-05-02 09:17:25 +00:00
|
|
|
|
2014-05-27 15:48:04 +00:00
|
|
|
it('should render NO conditional flow (gateway)', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/draw/conditional-flow-gateways.bpmn');
|
2014-08-05 06:17:22 +00:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-05-02 09:17:25 +00:00
|
|
|
});
|
|
|
|
|
2014-05-12 09:48:24 +00:00
|
|
|
|
2014-05-27 15:48:04 +00:00
|
|
|
it('should render conditional flow (typed task)', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/draw/conditional-flow-typed-task.bpmn');
|
2014-08-05 06:17:22 +00:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-05-12 09:48:24 +00:00
|
|
|
});
|
|
|
|
|
2014-05-05 15:22:43 +00:00
|
|
|
|
2014-05-27 15:48:04 +00:00
|
|
|
it('should render data objects', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/draw/data-objects.bpmn');
|
2014-08-05 06:17:22 +00:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-05-05 15:22:43 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
2014-05-27 15:48:04 +00:00
|
|
|
it('should render events', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/draw/events.bpmn');
|
2014-08-05 06:17:22 +00:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-05-05 15:22:43 +00:00
|
|
|
});
|
2014-05-09 13:20:29 +00:00
|
|
|
|
2014-05-02 06:25:08 +00:00
|
|
|
|
2014-05-27 15:48:04 +00:00
|
|
|
it('should render events (interrupting)', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/draw/events-interrupting.bpmn');
|
2014-08-05 06:17:22 +00:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-05-02 06:25:08 +00:00
|
|
|
});
|
2014-04-25 11:31:18 +00:00
|
|
|
|
2014-05-09 13:20:29 +00:00
|
|
|
|
2014-05-27 15:48:04 +00:00
|
|
|
it('should render event subprocesses (collapsed)', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/draw/event-subprocesses-collapsed.bpmn');
|
2014-08-05 06:17:22 +00:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-04-25 11:31:18 +00:00
|
|
|
});
|
|
|
|
|
2014-05-09 13:20:29 +00:00
|
|
|
|
2014-05-27 15:48:04 +00:00
|
|
|
it('should render event subprocesses (expanded)', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/draw/event-subprocesses-expanded.bpmn');
|
2014-08-05 06:17:22 +00:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-05-02 06:25:08 +00:00
|
|
|
});
|
|
|
|
|
2014-05-09 13:20:29 +00:00
|
|
|
|
2014-05-02 06:25:08 +00:00
|
|
|
it('should render gateways', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/draw/gateways.bpmn');
|
2014-08-05 06:17:22 +00:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-04-30 14:36:02 +00:00
|
|
|
});
|
|
|
|
|
2014-05-09 13:20:29 +00:00
|
|
|
|
2014-05-27 15:48:04 +00:00
|
|
|
it('should render group', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/draw/group.bpmn');
|
2014-08-05 06:17:22 +00:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-04-25 11:31:18 +00:00
|
|
|
});
|
|
|
|
|
2014-05-09 13:20:29 +00:00
|
|
|
|
2014-05-27 15:48:04 +00:00
|
|
|
it('should render message marker', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/draw/message-marker.bpmn');
|
2014-08-05 06:17:22 +00:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-05-27 15:48:04 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
2014-05-02 06:25:08 +00:00
|
|
|
it('should render pools', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/draw/pools.bpmn');
|
2014-08-05 06:17:22 +00:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-05-02 06:25:08 +00:00
|
|
|
});
|
2014-05-09 13:20:29 +00:00
|
|
|
|
2014-05-27 15:48:04 +00:00
|
|
|
|
|
|
|
it('should render pool collection marker', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/draw/pools-with-collection-marker.bpmn');
|
2014-08-05 06:17:22 +00:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-05-27 15:48:04 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('should render task types', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/draw/task-types.bpmn');
|
2014-08-05 06:17:22 +00:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-05-27 15:48:04 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('should render text annotations', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/draw/text-annotation.bpmn');
|
2014-08-05 06:17:22 +00:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-05-27 15:48:04 +00:00
|
|
|
});
|
|
|
|
|
2014-05-28 20:48:11 +00:00
|
|
|
|
|
|
|
it('should render flow markers', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/flow-markers.bpmn');
|
2014-08-05 06:17:22 +00:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-05-28 20:48:11 +00:00
|
|
|
});
|
|
|
|
|
2014-07-09 08:02:34 +00:00
|
|
|
it('should render xor gateways blank and with X', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/draw/xor.bpmn');
|
2014-08-05 06:17:22 +00:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-07-09 08:02:34 +00:00
|
|
|
});
|
|
|
|
|
2014-07-15 10:43:30 +00:00
|
|
|
it('should render boundary events with correct z-index', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/draw/boundary-event-z-index.bpmn');
|
2014-08-05 06:17:22 +00:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-07-15 10:43:30 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should render boundary events without flowNodeRef', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/draw/boundary-event-without-refnode.bpmn');
|
2014-08-05 06:17:22 +00:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-07-15 10:43:30 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it('should render boundary event only once if referenced incorrectly via flowNodeRef (robustness)', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/draw/boundary-event-with-refnode.bpmn');
|
2014-08-05 06:17:22 +00:00
|
|
|
bootstrapViewer(xml)(done);
|
2014-07-15 10:43:30 +00:00
|
|
|
});
|
|
|
|
|
2014-08-18 10:38:41 +00:00
|
|
|
it('should render gateway event if attribute is missing in XML', function(done) {
|
2015-03-31 12:17:15 +00:00
|
|
|
var xml = require('../../fixtures/bpmn/draw/gateway-type-default.bpmn');
|
2014-08-18 10:38:41 +00:00
|
|
|
bootstrapViewer(xml)(done);
|
|
|
|
});
|
|
|
|
|
2015-02-05 15:00:05 +00:00
|
|
|
});
|
2015-04-17 14:40:45 +00:00
|
|
|
|
|
|
|
describe('path - bpmn renderer', function () {
|
|
|
|
|
|
|
|
beforeEach(Matchers.addDeepEquals);
|
|
|
|
|
|
|
|
|
|
|
|
var diagramXML = require('../../fixtures/bpmn/simple-cropping.bpmn');
|
|
|
|
|
|
|
|
var testModules = [ coreModule, rendererModule ];
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
|
|
|
|
|
|
|
describe('circle', function () {
|
|
|
|
|
|
|
|
|
|
|
|
it('should return a circle path', inject(function(canvas, elementRegistry, renderer) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var eventElement = elementRegistry.get('StartEvent_1');
|
|
|
|
|
|
|
|
// when
|
|
|
|
var startPath = renderer.getShapePath(eventElement);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(startPath).toEqual('M247,343m0,-18a18,18,0,1,1,0,36a18,18,0,1,1,0,-36z');
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('should return a diamond path', inject(function(canvas, elementRegistry, renderer) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var gatewayElement = elementRegistry.get('ExclusiveGateway_1');
|
|
|
|
|
|
|
|
// when
|
|
|
|
var gatewayPath = renderer.getShapePath(gatewayElement);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(gatewayPath).toEqual('M418,318l25,25l-25,25l-25,-25z');
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('should return a rounded rectangular path', inject(function(canvas, elementRegistry, renderer) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var subProcessElement = elementRegistry.get('SubProcess_1');
|
|
|
|
|
|
|
|
// when
|
|
|
|
var subProcessPath = renderer.getShapePath(subProcessElement);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(subProcessPath).toEqual('M584,243l330,0a10,10,0,0,1,10,10l0,180a10,10,0,0,1,-10,10' +
|
|
|
|
'l-330,0a10,10,0,0,1,-10,-10l0,-180a10,10,0,0,1,10,-10z');
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('should return a rectangular path', inject(function(canvas, elementRegistry, renderer) {
|
|
|
|
|
|
|
|
// given
|
|
|
|
var TextAnnotationElement = elementRegistry.get('TextAnnotation_1');
|
|
|
|
|
|
|
|
// when
|
|
|
|
var TextAnnotationPath = renderer.getShapePath(TextAnnotationElement);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expect(TextAnnotationPath).toEqual('M368,156l100,0l0,80l-100,0z');
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|