feat(modeling): model gateways in processes
- Gateways can added via context pad - BpmnModelingSpec.js split up into several files See #88
This commit is contained in:
parent
113126ca9f
commit
e1ed479314
|
@ -63,14 +63,12 @@ ContextPadProvider.prototype.getContextPadEntries = function(element) {
|
||||||
append(element, 'bpmn:EndEvent');
|
append(element, 'bpmn:EndEvent');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
/*
|
|
||||||
'action.model-gateway': {
|
'action.model-gateway': {
|
||||||
imageUrl: 'data:image/png;base64,' + images.GATEWAY,
|
imageUrl: 'data:image/png;base64,' + images.GATEWAY,
|
||||||
action: function(e) {
|
action: function(e) {
|
||||||
append(element, 'bpmn:Gateway');
|
append(element, 'bpmn:Gateway');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
*/
|
|
||||||
'action.model-task': {
|
'action.model-task': {
|
||||||
imageUrl: 'data:image/png;base64,' + images.TASK,
|
imageUrl: 'data:image/png;base64,' + images.TASK,
|
||||||
action: function(e) {
|
action: function(e) {
|
||||||
|
|
|
@ -44,6 +44,19 @@ describe('features - bpmn-modeling', function() {
|
||||||
expect(target.$instanceOf('bpmn:Task')).toBe(true);
|
expect(target.$instanceOf('bpmn:Task')).toBe(true);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should execute', inject(function(elementRegistry, bpmnModeling) {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var startEventShape = elementRegistry.getById('StartEvent_1');
|
||||||
|
|
||||||
|
// when
|
||||||
|
var targetShape = bpmnModeling.appendFlowNode(startEventShape, null, 'bpmn:ExclusiveGateway'),
|
||||||
|
target = targetShape.businessObject;
|
||||||
|
|
||||||
|
// then
|
||||||
|
expect(targetShape).toBeDefined();
|
||||||
|
expect(target.$instanceOf('bpmn:ExclusiveGateway')).toBe(true);
|
||||||
|
}));
|
||||||
|
|
||||||
it('should create DI', inject(function(elementRegistry, bpmnModeling) {
|
it('should create DI', inject(function(elementRegistry, bpmnModeling) {
|
||||||
|
|
||||||
|
@ -81,6 +94,23 @@ describe('features - bpmn-modeling', function() {
|
||||||
expect(subProcess.get('flowElements')).toContain(target);
|
expect(subProcess.get('flowElements')).toContain(target);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should add to parent (sub process)', inject(function(elementRegistry, bpmnModeling) {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var startEventShape = elementRegistry.getById('StartEvent_1');
|
||||||
|
var subProcessShape = elementRegistry.getById('SubProcess_1');
|
||||||
|
|
||||||
|
var startEvent = startEventShape.businessObject,
|
||||||
|
subProcess = subProcessShape.businessObject;
|
||||||
|
|
||||||
|
// when
|
||||||
|
var targetShape = bpmnModeling.appendFlowNode(startEventShape, null, 'bpmn:ExclusiveGateway'),
|
||||||
|
target = targetShape.businessObject;
|
||||||
|
|
||||||
|
// then
|
||||||
|
expect(subProcess.get('flowElements')).toContain(target);
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
it('should add connection', inject(function(elementRegistry, bpmnModeling) {
|
it('should add connection', inject(function(elementRegistry, bpmnModeling) {
|
||||||
|
|
||||||
|
@ -218,6 +248,26 @@ describe('features - bpmn-modeling', function() {
|
||||||
expect(elementRegistry.getById(connection.id + '_label')).not.toBeDefined();
|
expect(elementRegistry.getById(connection.id + '_label')).not.toBeDefined();
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('should undo add to parent', inject(function(elementRegistry, bpmnModeling, commandStack) {
|
||||||
|
|
||||||
|
// given
|
||||||
|
var startEventShape = elementRegistry.getById('StartEvent_1');
|
||||||
|
var subProcessShape = elementRegistry.getById('SubProcess_1');
|
||||||
|
|
||||||
|
var startEvent = startEventShape.businessObject,
|
||||||
|
subProcess = subProcessShape.businessObject;
|
||||||
|
|
||||||
|
var targetShape = bpmnModeling.appendFlowNode(startEventShape, null, 'bpmn:ExclusiveGateway'),
|
||||||
|
target = targetShape.businessObject;
|
||||||
|
|
||||||
|
// when
|
||||||
|
commandStack.undo();
|
||||||
|
|
||||||
|
// then
|
||||||
|
expect(subProcess.get('flowElements')).not.toContain(target);
|
||||||
|
expect(subProcess.di.$parent.get('planeElement')).not.toContain(target.di);
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
it('should undo/redo appending multiple shapes', inject(function(elementRegistry, bpmnModeling, commandStack) {
|
it('should undo/redo appending multiple shapes', inject(function(elementRegistry, bpmnModeling, commandStack) {
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue