2018-04-02 19:01:53 +00:00
|
|
|
import {
|
|
|
|
bootstrapModeler,
|
|
|
|
inject
|
|
|
|
} from 'test/TestHelper';
|
2015-04-17 14:40:45 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
import modelingModule from 'lib/features/modeling';
|
|
|
|
import coreModule from 'lib/core';
|
2015-04-17 14:40:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
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() {
|
|
|
|
|
|
|
|
|
2015-07-15 15:22:19 +00:00
|
|
|
it('should resize', inject(function(elementRegistry, modeling, bpmnFactory) {
|
2015-04-17 14:40:45 +00:00
|
|
|
|
|
|
|
// 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
|
2015-07-15 15:22:19 +00:00
|
|
|
var diWaypoints = bpmnFactory.createDiWaypoints([
|
|
|
|
{ x: 589, y: 242 },
|
|
|
|
{ x: 821, y: 242 }
|
2015-04-17 14:40:45 +00:00
|
|
|
]);
|
2015-07-15 15:22:19 +00:00
|
|
|
|
|
|
|
expect(sequenceFlow.di.waypoint).eql(diWaypoints);
|
2015-04-17 14:40:45 +00:00
|
|
|
}));
|
|
|
|
|
|
|
|
|
2015-07-15 15:22:19 +00:00
|
|
|
it('should move', inject(function(elementRegistry, modeling, bpmnFactory) {
|
2015-04-17 14:40:45 +00:00
|
|
|
|
|
|
|
// 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
|
2015-07-15 15:22:19 +00:00
|
|
|
var diWaypoints = bpmnFactory.createDiWaypoints([
|
|
|
|
{ x: 639, y: 242 },
|
|
|
|
{ x: 821, y: 242 }
|
2015-04-17 14:40:45 +00:00
|
|
|
]);
|
2015-07-15 15:22:19 +00:00
|
|
|
|
|
|
|
expect(sequenceFlow.di.waypoint).eql(diWaypoints);
|
2015-04-17 14:40:45 +00:00
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|