Skip to content

Commit

Permalink
test(space-tool): verify bug
Browse files Browse the repository at this point in the history
Related to #878
  • Loading branch information
nikku committed Dec 5, 2018
1 parent ce964e4 commit 9357032
Showing 1 changed file with 47 additions and 6 deletions.
53 changes: 47 additions & 6 deletions test/spec/features/modeling/SpaceToolSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import {
import modelingModule from 'lib/features/modeling';
import coreModule from 'lib/core';

import {
pick
} from 'min-dash';


describe('features/modeling - create/remove space', function() {

Expand All @@ -18,8 +22,7 @@ describe('features/modeling - create/remove space', function() {

describe('create space', function() {


it('should create space to the right', inject(function(elementRegistry, modeling, bpmnFactory) {
it('to the right', inject(function(elementRegistry, modeling, bpmnFactory) {

// given
var sequenceFlowElement = elementRegistry.get('SequenceFlow_3'),
Expand Down Expand Up @@ -68,7 +71,7 @@ describe('features/modeling - create/remove space', function() {
}));


it('should create space downwards', inject(function(elementRegistry, modeling, bpmnFactory) {
it('downwards', inject(function(elementRegistry, modeling, bpmnFactory) {

// given
var startEventElement = elementRegistry.get('StartEvent_2'),
Expand Down Expand Up @@ -129,7 +132,37 @@ describe('features/modeling - create/remove space', function() {
}));


it('should remove space to the left', inject(function(elementRegistry, modeling, bpmnFactory) {
it('to the left', inject(function(elementRegistry, modeling, bpmnFactory) {

// given
var sequenceFlowElement = elementRegistry.get('SequenceFlow_3');

var position = pick(sequenceFlowElement.label, [ 'x', 'y' ]);

var startEventElement = elementRegistry.get('StartEvent_2');

var delta = { x: -50, y: 0 },
direction = 'w';

// when
modeling.createSpace([
sequenceFlowElement.label,
startEventElement
], [], delta, direction);

// then
expect(sequenceFlowElement.label).to.have.position({
x: position.x + delta.x,
y: position.y + delta.y
});
}));

});


describe('remove space', function() {

it('to the left', inject(function(elementRegistry, modeling, bpmnFactory) {

// given
var sequenceFlowElement = elementRegistry.get('SequenceFlow_3'),
Expand Down Expand Up @@ -176,8 +209,12 @@ describe('features/modeling - create/remove space', function() {
expect(sequenceFlow.di.waypoint).eql(diWaypoints);
}));

});


describe('should resize', function() {

it('should resize to the right', inject(function(elementRegistry, modeling) {
it('to the right', inject(function(elementRegistry, modeling) {

// given
var taskElement = elementRegistry.get('Task_1'),
Expand Down Expand Up @@ -218,7 +255,11 @@ describe('features/modeling - create/remove space', function() {
direction = 'w';

// when
modeling.createSpace([startEventElement, startEventElement2, taskElement], [subProcessElement], delta, direction);
modeling.createSpace([
startEventElement,
startEventElement2,
taskElement
], [subProcessElement], delta, direction);

// then
expect(subProcess.di).to.have.bounds({
Expand Down

0 comments on commit 9357032

Please sign in to comment.