bpmn-js/test/spec/browser/features/bpmn-modeling/BpmnFactorySpec.js

56 lines
1.4 KiB
JavaScript

'use strict';
var Matchers = require('../../../Matchers'),
TestHelper = require('../../../TestHelper');
/* global bootstrapBpmnJS, inject */
var fs = require('fs');
var bpmnFactoryModule = require('../../../../../lib/features/bpmn-modeling');
xdescribe('features - bpmn-factory', function() {
beforeEach(Matchers.add);
var diagramXML = fs.readFileSync('test/fixtures/bpmn/simple.bpmn', 'utf-8');
var testModules = [ bpmnFactoryModule ];
beforeEach(bootstrapBpmnJS(diagramXML, { modules: testModules }));
describe('create task', function() {
it('should create', inject(function(bpmnFactory) {
var result = bpmnFactory.createNode('bpmn:Task');
expect(result.semantic.id).toBeDefined();
expect(result.di.id).toBeDefined();
expect(result.di.bounds.width).toBe(100);
expect(result.di.bounds.height).toBe(80);
expect(result.di.bounds.x).toBe(-50);
expect(result.di.bounds.y).toBe(-40);
}));
it('should create with position', inject(function(bpmnFactory) {
var result = bpmnFactory.createNode('bpmn:Task', { x: 100, y: 100 });
expect(result.semantic.id).toBeDefined();
expect(result.di.id).toBeDefined();
expect(result.di.bounds.width).toBe(100);
expect(result.di.bounds.height).toBe(80);
expect(result.di.bounds.x).toBe(50);
expect(result.di.bounds.y).toBe(60);
}));
});
});