diff --git a/app/spiffworkflow/InputOutput/IoInterceptor.js b/app/spiffworkflow/InputOutput/IoInterceptor.js
index 05c9ea947..6ec92c24f 100644
--- a/app/spiffworkflow/InputOutput/IoInterceptor.js
+++ b/app/spiffworkflow/InputOutput/IoInterceptor.js
@@ -38,6 +38,7 @@ export default class IoInterceptor extends CommandInterceptor {
di.bpmnElement = dataIO;
di.id = dataIO.id + 'DI';
bpmnUpdater.updateBounds(context.shape);
+
if (type == 'bpmn:DataInput') {
collectionAdd(ioSpecification.get('dataInputs'), dataIO);
} else {
@@ -60,6 +61,9 @@ export default class IoInterceptor extends CommandInterceptor {
if (context.shape.di.$parent) {
collectionRemove(context.shape.di.$parent.planeElement, context.shape.di);
}
+ if (ioSpec.dataInputs.length === 0 && ioSpec.dataOutputs.length === 0) {
+ process.ioSpecification = null;
+ }
}
});
@@ -88,13 +92,15 @@ function assureIOSpecificationExists(process, bpmnFactory) {
let ioSpecification = process.get('ioSpecification');
if (!ioSpecification) {
+ let inputSet = bpmnFactory.create('bpmn:InputSet');
+ let outputSet = bpmnFactory.create('bpmn:OutputSet');
// Create the BPMN
ioSpecification = bpmnFactory.create('bpmn:InputOutputSpecification', {
dataInputs: [],
- inputSets: [],
+ inputSets: [inputSet],
dataOutputs: [],
- outputSets: []
+ outputSets: [outputSet],
});
ioSpecification.$parent = process;
process.ioSpecification = ioSpecification;
@@ -102,5 +108,7 @@ function assureIOSpecificationExists(process, bpmnFactory) {
return ioSpecification;
}
+
+
IoInterceptor.$inject = [ 'eventBus', 'bpmnFactory', 'bpmnUpdater' ];
diff --git a/app/spiffworkflow/messages/propertiesPanel/MessageCorrelationPropertiesArray.js b/app/spiffworkflow/messages/propertiesPanel/MessageCorrelationPropertiesArray.js
index bd62c693d..68a79379e 100644
--- a/app/spiffworkflow/messages/propertiesPanel/MessageCorrelationPropertiesArray.js
+++ b/app/spiffworkflow/messages/propertiesPanel/MessageCorrelationPropertiesArray.js
@@ -82,7 +82,7 @@ export function MessageCorrelationPropertiesArray(props) {
'bpmn:CorrelationPropertyRetrievalExpression'
);
const messageRefElement = getMessageRefElement(element);
- const newFormalExpression = moddle.create('bpmn:FormalExpression');
+ const newFormalExpression = moddle.create('bpmn:messagePath');
newFormalExpression.body = '';
newRetrievalExpressionElement.messageRef = messageRefElement;
diff --git a/test/spec/IOInterceptorSpec.js b/test/spec/IOInterceptorSpec.js
new file mode 100644
index 000000000..3701d7f74
--- /dev/null
+++ b/test/spec/IOInterceptorSpec.js
@@ -0,0 +1,63 @@
+import { bootstrapPropertiesPanel } from './helpers';
+import dataObjectInterceptor from '../../app/spiffworkflow/DataObject';
+import { BpmnPropertiesPanelModule, BpmnPropertiesProviderModule } from 'bpmn-js-properties-panel';
+import {
+ inject,
+} from 'bpmn-js/test/helper';
+import { findDataObjects } from '../../app/spiffworkflow/DataObject/DataObjectHelpers';
+import IoInterceptor from '../../app/spiffworkflow/InputOutput/IoInterceptor';
+import InputOutput from '../../app/spiffworkflow/InputOutput';
+
+describe('Input/Output Interceptor', function() {
+
+ let xml = require('./bpmn/empty_diagram.bpmn').default;
+
+ beforeEach(bootstrapPropertiesPanel(xml, {
+ debounceInput: false,
+ additionalModules: [
+ InputOutput,
+ BpmnPropertiesPanelModule,
+ BpmnPropertiesProviderModule,
+ ]
+ }));
+
+ it('New Data Input should create an IOSpecification with a single dataInput object', inject(function(canvas, modeling) {
+
+ expect(canvas.getRootElement().businessObject.ioSpecification).to.be.undefined;
+
+ // IF - a new dataObjectReference is created
+ let rootShape = canvas.getRootElement();
+ const dataInput = modeling.createShape({ type: 'bpmn:DataInput' },
+ { x: 220, y: 220 }, rootShape);
+
+ // 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)
+ }));
+
+
+ it('IOSpecification always contain input sets and output sets if they exist at all.', inject(function(canvas, modeling) {
+
+ expect(canvas.getRootElement().businessObject.ioSpecification).to.be.undefined;
+
+ // IF - a new dataObjectReference is created
+ let rootShape = canvas.getRootElement();
+ const dataInput = modeling.createShape({type: 'bpmn:DataInput'},
+ {x: 220, y: 220}, rootShape);
+
+ // THEN - there are inputSets and outputSets
+ const iospec = canvas.getRootElement().businessObject.ioSpecification;
+ expect(iospec.inputSets).to.not.be.null;
+ expect(iospec.outputSets).to.not.be.null;
+ }));
+
+ it('After removing all input sets, the ioSpecification should be null.', inject(function(canvas, modeling) {
+ // IF - a new dataObjectReference is created and then deleted.
+ let rootShape = canvas.getRootElement();
+ const dataInput = modeling.createShape({type: 'bpmn:DataInput'},
+ {x: 220, y: 220}, rootShape);
+ modeling.removeShape(dataInput)
+ expect(canvas.getRootElement().businessObject.ioSpecification).to.be.null;
+ }));
+});
diff --git a/test/spec/bpmn/basic_message.bpmn b/test/spec/bpmn/basic_message.bpmn
index 08c6145c1..3f1416437 100644
--- a/test/spec/bpmn/basic_message.bpmn
+++ b/test/spec/bpmn/basic_message.bpmn
@@ -14,10 +14,10 @@
- to
+ to
- from.name
+ from.name
@@ -68,7 +68,7 @@
- new
+ new
diff --git a/test/spec/bpmn/collaboration.bpmn b/test/spec/bpmn/collaboration.bpmn
index fbc941a56..a193fd3ac 100644
--- a/test/spec/bpmn/collaboration.bpmn
+++ b/test/spec/bpmn/collaboration.bpmn
@@ -26,26 +26,26 @@
- lover.instrument
+ lover.instrument
- from.instrument
+ from.instrument
- lover.name
+ lover.name
- from.name
+ from.name
- heartbreaker
+ heartbreaker
- to.name
+ to.name
diff --git a/test/spec/bpmn/simple_collab.bpmn b/test/spec/bpmn/simple_collab.bpmn
index c4fb14635..aae67e99e 100644
--- a/test/spec/bpmn/simple_collab.bpmn
+++ b/test/spec/bpmn/simple_collab.bpmn
@@ -46,46 +46,46 @@
- invoice.invoice_id
+ invoice.invoice_id
- payment.invoice_id
+ payment.invoice_id
- invoice.total
+ invoice.total
- payment.invoice_amount
+ payment.invoice_amount
- invoice.date
+ invoice.date
- payment.invoice_date
+ payment.invoice_date
- payment.date
+ payment.date
- payment.total
+ payment.total
- payment.id
+ payment.id