mirror of
https://github.com/sartography/bpmn-js.git
synced 2025-01-10 00:55:51 +00:00
c58532aeac
This commit puts all import related stuff into the import module. The core module remains as an entry point to require the basic modules needed by bpmn-js. At the time this is { import, draw }.
84 lines
2.0 KiB
JavaScript
84 lines
2.0 KiB
JavaScript
'use strict';
|
|
|
|
/* global bootstrapModeler, inject */
|
|
|
|
var Matchers = require('../../../Matchers'),
|
|
TestHelper = require('../../../TestHelper');
|
|
|
|
var _ = require('lodash');
|
|
|
|
var fs = require('fs');
|
|
|
|
var modelingModule = require('../../../../lib/features/modeling'),
|
|
coreModule = require('../../../../lib/core');
|
|
|
|
|
|
describe('features/modeling - #removeConnection', function() {
|
|
|
|
beforeEach(Matchers.addDeepEquals);
|
|
|
|
|
|
var diagramXML = fs.readFileSync('test/fixtures/bpmn/sequence-flows.bpmn', 'utf-8');
|
|
|
|
var testModules = [ coreModule, modelingModule ];
|
|
|
|
beforeEach(bootstrapModeler(diagramXML, { modules: testModules }));
|
|
|
|
|
|
describe('shape handling', function() {
|
|
|
|
it('should execute', inject(function(elementRegistry, modeling) {
|
|
|
|
// given
|
|
var sequenceFlowShape = elementRegistry.getById('SequenceFlow_2'),
|
|
sequenceFlow = sequenceFlowShape.businessObject;
|
|
|
|
// when
|
|
modeling.removeConnection(sequenceFlowShape);
|
|
|
|
// then
|
|
expect(sequenceFlow.$parent).toBeNull();
|
|
}));
|
|
});
|
|
|
|
|
|
describe('undo support', function() {
|
|
|
|
it('should undo', inject(function(elementRegistry, modeling, commandStack) {
|
|
|
|
// given
|
|
var sequenceFlowShape = elementRegistry.getById('SequenceFlow_2'),
|
|
sequenceFlow = sequenceFlowShape.businessObject,
|
|
parent = sequenceFlow.$parent;
|
|
|
|
// when
|
|
modeling.removeConnection(sequenceFlowShape);
|
|
commandStack.undo();
|
|
|
|
// then
|
|
expect(sequenceFlow.$parent).toBe(parent);
|
|
}));
|
|
});
|
|
|
|
|
|
describe('redo support', function() {
|
|
|
|
it('redo', inject(function(elementRegistry, modeling, commandStack) {
|
|
|
|
// given
|
|
var sequenceFlowShape = elementRegistry.getById('SequenceFlow_2'),
|
|
sequenceFlow = sequenceFlowShape.businessObject,
|
|
parent = sequenceFlow.$parent;
|
|
|
|
// when
|
|
modeling.removeConnection(sequenceFlowShape);
|
|
commandStack.undo();
|
|
commandStack.redo();
|
|
|
|
// then
|
|
expect(sequenceFlow.$parent).toBeNull();
|
|
}));
|
|
});
|
|
|
|
});
|