Merge pull request #43 from sartography/bugfix/update-data-input-output-specs
Bugfix/update data input output specs
This commit is contained in:
commit
c6c955284c
|
@ -30,7 +30,7 @@ export default class IoInterceptor extends CommandInterceptor {
|
|||
let process = context.parent.businessObject;
|
||||
let ioSpec = assureIOSpecificationExists(process, bpmnFactory);
|
||||
let di = context.shape.di;
|
||||
let generator = new IdGenerator(type_name), ioSpecification = process.get('ioSpecification');
|
||||
let generator = new IdGenerator(type_name);
|
||||
let dataIO = bpmnFactory.create(type, { id: generator.next() });
|
||||
context.shape.businessObject = dataIO;
|
||||
dataIO.$parent = ioSpec;
|
||||
|
@ -40,9 +40,11 @@ export default class IoInterceptor extends CommandInterceptor {
|
|||
bpmnUpdater.updateBounds(context.shape);
|
||||
|
||||
if (type == 'bpmn:DataInput') {
|
||||
collectionAdd(ioSpecification.get('dataInputs'), dataIO);
|
||||
collectionAdd(ioSpec.inputSets[0].get('dataInputRefs'), dataIO);
|
||||
collectionAdd(ioSpec.get('dataInputs'), dataIO);
|
||||
} else {
|
||||
collectionAdd(ioSpecification.get('dataOutputs'), dataIO);
|
||||
collectionAdd(ioSpec.outputSets[0].get('dataOutputRefs'), dataIO);
|
||||
collectionAdd(ioSpec.get('dataOutputs'), dataIO);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -54,8 +56,10 @@ export default class IoInterceptor extends CommandInterceptor {
|
|||
let process = context.shape.parent.businessObject;
|
||||
let ioSpec = assureIOSpecificationExists(process, bpmnFactory);
|
||||
if (type == 'bpmn:DataInput') {
|
||||
collectionRemove(ioSpec.inputSets[0].get('dataInputRefs'), context.shape.businessObject);
|
||||
collectionRemove(ioSpec.get('dataInputs'), context.shape.businessObject);
|
||||
} else {
|
||||
collectionRemove(ioSpec.outputSets[0].get('dataOutputRefs'), context.shape.businessObject);
|
||||
collectionRemove(ioSpec.get('dataOutputs'), context.shape.businessObject);
|
||||
}
|
||||
if (context.shape.di.$parent) {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -73,7 +73,7 @@
|
|||
"webpack-cli": "^4.9.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"bpmn-js": "*",
|
||||
"bpmn-js": "^13.0.0",
|
||||
"bpmn-js-properties-panel": "*",
|
||||
"diagram-js": "*"
|
||||
},
|
||||
|
|
|
@ -33,7 +33,8 @@ describe('Input/Output Interceptor', function() {
|
|||
// THEN - the process should now have an IO Specification
|
||||
const iospec = canvas.getRootElement().businessObject.ioSpecification;
|
||||
expect(iospec).to.not.be.null;
|
||||
expect(iospec.dataInputs.length).to.equal(1)
|
||||
expect(iospec.dataInputs.length).to.equal(1);
|
||||
expect(iospec.inputSets[0].dataInputRefs.length).to.equal(1);
|
||||
}));
|
||||
|
||||
|
||||
|
@ -60,4 +61,16 @@ describe('Input/Output Interceptor', function() {
|
|||
modeling.removeShape(dataInput)
|
||||
expect(canvas.getRootElement().businessObject.ioSpecification).to.be.null;
|
||||
}));
|
||||
|
||||
it('deleting a data input should remove it from the input set', inject(function(canvas, modeling) {
|
||||
let rootShape = canvas.getRootElement();
|
||||
const dataInput = modeling.createShape({type: 'bpmn:DataInput'},
|
||||
{x: 220, y: 220}, rootShape);
|
||||
const dataOutput = modeling.createShape({type: 'bpmn:DataOutput'},
|
||||
{x: 240, y: 220}, rootShape);
|
||||
modeling.removeShape(dataInput);
|
||||
const iospec = canvas.getRootElement().businessObject.ioSpecification;
|
||||
expect(iospec.dataInputs.length).to.equal(0);
|
||||
expect(iospec.inputSets[0].dataInputRefs.length).to.equal(0);
|
||||
}));
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue