spiff-arena/test/spec/IOInterceptorSpec.js
burnettk 392c9a1b44 Squashed 'bpmn-js-spiffworkflow/' changes from 9dcca6c80..6007a770a
6007a770a fix typo
aa524120b Merge pull request #47 from sartography/dependabot/github_actions/crazy-max/ghaction-github-labeler-5.0.0
75556c020 Bump crazy-max/ghaction-github-labeler from 4.2.0 to 5.0.0
9a5c333de Merge pull request #46 from sartography/feature/better_form_nav
c6c955284 Merge pull request #43 from sartography/bugfix/update-data-input-output-specs
094c573e0 fixing a test.
5fcb47125 Assume established naming conventions over requiring a form schema and ui schema each time as separate inputs. Making this one dropdown for the user form instead of two.
53f45dbaa Merge pull request #45 from sartography/dependabot/github_actions/actions/checkout-4
67765a994 Bump actions/checkout from 3 to 4
dbcd66942 Merge pull request #44 from sartography/dependabot/github_actions/crazy-max/ghaction-github-labeler-4.2.0
b8be0e335 Bump crazy-max/ghaction-github-labeler from 4.1.0 to 4.2.0
7743372d2 update iospec to include refs in input/output sets
6e17bda37 use same version of bpmn-js as arena
2c7fca88f missed a type in spiffworkflow.json
d62f021e3 Merge pull request #42 from sartography/bugfix/lowercase-overridden-tags
c625980c5 update extension names
e92ae2f5a make sure tags with extensions are written to xml correctly
eb37b6d29 Merge pull request #41 from sartography/feature/guest_form_submission
1b390c46c added panel extensions for guest access to human tasks w/ burnettk
f01bece04 Merge pull request #40 from sartography/feature/multiinstance-improvements
b8179146b allow attaching pre/post scripts to MI task or instance tasks

git-subtree-dir: bpmn-js-spiffworkflow
git-subtree-split: 6007a770a5938c993173001a013116cedfc80359
2023-10-14 12:30:16 -04:00

77 lines
3.1 KiB
JavaScript

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);
expect(iospec.inputSets[0].dataInputRefs.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;
}));
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);
}));
});