mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-01-10 00:55:51 +00:00
d3449ca87c
* use ES6 import / export * UTILS: export individual utilities * TESTS: localize TestHelper includes BREAKING CHANGE: * all utilities export independent functions * library sources got ported to ES6. You must now use a ES module bundler such as Browserify + babelify or Webpack to consume this library (or parts of it).
74 lines
1.7 KiB
JavaScript
74 lines
1.7 KiB
JavaScript
'use strict';
|
|
|
|
import {
|
|
bootstrapModeler,
|
|
inject
|
|
} from 'test/TestHelper';
|
|
|
|
import modelingModule from 'lib/features/modeling';
|
|
import coreModule from 'lib/core';
|
|
|
|
|
|
describe('features/modeling - resize shape', function() {
|
|
|
|
var diagramXML = require('../../../fixtures/bpmn/simple-resizable.bpmn');
|
|
|
|
var testModules = [ coreModule, modelingModule ];
|
|
|
|
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
|
|
|
|
|
describe('shape', function() {
|
|
|
|
|
|
it('should resize', inject(function(elementRegistry, modeling, bpmnFactory) {
|
|
|
|
// given
|
|
var subProcessElement = elementRegistry.get('SubProcess_1');
|
|
|
|
var sequenceFlowElement = elementRegistry.get('SequenceFlow_2'),
|
|
sequenceFlow = sequenceFlowElement.businessObject;
|
|
|
|
// when
|
|
|
|
// Decreasing width by 100px
|
|
modeling.resizeShape(subProcessElement, { x: 339, y: 142, width: 250, height: 200 });
|
|
|
|
// then
|
|
|
|
// expect flow layout
|
|
var diWaypoints = bpmnFactory.createDiWaypoints([
|
|
{ x: 589, y: 242 },
|
|
{ x: 821, y: 242 }
|
|
]);
|
|
|
|
expect(sequenceFlow.di.waypoint).eql(diWaypoints);
|
|
}));
|
|
|
|
|
|
it('should move', inject(function(elementRegistry, modeling, bpmnFactory) {
|
|
|
|
// given
|
|
var subProcessElement = elementRegistry.get('SubProcess_1');
|
|
|
|
var sequenceFlowElement = elementRegistry.get('SequenceFlow_2'),
|
|
sequenceFlow = sequenceFlowElement.businessObject;
|
|
|
|
// when
|
|
modeling.moveShape(subProcessElement, { x: -50, y: 0 });
|
|
|
|
// then
|
|
|
|
// expect flow layout
|
|
var diWaypoints = bpmnFactory.createDiWaypoints([
|
|
{ x: 639, y: 242 },
|
|
{ x: 821, y: 242 }
|
|
]);
|
|
|
|
expect(sequenceFlow.di.waypoint).eql(diWaypoints);
|
|
}));
|
|
|
|
});
|
|
|
|
});
|