2018-04-02 19:01:53 +00:00
|
|
|
import {
|
|
|
|
bootstrapModeler,
|
|
|
|
inject
|
|
|
|
} from 'test/TestHelper';
|
|
|
|
|
|
|
|
import {
|
|
|
|
move,
|
|
|
|
attach,
|
|
|
|
connect,
|
|
|
|
expectZOrder
|
|
|
|
} from './Helper';
|
|
|
|
|
|
|
|
import modelingModule from 'lib/features/modeling';
|
|
|
|
import coreModule from 'lib/core';
|
2015-08-19 14:27:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
describe('features/modeling - ordering', function() {
|
|
|
|
|
2017-12-20 09:36:07 +00:00
|
|
|
var testModules = [
|
|
|
|
coreModule,
|
|
|
|
modelingModule
|
|
|
|
];
|
2015-08-19 14:27:07 +00:00
|
|
|
|
2016-01-04 12:22:04 +00:00
|
|
|
|
2015-09-10 15:45:14 +00:00
|
|
|
describe('boundary events', function() {
|
|
|
|
|
2016-01-04 12:22:04 +00:00
|
|
|
describe('move', function() {
|
2015-09-10 15:45:14 +00:00
|
|
|
|
2016-01-04 12:22:04 +00:00
|
|
|
var diagramXML = require('./ordering.bpmn');
|
2015-09-10 15:45:14 +00:00
|
|
|
|
2016-01-04 12:22:04 +00:00
|
|
|
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
2015-09-10 15:45:14 +00:00
|
|
|
|
|
|
|
|
2016-01-04 12:22:04 +00:00
|
|
|
it('should stay in front of Task', inject(function() {
|
2015-09-10 15:45:14 +00:00
|
|
|
|
2016-01-04 12:22:04 +00:00
|
|
|
// when
|
|
|
|
move('Task_With_Boundary');
|
2015-09-10 15:45:14 +00:00
|
|
|
|
2016-01-04 12:22:04 +00:00
|
|
|
// then
|
|
|
|
expectZOrder('Task_With_Boundary', 'BoundaryEvent');
|
|
|
|
}));
|
2015-09-10 15:45:14 +00:00
|
|
|
|
|
|
|
|
2016-01-04 12:22:04 +00:00
|
|
|
it('should stay in front of Task, moving both', inject(function() {
|
|
|
|
|
|
|
|
// when
|
|
|
|
move([ 'BoundaryEvent', 'Task_With_Boundary' ], 'Participant_StartEvent');
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectZOrder('Task_With_Boundary', 'BoundaryEvent');
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
describe('add', function() {
|
|
|
|
|
|
|
|
var diagramXML = require('./ordering-start-event.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
it('should add in front of Task', inject(function() {
|
|
|
|
|
|
|
|
// when
|
|
|
|
var boundaryShape = attach({ type: 'bpmn:BoundaryEvent' }, { x: 300, y: 80 }, 'Task');
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectZOrder('Task', boundaryShape.id);
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
2015-09-10 15:45:14 +00:00
|
|
|
|
|
|
|
});
|
|
|
|
|
2016-01-04 12:22:04 +00:00
|
|
|
|
2015-09-10 15:45:14 +00:00
|
|
|
describe('participants', function() {
|
|
|
|
|
|
|
|
var diagramXML = require('./ordering.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
|
|
|
|
2016-01-04 12:22:04 +00:00
|
|
|
|
2015-09-10 15:45:14 +00:00
|
|
|
it('should stay behind MessageFlow', inject(function() {
|
|
|
|
|
|
|
|
// when
|
|
|
|
move('Participant', 'Collaboration');
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectZOrder('Participant_StartEvent', 'Participant', 'MessageFlow');
|
|
|
|
}));
|
|
|
|
|
2016-05-09 10:38:01 +00:00
|
|
|
|
2019-05-29 06:09:36 +00:00
|
|
|
it('should stay behind Group', inject(function() {
|
|
|
|
|
|
|
|
// when
|
|
|
|
move('Participant', 'Collaboration');
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectZOrder('Participant_StartEvent', 'Participant', 'Group');
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
2016-05-09 10:38:01 +00:00
|
|
|
it('should stay behind DataInputAssociation when moving Participant with DataStore', inject(function() {
|
|
|
|
|
|
|
|
// when
|
|
|
|
move('Participant', { x: 5, y: 5 });
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectZOrder('Participant', 'DataInputAssociation');
|
|
|
|
expectZOrder('Participant_StartEvent', 'DataInputAssociation');
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('should stay behind DataInputAssociation when moving Participant with Task', inject(function() {
|
|
|
|
|
|
|
|
// when
|
|
|
|
move('Participant_StartEvent', { x: 5, y: 5 });
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectZOrder('Participant', 'DataInputAssociation');
|
|
|
|
expectZOrder('Participant_StartEvent', 'DataInputAssociation');
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('should stay behind DataOutputAssociation when moving Participant with DataStore', inject(function() {
|
|
|
|
|
|
|
|
// when
|
|
|
|
move('Participant', { x: 5, y: 5 });
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectZOrder('Participant', 'DataOutputAssociation');
|
|
|
|
expectZOrder('Participant_StartEvent', 'DataOutputAssociation');
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('should stay behind DataOutputAssociation when moving Participant with Task', inject(function() {
|
|
|
|
|
|
|
|
// when
|
|
|
|
move('Participant_StartEvent', { x: 5, y: 5 });
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectZOrder('Participant', 'DataOutputAssociation');
|
|
|
|
expectZOrder('Participant_StartEvent', 'DataOutputAssociation');
|
|
|
|
}));
|
|
|
|
|
2015-09-10 15:45:14 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
describe('sub processes', function() {
|
|
|
|
|
|
|
|
var diagramXML = require('./ordering-subprocesses.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
2015-08-19 14:27:07 +00:00
|
|
|
|
2016-01-04 12:22:04 +00:00
|
|
|
|
2015-09-10 15:45:14 +00:00
|
|
|
it('should stay behind boundary events', inject(function() {
|
2015-08-19 14:27:07 +00:00
|
|
|
|
2015-09-10 15:45:14 +00:00
|
|
|
// when
|
2016-03-16 10:26:41 +00:00
|
|
|
move('BoundaryEvent_SubProcess', { x: 50, y: 0 }, 'SubProcess_1', true);
|
2015-08-19 14:27:07 +00:00
|
|
|
|
2015-09-10 15:45:14 +00:00
|
|
|
// then
|
2016-03-16 10:26:41 +00:00
|
|
|
expectZOrder('SubProcess_1', 'BoundaryEvent_SubProcess');
|
2015-09-10 15:45:14 +00:00
|
|
|
}));
|
2015-08-19 14:27:07 +00:00
|
|
|
|
|
|
|
|
2015-09-10 15:45:14 +00:00
|
|
|
it('should stay behind tasks', inject(function() {
|
2015-08-19 14:27:07 +00:00
|
|
|
|
2015-09-10 15:45:14 +00:00
|
|
|
// when
|
|
|
|
move(['Task_1', 'Task_2'], { x: 50, y: 0 }, 'SubProcess_1');
|
2015-08-19 14:27:07 +00:00
|
|
|
|
2015-09-10 15:45:14 +00:00
|
|
|
// then
|
|
|
|
expectZOrder('SubProcess_1', 'Task_1', 'Task_2');
|
|
|
|
}));
|
2015-08-19 14:27:07 +00:00
|
|
|
|
|
|
|
|
2015-09-10 15:45:14 +00:00
|
|
|
it('should be in front of tasks if task is not a child', inject(function() {
|
2015-08-19 14:27:07 +00:00
|
|
|
|
2015-09-10 15:45:14 +00:00
|
|
|
// when
|
|
|
|
move(['Task_1', 'Task_2'], { x: 200, y: 0 }, 'Root');
|
2015-08-19 14:27:07 +00:00
|
|
|
|
2015-09-10 15:45:14 +00:00
|
|
|
// then
|
|
|
|
expectZOrder('Task_1', 'Task_2', 'SubProcess_1');
|
|
|
|
}));
|
2015-08-19 14:27:07 +00:00
|
|
|
|
2015-09-10 15:45:14 +00:00
|
|
|
});
|
2015-08-19 14:27:07 +00:00
|
|
|
|
2016-03-16 10:26:41 +00:00
|
|
|
|
|
|
|
describe('transaction', function() {
|
|
|
|
|
|
|
|
var diagramXML = require('./ordering-subprocesses.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
it('should stay behind boundary events', inject(function() {
|
|
|
|
|
|
|
|
// when
|
|
|
|
move('BoundaryEvent_Transaction', { x: 50, y: 0 }, 'Transaction_1', true);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectZOrder('Transaction_1', 'BoundaryEvent_Transaction');
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('should stay behind tasks', inject(function() {
|
|
|
|
|
|
|
|
// when
|
|
|
|
move(['Task_1', 'Task_2'], { x: 50, y: 0 }, 'Transaction_1');
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectZOrder('Transaction_1', 'Task_1', 'Task_2');
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('should be in front of tasks if task is not a child', inject(function() {
|
|
|
|
|
|
|
|
// when
|
|
|
|
move(['Task_1', 'Task_2'], { x: 200, y: 0 }, 'Root');
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectZOrder('Task_1', 'Task_2', 'Transaction_1');
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2016-08-16 12:39:37 +00:00
|
|
|
|
|
|
|
describe('labels', function() {
|
|
|
|
|
|
|
|
var diagramXML = require('./ordering.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
2018-12-04 10:48:36 +00:00
|
|
|
describe('should stay always in front', function() {
|
2016-08-16 12:39:37 +00:00
|
|
|
|
2018-12-04 10:48:36 +00:00
|
|
|
it('moving <SequenceFlow_label> onto <Participant>', inject(function() {
|
2016-08-16 12:39:37 +00:00
|
|
|
|
2018-12-04 10:48:36 +00:00
|
|
|
// when
|
|
|
|
move('SequenceFlow_label', { x: 300, y: 0 }, 'Collaboration', false);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectZOrder('Collaboration', 'Participant', 'SequenceFlow_label');
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('moving <StartEvent_label> onto <Participant>', inject(function() {
|
|
|
|
|
|
|
|
// when
|
|
|
|
move('StartEvent_label', { x: 50, y: -330 }, 'Participant', false);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectZOrder(
|
|
|
|
'Participant',
|
|
|
|
'Task_With_Boundary',
|
|
|
|
'BoundaryEvent',
|
|
|
|
'Participant_StartEvent',
|
|
|
|
'StartEvent_label'
|
|
|
|
);
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('move <StartEvent> with label onto <Participant>', inject(function() {
|
|
|
|
|
|
|
|
// when
|
|
|
|
move('StartEvent', { x: 0, y: -330 }, 'Participant', false);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectZOrder(
|
|
|
|
'Participant',
|
|
|
|
'Participant_StartEvent',
|
|
|
|
'StartEvent_label'
|
|
|
|
);
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('move <DataStore> with label onto <Participant_StartEvent>', inject(function() {
|
|
|
|
|
|
|
|
// when
|
|
|
|
move('DataStore', { x: -150, y: 330 }, 'Participant_StartEvent', false);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectZOrder(
|
|
|
|
'Participant',
|
|
|
|
'Participant_StartEvent',
|
|
|
|
'DataStore',
|
|
|
|
'DataStore_label'
|
|
|
|
);
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
2016-08-16 12:39:37 +00:00
|
|
|
|
|
|
|
});
|
|
|
|
|
2017-11-13 10:11:07 +00:00
|
|
|
|
2019-05-07 12:00:12 +00:00
|
|
|
describe('groups', function() {
|
|
|
|
|
|
|
|
var diagramXML = require('./groups.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
describe('should stay always in front', function() {
|
|
|
|
|
|
|
|
it('moving <Group> onto <StartEvent>', inject(function() {
|
|
|
|
|
|
|
|
// when
|
|
|
|
move('Group', { x: 100, y: 0 }, 'StartEvent', false);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectZOrder('StartEvent', 'Group');
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('moving <Group> onto <Task>', inject(function() {
|
|
|
|
|
|
|
|
// when
|
|
|
|
move('Group', { x: 200, y: 50 }, 'Task', false);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectZOrder('Task', 'Group');
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
it('move <Group> onto <SubProcess>', inject(function() {
|
|
|
|
|
|
|
|
// when
|
|
|
|
move('Group', { x: 400, y: 0 }, 'SubProcess', false);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectZOrder('SubProcess', 'Group');
|
|
|
|
}));
|
|
|
|
|
2019-05-29 06:09:36 +00:00
|
|
|
|
|
|
|
it('move <Group> onto <Participant>', inject(function() {
|
|
|
|
|
|
|
|
// when
|
|
|
|
move('Group', { x: 50, y: 0 }, 'Participant', false);
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectZOrder('Participant', 'Group');
|
|
|
|
}));
|
|
|
|
|
2019-05-07 12:00:12 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
2017-11-13 10:11:07 +00:00
|
|
|
describe('connections', function() {
|
|
|
|
|
|
|
|
var diagramXML = require('./ordering.bpmn');
|
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
it('should render sequence flows behind tasks', inject(function() {
|
|
|
|
|
|
|
|
// when
|
|
|
|
var connection = connect('BoundaryEvent', 'Task');
|
|
|
|
|
|
|
|
// then
|
|
|
|
expectZOrder(connection, 'Task', 'BoundaryEvent', connection.label);
|
|
|
|
}));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
2015-09-10 15:45:14 +00:00
|
|
|
});
|