2014-06-30 15:03:35 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var Matchers = require('../../../Matchers'),
|
|
|
|
TestHelper = require('../../../TestHelper');
|
|
|
|
|
2014-08-05 06:17:22 +00:00
|
|
|
/* global bootstrapModeler, inject */
|
2014-06-30 15:03:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
var fs = require('fs');
|
|
|
|
|
2014-08-01 05:16:59 +00:00
|
|
|
var modelingModule = require('../../../../lib/features/modeling');
|
2014-06-30 15:03:35 +00:00
|
|
|
|
|
|
|
|
2014-08-01 06:32:56 +00:00
|
|
|
describe('features - bpmn-factory', function() {
|
2014-06-30 15:03:35 +00:00
|
|
|
|
2014-07-30 14:06:32 +00:00
|
|
|
beforeEach(Matchers.addDeepEquals);
|
2014-06-30 15:03:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
var diagramXML = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf-8');
|
|
|
|
|
2014-07-23 16:53:33 +00:00
|
|
|
var testModules = [ modelingModule ];
|
2014-06-30 15:03:35 +00:00
|
|
|
|
2014-08-05 06:17:22 +00:00
|
|
|
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
2014-06-30 15:03:35 +00:00
|
|
|
|
|
|
|
|
2014-08-01 06:32:56 +00:00
|
|
|
describe('create di', function() {
|
2014-06-30 15:03:35 +00:00
|
|
|
|
2014-08-01 06:32:56 +00:00
|
|
|
it('should create waypoints', inject(function(bpmnFactory) {
|
2014-06-30 15:03:35 +00:00
|
|
|
|
2014-08-01 06:32:56 +00:00
|
|
|
// given
|
|
|
|
var waypoints = [
|
|
|
|
{ original: { x: 0, y: 0 }, x: 0, y: 0 },
|
|
|
|
{ original: { x: 0, y: 0 }, x: 0, y: 0 }
|
|
|
|
];
|
2014-06-30 15:03:35 +00:00
|
|
|
|
2014-08-01 06:32:56 +00:00
|
|
|
// when
|
|
|
|
var result = bpmnFactory.createDiWaypoints(waypoints);
|
2014-06-30 15:03:35 +00:00
|
|
|
|
2014-08-01 06:32:56 +00:00
|
|
|
// then
|
|
|
|
expect(result).toDeepEqual([
|
|
|
|
{ $type: 'dc:Point', x: 0, y: 0 },
|
|
|
|
{ $type: 'dc:Point', x: 0, y: 0 }
|
|
|
|
]);
|
2014-06-30 15:03:35 +00:00
|
|
|
|
2014-08-01 06:32:56 +00:00
|
|
|
// expect original not to have been accidently serialized
|
|
|
|
expect(result[0].$attrs).toEqual({});
|
2014-06-30 15:03:35 +00:00
|
|
|
}));
|
|
|
|
|
2014-08-01 06:32:56 +00:00
|
|
|
|
2014-06-30 15:03:35 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
});
|