2018-04-02 19:01:53 +00:00
|
|
|
import {
|
|
|
|
bootstrapModeler,
|
|
|
|
inject
|
|
|
|
} from 'test/TestHelper';
|
2016-06-07 06:46:45 +00:00
|
|
|
|
2018-04-02 19:01:53 +00:00
|
|
|
import modelingModule from 'lib/features/modeling';
|
|
|
|
import coreModule from 'lib/core';
|
2014-08-22 13:20:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
describe('features/modeling - #removeConnection', function() {
|
|
|
|
|
2015-03-31 12:17:15 +00:00
|
|
|
var diagramXML = require('../../../fixtures/bpmn/sequence-flows.bpmn');
|
2014-08-22 13:20:48 +00:00
|
|
|
|
2014-10-30 11:06:43 +00:00
|
|
|
var testModules = [ coreModule, modelingModule ];
|
2014-08-22 13:20:48 +00:00
|
|
|
|
|
|
|
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
|
|
|
|
|
|
|
|
|
|
|
describe('shape handling', function() {
|
|
|
|
|
|
|
|
it('should execute', inject(function(elementRegistry, modeling) {
|
|
|
|
|
|
|
|
// given
|
2014-11-17 16:36:22 +00:00
|
|
|
var sequenceFlowShape = elementRegistry.get('SequenceFlow_2'),
|
2014-08-22 13:20:48 +00:00
|
|
|
sequenceFlow = sequenceFlowShape.businessObject;
|
|
|
|
|
|
|
|
// when
|
|
|
|
modeling.removeConnection(sequenceFlowShape);
|
|
|
|
|
|
|
|
// then
|
2015-07-15 15:22:19 +00:00
|
|
|
expect(sequenceFlow.$parent).to.be.null;
|
2014-08-22 13:20:48 +00:00
|
|
|
}));
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
describe('undo support', function() {
|
|
|
|
|
|
|
|
it('should undo', inject(function(elementRegistry, modeling, commandStack) {
|
|
|
|
|
|
|
|
// given
|
2014-11-17 16:36:22 +00:00
|
|
|
var sequenceFlowShape = elementRegistry.get('SequenceFlow_2'),
|
2014-08-22 13:20:48 +00:00
|
|
|
sequenceFlow = sequenceFlowShape.businessObject,
|
|
|
|
parent = sequenceFlow.$parent;
|
|
|
|
|
|
|
|
// when
|
|
|
|
modeling.removeConnection(sequenceFlowShape);
|
|
|
|
commandStack.undo();
|
|
|
|
|
|
|
|
// then
|
2015-07-15 15:22:19 +00:00
|
|
|
expect(sequenceFlow.$parent).to.eql(parent);
|
2014-08-22 13:20:48 +00:00
|
|
|
}));
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
describe('redo support', function() {
|
|
|
|
|
|
|
|
it('redo', inject(function(elementRegistry, modeling, commandStack) {
|
|
|
|
|
|
|
|
// given
|
2014-11-17 16:36:22 +00:00
|
|
|
var sequenceFlowShape = elementRegistry.get('SequenceFlow_2'),
|
2015-03-31 12:17:15 +00:00
|
|
|
sequenceFlow = sequenceFlowShape.businessObject;
|
2014-08-22 13:20:48 +00:00
|
|
|
|
|
|
|
// when
|
|
|
|
modeling.removeConnection(sequenceFlowShape);
|
|
|
|
commandStack.undo();
|
|
|
|
commandStack.redo();
|
|
|
|
|
|
|
|
// then
|
2015-07-15 15:22:19 +00:00
|
|
|
expect(sequenceFlow.$parent).to.be.null;
|
2014-08-22 13:20:48 +00:00
|
|
|
}));
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|