spiff-arena/test/spec/ScriptsPropsSpec.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

75 lines
2.4 KiB
JavaScript

import { query as domQuery } from 'min-dom';
import {
BpmnPropertiesPanelModule,
BpmnPropertiesProviderModule,
} from 'bpmn-js-properties-panel';
import { getBusinessObject } from 'bpmn-js/lib/util/ModelUtil';
import spiffModdleExtension from '../../app/spiffworkflow/moddle/spiffworkflow.json';
import {
bootstrapPropertiesPanel,
changeInput,
expectSelected,
findEntry,
PROPERTIES_PANEL_CONTAINER,
} from './helpers';
import extensions from '../../app/spiffworkflow/extensions';
describe('Properties Panel Script Tasks', function () {
const xml = require('./bpmn/diagram.bpmn').default;
beforeEach(
bootstrapPropertiesPanel(xml, {
debounceInput: false,
additionalModules: [
extensions,
BpmnPropertiesPanelModule,
BpmnPropertiesProviderModule,
],
moddleExtensions: {
spiffworkflow: spiffModdleExtension,
},
})
);
it('should display a script editing panel when a script task is selected', async function () {
// IF - you select a script task
expectSelected('my_script_task');
// THEN - a properties panel exists with a section for editing that script
const entry = findEntry(
'pythonScript_bpmn:script',
PROPERTIES_PANEL_CONTAINER
);
expect(entry).to.exist;
const scriptInput = domQuery('textarea', entry);
expect(scriptInput).to.exist;
});
it('should update the bpmn:script tag when you modify the script field', async function () {
// IF - a script tag is selected, and you change the script in the properties panel
const scriptTask = await expectSelected('my_script_task');
const entry = findEntry(
'pythonScript_bpmn:script',
PROPERTIES_PANEL_CONTAINER
);
const scriptInput = domQuery('textarea', entry);
changeInput(scriptInput, 'x = 100');
// THEN - the script tag in the BPMN Business object / XML is updated as well.
const businessObject = getBusinessObject(scriptTask);
expect(businessObject.get('script')).to.equal('x = 100');
expect(scriptInput.value).to.equal('x = 100');
});
it('should parse the spiffworkflow:prescript tag when you open an existing file', async function () {
await expectSelected('task_confirm');
const entry = findEntry(
'pythonScript_spiffworkflow:PreScript',
PROPERTIES_PANEL_CONTAINER
);
const scriptInput = domQuery('textarea', entry);
expect(scriptInput.value).to.equal('x=1');
});
});