More test refactoring - lots of crazy hell going on in helpers.js -- but the actual tests are now very clean and simple, and should be easy to extend and replicate as this thing grows.

This commit is contained in:
Dan 2022-06-30 14:02:38 -04:00
parent c2390509bf
commit 84be279476
14 changed files with 795 additions and 234 deletions

View File

@ -9,7 +9,6 @@ import FileSaver from 'file-saver'; // For file downloads.
// https://github.com/camunda/camunda-bpmn-moddle/blob/master/resources/camunda.json
const modelerEl = document.getElementById('modeler');
const panelEl = document.getElementById('panel');
const spiffModdleExtension = require('./spiffworkflow/moddle/spiffworkflow.json');
// create modeler

View File

@ -1,5 +1,6 @@
import scriptProps, { SCRIPT_TYPE } from './parts/ScriptProps';
import { is, isAny } from 'bpmn-js/lib/util/ModelUtil';
import dataObjectProps from './parts/DataObjectProps';
const LOW_PRIORITY = 500;
@ -11,6 +12,10 @@ export default function SpiffWorkflowPropertiesProvider(propertiesPanel, transla
} else if (isAny(element, [ 'bpmn:Task', 'bpmn:CallActivity', 'bpmn:SubProcess' ])) {
groups.push(preScriptPostScriptGroup(element, translate, moddle));
}
if (is(element, 'bpmn:DataObjectReference')) {
groups.push(createDataObjectGroup(element, translate, moddle));
}
return groups;
};
};
@ -60,3 +65,11 @@ function preScriptPostScriptGroup(element, translate, moddle) {
]
};
}
function createDataObjectGroup(element, translate, moddle) {
return {
id: 'data_object_properties',
label: translate('Data Object Properties'),
entries: dataObjectProps(element, moddle)
};
}

View File

@ -0,0 +1,75 @@
import {HeaderButton, TextAreaEntry, TextFieldEntry, isTextFieldEntryEdited} from '@bpmn-io/properties-panel';
import {useService} from 'bpmn-js-properties-panel';
/**
* Allows for the creation and deletion of Data Objects
* and connecting those data objects to Data References.
* @param dataElement The selected Data Object Reference
* @param moddle For updating the underlying xml object
* @returns {[{component: (function(*)), isEdited: *, id: string, element},{component: (function(*)), isEdited: *, id: string, element}]}
*/
export default function (dataElement, moddle) {
return [
{
id: 'dataObjects',
dataElement,
component: DataObjectSelector,
isEdited: isTextFieldEntryEdited,
moddle: moddle,
},
];
}
/**
* Finds the value of the given type within the extensionElements
* given a type of "spiff:preScript", would find it in this, and retnr
* the object.
*
* <bpmn:
<bpmn:userTask id="123" name="My User Task!">
<bpmn:extensionElements>
<spiff:preScript>
me = "100% awesome"
</spiff:preScript>
</bpmn:extensionElements>
...
</bpmn:userTask>
*
* @returns {string|null|*}
*/
function DataObjectSelector(props) {
const moddle = props.moddle;
const id = props.id;
const element = props.element;
const debounce = useService('debounceInput');
/**
* Returns a list of all the data business objects.
* @returns {string|null|*}
*/
const findDataObjects = () => {
// Find the parent process of this business object.
const businessObject = element.businessObject;
const parent = businessObject.parent
};
const getValue = () => {
return ""
}
const setValue = value => {
return ""
}
return <TextAreaEntry
id={id}
element={element}
description={"My Text Area"}
label={"Help me!"}
getValue={ getValue }
setValue={ setValue }
debounce={debounce}
/>;
}

View File

@ -18,7 +18,7 @@ export default function(element, moddle, scriptType, label, description) {
return [
{
id: 'pythonScript' + scriptType,
id: 'pythonScript_' + scriptType,
element,
targetTag: scriptType,
component: PythonScript,

View File

@ -30,7 +30,7 @@ module.exports = function(karma) {
'test/spec/**/*Spec.js': [ 'webpack', 'env' ]
},
browsers: [ 'ChromeHeadless' ],
browsers: [ 'Chrome' ],
browserNoActivityTimeout: 30000,

328
package-lock.json generated
View File

@ -21,6 +21,8 @@
"@babel/plugin-transform-react-jsx": "^7.17.12",
"@babel/preset-env": "^7.18.6",
"@babel/preset-react": "^7.18.2",
"@testing-library/preact": "^2.0.1",
"@testing-library/preact-hooks": "^1.1.0",
"@types/mocha": "^9.1.1",
"babel-loader": "^8.2.5",
"chai": "^4.3.6",
@ -1810,6 +1812,19 @@
"node": ">=6.9.0"
}
},
"node_modules/@babel/runtime-corejs3": {
"version": "7.18.6",
"resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.18.6.tgz",
"integrity": "sha512-cOu5wH2JFBgMjje+a+fz2JNIWU4GzYpl05oSob3UDvBEh6EuIn+TXFHMmBbhSb+k/4HMzgKCQfEEDArAWNF9Cw==",
"dev": true,
"dependencies": {
"core-js-pure": "^3.20.2",
"regenerator-runtime": "^0.13.4"
},
"engines": {
"node": ">=6.9.0"
}
},
"node_modules/@babel/template": {
"version": "7.18.6",
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.18.6.tgz",
@ -1975,6 +1990,22 @@
"node": ">=8"
}
},
"node_modules/@jest/types": {
"version": "26.6.2",
"resolved": "https://registry.npmjs.org/@jest/types/-/types-26.6.2.tgz",
"integrity": "sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ==",
"dev": true,
"dependencies": {
"@types/istanbul-lib-coverage": "^2.0.0",
"@types/istanbul-reports": "^3.0.0",
"@types/node": "*",
"@types/yargs": "^15.0.0",
"chalk": "^4.0.0"
},
"engines": {
"node": ">= 10.14.2"
}
},
"node_modules/@jridgewell/gen-mapping": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.1.tgz",
@ -2118,6 +2149,56 @@
"integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==",
"dev": true
},
"node_modules/@testing-library/dom": {
"version": "7.31.2",
"resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-7.31.2.tgz",
"integrity": "sha512-3UqjCpey6HiTZT92vODYLPxTBWlM8ZOOjr3LX5F37/VRipW2M1kX6I/Cm4VXzteZqfGfagg8yXywpcOgQBlNsQ==",
"dev": true,
"dependencies": {
"@babel/code-frame": "^7.10.4",
"@babel/runtime": "^7.12.5",
"@types/aria-query": "^4.2.0",
"aria-query": "^4.2.2",
"chalk": "^4.1.0",
"dom-accessibility-api": "^0.5.6",
"lz-string": "^1.4.4",
"pretty-format": "^26.6.2"
},
"engines": {
"node": ">=10"
}
},
"node_modules/@testing-library/preact": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@testing-library/preact/-/preact-2.0.1.tgz",
"integrity": "sha512-79kwVOY+3caoLgaPbiPzikjgY0Aya7Fc7TvGtR1upCnz2wrtmPDnN2t9vO7I7vDP2zoA+feSwOH5Q0BFErhaaQ==",
"dev": true,
"dependencies": {
"@testing-library/dom": "^7.16.2"
},
"engines": {
"node": ">= 10"
},
"peerDependencies": {
"preact": ">=10 || ^10.0.0-alpha.0 || ^10.0.0-beta.0"
}
},
"node_modules/@testing-library/preact-hooks": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@testing-library/preact-hooks/-/preact-hooks-1.1.0.tgz",
"integrity": "sha512-+JIor+NsOHkK3oIrwMDGKGHXTN0JJi462dBJlj4FNbGaDPTlctE6eu2ranWQirh7/FJMkWfzQCP+tk7jmY8ZrQ==",
"dev": true,
"peerDependencies": {
"@testing-library/preact": "^2.0.0",
"preact": "^10.4.8"
}
},
"node_modules/@types/aria-query": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-4.2.2.tgz",
"integrity": "sha512-HnYpAE1Y6kRyKM/XkEuiRQhTHvkzMBurTHnpFLYLBGPIylZNPs9jJcuOOYWxPLJCSEtmZT0Y8rHDokKN7rRTig==",
"dev": true
},
"node_modules/@types/component-emitter": {
"version": "1.2.11",
"resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.11.tgz",
@ -2162,6 +2243,30 @@
"integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==",
"dev": true
},
"node_modules/@types/istanbul-lib-coverage": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz",
"integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==",
"dev": true
},
"node_modules/@types/istanbul-lib-report": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz",
"integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==",
"dev": true,
"dependencies": {
"@types/istanbul-lib-coverage": "*"
}
},
"node_modules/@types/istanbul-reports": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz",
"integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==",
"dev": true,
"dependencies": {
"@types/istanbul-lib-report": "*"
}
},
"node_modules/@types/json-schema": {
"version": "7.0.11",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz",
@ -2180,6 +2285,21 @@
"integrity": "sha512-UXdBxNGqTMtm7hCwh9HtncFVLrXoqA3oJW30j6XWp5BH/wu3mVeaxo7cq5benFdBw34HB3XDT2TRPI7rXZ+mDg==",
"dev": true
},
"node_modules/@types/yargs": {
"version": "15.0.14",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.14.tgz",
"integrity": "sha512-yEJzHoxf6SyQGhBhIYGXQDSCkJjB6HohDShto7m8vaKg9Yp0Yn8+71J9eakh2bnPg6BfsH9PRMhiRTZnd4eXGQ==",
"dev": true,
"dependencies": {
"@types/yargs-parser": "*"
}
},
"node_modules/@types/yargs-parser": {
"version": "21.0.0",
"resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz",
"integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==",
"dev": true
},
"node_modules/@ungap/promise-all-settled": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz",
@ -2521,6 +2641,19 @@
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"dev": true
},
"node_modules/aria-query": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/aria-query/-/aria-query-4.2.2.tgz",
"integrity": "sha512-o/HelwhuKpTj/frsOsbNLNgnNGVIFsVP/SW2BSF14gVl7kAfMOJ6/8wUAUvG1R1NHKrfG+2sHZTu0yauT1qBrA==",
"dev": true,
"dependencies": {
"@babel/runtime": "^7.10.2",
"@babel/runtime-corejs3": "^7.10.2"
},
"engines": {
"node": ">=6.0"
}
},
"node_modules/array-includes": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.5.tgz",
@ -3254,6 +3387,17 @@
"semver": "bin/semver.js"
}
},
"node_modules/core-js-pure": {
"version": "3.23.3",
"resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.23.3.tgz",
"integrity": "sha512-XpoouuqIj4P+GWtdyV8ZO3/u4KftkeDVMfvp+308eGMhCrA3lVDSmAxO0c6GGOcmgVlaKDrgWVMo49h2ab/TDA==",
"dev": true,
"hasInstallScript": true,
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/core-js"
}
},
"node_modules/cors": {
"version": "2.8.5",
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
@ -3455,6 +3599,12 @@
"node": ">=6.0.0"
}
},
"node_modules/dom-accessibility-api": {
"version": "0.5.14",
"resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.14.tgz",
"integrity": "sha512-NMt+m9zFMPZe0JcY9gN224Qvk6qLIdqex29clBvc/y75ZBX9YA9wNK3frsYvu2DI1xcCIwxwnX+TlsJ2DSOADg==",
"dev": true
},
"node_modules/dom-serialize": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/dom-serialize/-/dom-serialize-2.2.1.tgz",
@ -5560,6 +5710,15 @@
"integrity": "sha512-2Fgx1Ycm599x+WGpIYwJOvsjmXFzTSc34IwDWALRA/8AopUKAVPwfJ+h5+f85BCp0PWmmJcWzEpxOpoXycMpdA==",
"dev": true
},
"node_modules/lz-string": {
"version": "1.4.4",
"resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.4.4.tgz",
"integrity": "sha512-0ckx7ZHRPqb0oUm8zNr+90mtf9DQB60H1wMCjBtfi62Kl3a7JbHob6gA2bC+xRvZoOL+1hzUK8jeuEIQE8svEQ==",
"dev": true,
"bin": {
"lz-string": "bin/bin.js"
}
},
"node_modules/make-dir": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
@ -6633,6 +6792,27 @@
"node": ">= 0.8.0"
}
},
"node_modules/pretty-format": {
"version": "26.6.2",
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz",
"integrity": "sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg==",
"dev": true,
"dependencies": {
"@jest/types": "^26.6.2",
"ansi-regex": "^5.0.0",
"ansi-styles": "^4.0.0",
"react-is": "^17.0.1"
},
"engines": {
"node": ">= 10"
}
},
"node_modules/pretty-format/node_modules/react-is": {
"version": "17.0.2",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
"dev": true
},
"node_modules/prop-types": {
"version": "15.8.1",
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",
@ -9582,6 +9762,16 @@
"regenerator-runtime": "^0.13.4"
}
},
"@babel/runtime-corejs3": {
"version": "7.18.6",
"resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.18.6.tgz",
"integrity": "sha512-cOu5wH2JFBgMjje+a+fz2JNIWU4GzYpl05oSob3UDvBEh6EuIn+TXFHMmBbhSb+k/4HMzgKCQfEEDArAWNF9Cw==",
"dev": true,
"requires": {
"core-js-pure": "^3.20.2",
"regenerator-runtime": "^0.13.4"
}
},
"@babel/template": {
"version": "7.18.6",
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.18.6.tgz",
@ -9722,6 +9912,19 @@
"integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==",
"dev": true
},
"@jest/types": {
"version": "26.6.2",
"resolved": "https://registry.npmjs.org/@jest/types/-/types-26.6.2.tgz",
"integrity": "sha512-fC6QCp7Sc5sX6g8Tvbmj4XUTbyrik0akgRy03yjXbQaBWWNWGE7SGtJk98m0N8nzegD/7SggrUlivxo5ax4KWQ==",
"dev": true,
"requires": {
"@types/istanbul-lib-coverage": "^2.0.0",
"@types/istanbul-reports": "^3.0.0",
"@types/node": "*",
"@types/yargs": "^15.0.0",
"chalk": "^4.0.0"
}
},
"@jridgewell/gen-mapping": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.1.tgz",
@ -9846,6 +10049,44 @@
"integrity": "sha512-+iTbntw2IZPb/anVDbypzfQa+ay64MW0Zo8aJ8gZPWMMK6/OubMVb6lUPMagqjOPnmtauXnFCACVl3O7ogjeqQ==",
"dev": true
},
"@testing-library/dom": {
"version": "7.31.2",
"resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-7.31.2.tgz",
"integrity": "sha512-3UqjCpey6HiTZT92vODYLPxTBWlM8ZOOjr3LX5F37/VRipW2M1kX6I/Cm4VXzteZqfGfagg8yXywpcOgQBlNsQ==",
"dev": true,
"requires": {
"@babel/code-frame": "^7.10.4",
"@babel/runtime": "^7.12.5",
"@types/aria-query": "^4.2.0",
"aria-query": "^4.2.2",
"chalk": "^4.1.0",
"dom-accessibility-api": "^0.5.6",
"lz-string": "^1.4.4",
"pretty-format": "^26.6.2"
}
},
"@testing-library/preact": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@testing-library/preact/-/preact-2.0.1.tgz",
"integrity": "sha512-79kwVOY+3caoLgaPbiPzikjgY0Aya7Fc7TvGtR1upCnz2wrtmPDnN2t9vO7I7vDP2zoA+feSwOH5Q0BFErhaaQ==",
"dev": true,
"requires": {
"@testing-library/dom": "^7.16.2"
}
},
"@testing-library/preact-hooks": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@testing-library/preact-hooks/-/preact-hooks-1.1.0.tgz",
"integrity": "sha512-+JIor+NsOHkK3oIrwMDGKGHXTN0JJi462dBJlj4FNbGaDPTlctE6eu2ranWQirh7/FJMkWfzQCP+tk7jmY8ZrQ==",
"dev": true,
"requires": {}
},
"@types/aria-query": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-4.2.2.tgz",
"integrity": "sha512-HnYpAE1Y6kRyKM/XkEuiRQhTHvkzMBurTHnpFLYLBGPIylZNPs9jJcuOOYWxPLJCSEtmZT0Y8rHDokKN7rRTig==",
"dev": true
},
"@types/component-emitter": {
"version": "1.2.11",
"resolved": "https://registry.npmjs.org/@types/component-emitter/-/component-emitter-1.2.11.tgz",
@ -9890,6 +10131,30 @@
"integrity": "sha512-CuPgU6f3eT/XgKKPqKd/gLZV1Xmvf1a2R5POBOGQa6uv82xpls89HU5zKeVoyR8XzHd1RGNOlQlvUe3CFkjWNQ==",
"dev": true
},
"@types/istanbul-lib-coverage": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.4.tgz",
"integrity": "sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==",
"dev": true
},
"@types/istanbul-lib-report": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz",
"integrity": "sha512-plGgXAPfVKFoYfa9NpYDAkseG+g6Jr294RqeqcqDixSbU34MZVJRi/P+7Y8GDpzkEwLaGZZOpKIEmeVZNtKsrg==",
"dev": true,
"requires": {
"@types/istanbul-lib-coverage": "*"
}
},
"@types/istanbul-reports": {
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.1.tgz",
"integrity": "sha512-c3mAZEuK0lvBp8tmuL74XRKn1+y2dcwOUpH7x4WrF6gk1GIgiluDRgMYQtw2OFcBvAJWlt6ASU3tSqxp0Uu0Aw==",
"dev": true,
"requires": {
"@types/istanbul-lib-report": "*"
}
},
"@types/json-schema": {
"version": "7.0.11",
"resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz",
@ -9908,6 +10173,21 @@
"integrity": "sha512-UXdBxNGqTMtm7hCwh9HtncFVLrXoqA3oJW30j6XWp5BH/wu3mVeaxo7cq5benFdBw34HB3XDT2TRPI7rXZ+mDg==",
"dev": true
},
"@types/yargs": {
"version": "15.0.14",
"resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.14.tgz",
"integrity": "sha512-yEJzHoxf6SyQGhBhIYGXQDSCkJjB6HohDShto7m8vaKg9Yp0Yn8+71J9eakh2bnPg6BfsH9PRMhiRTZnd4eXGQ==",
"dev": true,
"requires": {
"@types/yargs-parser": "*"
}
},
"@types/yargs-parser": {
"version": "21.0.0",
"resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.0.tgz",
"integrity": "sha512-iO9ZQHkZxHn4mSakYV0vFHAVDyEOIJQrV2uZ06HxEPcx+mt8swXoZHIbaaJ2crJYFfErySgktuTZ3BeLz+XmFA==",
"dev": true
},
"@ungap/promise-all-settled": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz",
@ -10197,6 +10477,16 @@
"integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==",
"dev": true
},
"aria-query": {
"version": "4.2.2",
"resolved": "https://registry.npmjs.org/aria-query/-/aria-query-4.2.2.tgz",
"integrity": "sha512-o/HelwhuKpTj/frsOsbNLNgnNGVIFsVP/SW2BSF14gVl7kAfMOJ6/8wUAUvG1R1NHKrfG+2sHZTu0yauT1qBrA==",
"dev": true,
"requires": {
"@babel/runtime": "^7.10.2",
"@babel/runtime-corejs3": "^7.10.2"
}
},
"array-includes": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.5.tgz",
@ -10756,6 +11046,12 @@
}
}
},
"core-js-pure": {
"version": "3.23.3",
"resolved": "https://registry.npmjs.org/core-js-pure/-/core-js-pure-3.23.3.tgz",
"integrity": "sha512-XpoouuqIj4P+GWtdyV8ZO3/u4KftkeDVMfvp+308eGMhCrA3lVDSmAxO0c6GGOcmgVlaKDrgWVMo49h2ab/TDA==",
"dev": true
},
"cors": {
"version": "2.8.5",
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.5.tgz",
@ -10906,6 +11202,12 @@
"esutils": "^2.0.2"
}
},
"dom-accessibility-api": {
"version": "0.5.14",
"resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.14.tgz",
"integrity": "sha512-NMt+m9zFMPZe0JcY9gN224Qvk6qLIdqex29clBvc/y75ZBX9YA9wNK3frsYvu2DI1xcCIwxwnX+TlsJ2DSOADg==",
"dev": true
},
"dom-serialize": {
"version": "2.2.1",
"resolved": "https://registry.npmjs.org/dom-serialize/-/dom-serialize-2.2.1.tgz",
@ -12506,6 +12808,12 @@
"integrity": "sha512-2Fgx1Ycm599x+WGpIYwJOvsjmXFzTSc34IwDWALRA/8AopUKAVPwfJ+h5+f85BCp0PWmmJcWzEpxOpoXycMpdA==",
"dev": true
},
"lz-string": {
"version": "1.4.4",
"resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.4.4.tgz",
"integrity": "sha512-0ckx7ZHRPqb0oUm8zNr+90mtf9DQB60H1wMCjBtfi62Kl3a7JbHob6gA2bC+xRvZoOL+1hzUK8jeuEIQE8svEQ==",
"dev": true
},
"make-dir": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
@ -13317,6 +13625,26 @@
"integrity": "sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==",
"dev": true
},
"pretty-format": {
"version": "26.6.2",
"resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-26.6.2.tgz",
"integrity": "sha512-7AeGuCYNGmycyQbCqd/3PWH4eOoX/OiCa0uphp57NVTeAGdJGaAliecxwBDHYQCIvrW7aDBZCYeNTP/WX69mkg==",
"dev": true,
"requires": {
"@jest/types": "^26.6.2",
"ansi-regex": "^5.0.0",
"ansi-styles": "^4.0.0",
"react-is": "^17.0.1"
},
"dependencies": {
"react-is": {
"version": "17.0.2",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz",
"integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==",
"dev": true
}
}
},
"prop-types": {
"version": "15.8.1",
"resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz",

View File

@ -36,6 +36,8 @@
"@babel/plugin-transform-react-jsx": "^7.17.12",
"@babel/preset-env": "^7.18.6",
"@babel/preset-react": "^7.18.2",
"@testing-library/preact": "^2.0.1",
"@testing-library/preact-hooks": "^1.1.0",
"@types/mocha": "^9.1.1",
"babel-loader": "^8.2.5",
"chai": "^4.3.6",

View File

@ -1,98 +1,100 @@
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="sid-38422fae-e03e-43a3-bef4-bd33b32041b2" targetNamespace="http://bpmn.io/bpmn" exporter="bpmn-js (https://demo.bpmn.io)" exporterVersion="9.0.3">
<process id="Process_1" isExecutable="false">
<startEvent id="StartEvent_1y45yut" name="hunger noticed">
<outgoing>SequenceFlow_0h21x7r</outgoing>
</startEvent>
<sequenceFlow id="SequenceFlow_0h21x7r" sourceRef="StartEvent_1y45yut" targetRef="Task_1hcentk" />
<exclusiveGateway id="ExclusiveGateway_15hu1pt" name="desired dish?">
<incoming>Flow_1wwrhtz</incoming>
</exclusiveGateway>
<sequenceFlow id="SequenceFlow_0wnb4ke" sourceRef="Task_1hcentk" targetRef="Activity_0o1of4m" />
<userTask id="Task_1hcentk" name="choose recipe">
<incoming>SequenceFlow_0h21x7r</incoming>
<outgoing>SequenceFlow_0wnb4ke</outgoing>
<dataOutputAssociation id="DataOutputAssociation_0d029ch">
<targetRef>DataObjectReference_1ai5gtd</targetRef>
</dataOutputAssociation>
<dataOutputAssociation id="DataOutputAssociation_01dy1pz">
<targetRef>DataObjectReference_0a2cgep</targetRef>
</dataOutputAssociation>
</userTask>
<dataStoreReference id="DataObjectReference_1ai5gtd" />
<task id="Activity_0o1of4m" name="another ting">
<incoming>SequenceFlow_0wnb4ke</incoming>
<outgoing>Flow_1wwrhtz</outgoing>
<property id="Property_04a46wz" name="__targetRef_placeholder" />
<dataInputAssociation id="DataInputAssociation_0dfqqih">
<sourceRef>DataObjectReference_1ai5gtd</sourceRef>
<targetRef>Property_04a46wz</targetRef>
</dataInputAssociation>
<dataInputAssociation id="DataInputAssociation_18mr7se">
<sourceRef>DataObjectReference_0a2cgep</sourceRef>
<targetRef>Property_04a46wz</targetRef>
</dataInputAssociation>
</task>
<sequenceFlow id="Flow_1wwrhtz" sourceRef="Activity_0o1of4m" targetRef="ExclusiveGateway_15hu1pt" />
<dataObjectReference id="DataObjectReference_0a2cgep" dataObjectRef="DataObject_0d2mqo2" />
<dataObject id="DataObject_0d2mqo2" />
</process>
<bpmndi:BPMNDiagram id="BpmnDiagram_1">
<bpmndi:BPMNPlane id="BpmnPlane_1" bpmnElement="Process_1">
<bpmndi:BPMNEdge id="SequenceFlow_0wnb4ke_di" bpmnElement="SequenceFlow_0wnb4ke">
<omgdi:waypoint x="340" y="220" />
<omgdi:waypoint x="440" y="220" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0h21x7r_di" bpmnElement="SequenceFlow_0h21x7r">
<omgdi:waypoint x="188" y="220" />
<omgdi:waypoint x="240" y="220" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1wwrhtz_di" bpmnElement="Flow_1wwrhtz">
<omgdi:waypoint x="540" y="220" />
<omgdi:waypoint x="625" y="220" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="StartEvent_1y45yut_di" bpmnElement="StartEvent_1y45yut">
<omgdc:Bounds x="152" y="202" width="36" height="36" />
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_19o7vxg" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.0.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.17.0">
<bpmn:process id="Process_1mzevep" isExecutable="true">
<bpmn:ioSpecification>
<bpmn:dataInput id="num_dogs" name="Number of Dogs" />
<bpmn:dataOutput id="happy_index" name="Happiness Index" />
</bpmn:ioSpecification>
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_1mezzcx</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:endEvent id="Event_14wzv4j">
<bpmn:incoming>Flow_0q4oys2</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="Flow_01jg677" sourceRef="Activity_15zz6ya" targetRef="my_script_task" />
<bpmn:sequenceFlow id="Flow_1mezzcx" sourceRef="StartEvent_1" targetRef="Activity_15zz6ya" />
<bpmn:manualTask id="Activity_15zz6ya" name="eat hot dog">
<bpmn:incoming>Flow_1mezzcx</bpmn:incoming>
<bpmn:outgoing>Flow_01jg677</bpmn:outgoing>
<bpmn:dataOutputAssociation id="DataOutputAssociation_1uj5jzs">
<bpmn:targetRef>my_data_ref_1</bpmn:targetRef>
</bpmn:dataOutputAssociation>
<bpmn:standardLoopCharacteristics />
</bpmn:manualTask>
<bpmn:sequenceFlow id="Flow_0q4oys2" sourceRef="my_script_task" targetRef="Event_14wzv4j" />
<bpmn:scriptTask id="my_script_task" name="calculate contentment">
<bpmn:incoming>Flow_01jg677</bpmn:incoming>
<bpmn:outgoing>Flow_0q4oys2</bpmn:outgoing>
<bpmn:property id="Property_1w1963p" name="__targetRef_placeholder" />
<bpmn:dataInputAssociation id="DataInputAssociation_0thubmi">
<bpmn:sourceRef>my_data_ref_2</bpmn:sourceRef>
<bpmn:targetRef>Property_1w1963p</bpmn:targetRef>
</bpmn:dataInputAssociation>
</bpmn:scriptTask>
<bpmn:dataObjectReference id="my_data_ref_1" name="Data 1" dataObjectRef="DataObject_13tnlgu" />
<bpmn:dataObject id="DataObject_13tnlgu" />
<bpmn:dataObjectReference id="my_data_ref_2" name="Data 2" dataObjectRef="DataObject_0n982mk" />
<bpmn:dataObject id="DataObject_0n982mk" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1mzevep">
<bpmndi:BPMNShape id="dataInput_2" bpmnElement="happy_index">
<dc:Bounds x="602" y="85" width="36" height="50" />
<bpmndi:BPMNLabel>
<omgdc:Bounds x="134" y="245" width="73" height="14" />
<dc:Bounds x="580" y="142" width="83" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0fj5sal_di" bpmnElement="Task_1hcentk">
<omgdc:Bounds x="240" y="180" width="100" height="80" />
<bpmndi:BPMNEdge id="Flow_0q4oys2_di" bpmnElement="Flow_0q4oys2">
<di:waypoint x="540" y="197" />
<di:waypoint x="602" y="197" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_1mezzcx_di" bpmnElement="Flow_1mezzcx">
<di:waypoint x="215" y="197" />
<di:waypoint x="280" y="197" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_01jg677_di" bpmnElement="Flow_01jg677">
<di:waypoint x="380" y="197" />
<di:waypoint x="440" y="197" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="179" y="179" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="DataStoreReference_1vjj2bz_di" bpmnElement="DataObjectReference_1ai5gtd">
<omgdc:Bounds x="260" y="325" width="50" height="50" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_15hu1pt_di" bpmnElement="ExclusiveGateway_15hu1pt" isMarkerVisible="true">
<omgdc:Bounds x="625" y="195" width="50" height="50" />
<bpmndi:BPMNLabel>
<omgdc:Bounds x="618" y="252" width="66" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0o1of4m_di" bpmnElement="Activity_0o1of4m">
<omgdc:Bounds x="440" y="180" width="100" height="80" />
<bpmndi:BPMNShape id="Activity_0t7iwfm_di" bpmnElement="Activity_15zz6ya">
<dc:Bounds x="280" y="157" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="DataObjectReference_0kjcaox_di" bpmnElement="DataObjectReference_0a2cgep">
<omgdc:Bounds x="372" y="85" width="36" height="50" />
<bpmndi:BPMNShape id="dataInput_1" bpmnElement="num_dogs">
<dc:Bounds x="179" y="85" width="36" height="50" />
<bpmndi:BPMNLabel>
<dc:Bounds x="158" y="135" width="81" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="DataOutputAssociation_0d029ch_di" bpmnElement="DataOutputAssociation_0d029ch">
<omgdi:waypoint x="290" y="260" />
<omgdi:waypoint x="290" y="325" />
<bpmndi:BPMNShape id="Event_14wzv4j_di" bpmnElement="Event_14wzv4j">
<dc:Bounds x="602" y="179" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_0h86vbv_di" bpmnElement="my_script_task">
<dc:Bounds x="440" y="157" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="DataObjectReference_1cezipn_di" bpmnElement="my_data_ref_1">
<dc:Bounds x="312" y="275" width="36" height="50" />
<bpmndi:BPMNLabel>
<dc:Bounds x="314" y="332" width="33" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="DataObjectReference_08bm72g_di" bpmnElement="my_data_ref_2">
<dc:Bounds x="462" y="275" width="36" height="50" />
<bpmndi:BPMNLabel>
<dc:Bounds x="464" y="332" width="33" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="DataOutputAssociation_1uj5jzs_di" bpmnElement="DataOutputAssociation_1uj5jzs">
<di:waypoint x="329" y="237" />
<di:waypoint x="328" y="275" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="DataInputAssociation_0dfqqih_di" bpmnElement="DataInputAssociation_0dfqqih">
<omgdi:waypoint x="310" y="350" />
<omgdi:waypoint x="490" y="350" />
<omgdi:waypoint x="490" y="260" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="DataOutputAssociation_01dy1pz_di" bpmnElement="DataOutputAssociation_01dy1pz">
<omgdi:waypoint x="329" y="180" />
<omgdi:waypoint x="373" y="135" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="DataInputAssociation_18mr7se_di" bpmnElement="DataInputAssociation_18mr7se">
<omgdi:waypoint x="408" y="124" />
<omgdi:waypoint x="478" y="180" />
<bpmndi:BPMNEdge id="DataInputAssociation_0thubmi_di" bpmnElement="DataInputAssociation_0thubmi">
<di:waypoint x="483" y="275" />
<di:waypoint x="489" y="237" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</definitions>
</bpmn:definitions>

View File

@ -1,73 +1,35 @@
import TestContainer from 'mocha-test-container-support';
import Modeler from 'bpmn-js/lib/Modeler';
import spiffworkflow from '../../app/spiffworkflow/InputOutput';
import coreModule from 'bpmn-js/lib/core';
import createModule from 'diagram-js/lib/features/create';
import modelingModule from 'bpmn-js/lib/features/modeling';
import paletteModule from 'bpmn-js/lib/features/palette';
import {
setBpmnJS,
clearBpmnJS,
} from 'bpmn-js/test/helper';
import {
query as domQuery,
queryAll as domQueryAll
} from 'min-dom';
import {bootstrapPropertiesPanel, CONTAINER} from './helpers';
import inputOutput from '../../app/spiffworkflow/InputOutput';
import SpiffWorkflowPropertiesProvider from '../../app/spiffworkflow/PropertiesPanel';
import { BpmnPropertiesPanelModule, BpmnPropertiesProviderModule } from 'bpmn-js-properties-panel';
import spiffModdleExtension from '../../app/spiffworkflow/moddle/spiffworkflow.json';
describe('BPMN Input / Output', function() {
let container;
let modeler;
beforeEach(function() {
container = TestContainer.get(this);
});
function createModeler(xml) {
clearBpmnJS();
let testModules = [
coreModule,
createModule,
modelingModule,
paletteModule
];
modeler = new Modeler({
container: container,
modules: testModules,
propertiesPanel: {
parent: container,
},
additionalModules: [ spiffworkflow ]
});
setBpmnJS(modeler);
return modeler.importXML(xml).then(function(result) {
return { error: null, warnings: result.warnings, modeler: modeler };
}).catch(function(err) {
return { error: err, warnings: err.warnings, modeler: modeler };
});
}
it('should open diagram', function() {
let xml = require('./diagram.bpmn').default;
return createModeler(xml).then(function(result) {
expect(result.error).not.to.exist;
});
});
let xml = require('./diagram.bpmn').default;
beforeEach(bootstrapPropertiesPanel(xml, {
debounceInput: false,
additionalModules: [
inputOutput,
SpiffWorkflowPropertiesProvider,
BpmnPropertiesPanelModule,
BpmnPropertiesProviderModule,
],
moddleExtensions: {
spiffworkflow: spiffModdleExtension
},
}));
it('should have a data input and data output in the properties panel', function() {
let xml = require('./diagram.bpmn').default;
return createModeler(xml).then(function(result) {
expect(result.error).not.to.exist;
var paletteElement = domQuery('.djs-palette', container);
var entries = domQueryAll('.entry', paletteElement);
expect(entries[11].title).to.equals('Create DataInput');
expect(entries[12].title).to.equals('Create DataOutput');
});
var paletteElement = domQuery('.djs-palette', CONTAINER);
var entries = domQueryAll('.entry', paletteElement);
expect(entries[11].title).to.equals('Create DataInput');
expect(entries[12].title).to.equals('Create DataOutput');
});
});

View File

@ -0,0 +1,49 @@
import {
bootstrapPropertiesPanel,
expectSelected,
findEntry,
PROPERTIES_PANEL_CONTAINER
} from './helpers';
import { BpmnPropertiesPanelModule, BpmnPropertiesProviderModule } from 'bpmn-js-properties-panel';
import SpiffWorkflowPropertiesProvider from '../../app/spiffworkflow/PropertiesPanel';
import inputOutput from '../../app/spiffworkflow/InputOutput';
import spiffModdleExtension from '../../app/spiffworkflow/moddle/spiffworkflow.json';
describe('Properties Panel Script Tasks', function() {
let xml = require('./diagram.bpmn').default;
beforeEach(bootstrapPropertiesPanel(xml, {
debounceInput: false,
additionalModules: [
inputOutput,
SpiffWorkflowPropertiesProvider,
BpmnPropertiesPanelModule,
BpmnPropertiesProviderModule,
],
moddleExtensions: {
spiffworkflow: spiffModdleExtension
},
}));
it('should allow you to see all data objects', async function() {
// 1. Select the data object reference 'my_data_ref_1'
let my_data_ref_1 = await expectSelected('my_data_ref_1');
expect(my_data_ref_1).to.exist;
// 2. The props panel should include a dataObjects section.
let entry = findEntry('dataObjects', PROPERTIES_PANEL_CONTAINER);
expect(entry).to.exist;
// 3. There should be two data objects in the BPMN/Moddle
// 3. The entry List should contain a select box that contains all
// of the data elements.
});
});

View File

@ -1,87 +1,39 @@
import TestContainer from 'mocha-test-container-support';
import Modeler from 'bpmn-js/lib/Modeler';
import spiffworkflow from '../../app/spiffworkflow/InputOutput';
import coreModule from 'bpmn-js/lib/core';
import createModule from 'diagram-js/lib/features/create';
import modelingModule from 'bpmn-js/lib/features/modeling';
import paletteModule from 'bpmn-js/lib/features/palette';
const spiffModdleExtension = require('../../app/spiffworkflow/moddle/spiffworkflow.json');
import {
bootstrapPropertiesPanel,
expectSelected,
findEntry,
PROPERTIES_PANEL_CONTAINER
} from './helpers';
import spiffModdleExtension from '../../app/spiffworkflow/moddle/spiffworkflow.json';
import inputOutput from '../../app/spiffworkflow/InputOutput';
import SpiffWorkflowPropertiesProvider from '../../app/spiffworkflow/PropertiesPanel';
import { BpmnPropertiesPanelModule, BpmnPropertiesProviderModule } from 'bpmn-js-properties-panel';
import {
setBpmnJS,
clearBpmnJS,
} from 'bpmn-js/test/helper';
import {
query as domQuery,
queryAll as domQueryAll
} from 'min-dom';
import SpiffWorkflowPropertiesProvider from '../../app/spiffworkflow/PropertiesPanel/SpiffWorkflowPropertiesProvider';
describe('Properties Panel Script Tasks', function() {
let xml = require('./diagram.bpmn').default;
let container;
let modelerContainer;
let propertiesContainer;
let modeler;
beforeEach(bootstrapPropertiesPanel(xml, {
debounceInput: false,
additionalModules: [
inputOutput,
SpiffWorkflowPropertiesProvider,
BpmnPropertiesPanelModule,
BpmnPropertiesProviderModule,
],
moddleExtensions: {
spiffworkflow: spiffModdleExtension
},
}));
beforeEach(function() {
container = TestContainer.get(this);
modelerContainer = document.createElement('div');
modelerContainer.classList.add('modeler-container');
container.appendChild(modelerContainer);
it('should allow you to add a script to a script task', async function() {
// 1. Select the script task 'my_script_task'
expectSelected('my_script_task');
propertiesContainer = document.createElement('div');
propertiesContainer.classList.add('properties-container');
container.appendChild(propertiesContainer);
// 2. Assure properties panel has a pythonScript
let entry = findEntry('pythonScript_bpmn:script', PROPERTIES_PANEL_CONTAINER);
expect(entry).to.exist;
});
// Fixme - this is duplicated from the other spec
function createModeler(xml) {
clearBpmnJS();
let testModules = [
coreModule,
createModule,
modelingModule,
paletteModule
];
modeler = new Modeler({
container: modelerContainer,
modules: testModules,
propertiesPanel: {
parent: propertiesContainer,
},
additionalModules: [
spiffworkflow,
BpmnPropertiesPanelModule,
BpmnPropertiesProviderModule,
SpiffWorkflowPropertiesProvider ]
});
setBpmnJS(modeler);
return modeler.importXML(xml).then(function(result) {
return { error: null, warnings: result.warnings, modeler: modeler };
}).catch(function(err) {
return { error: err, warnings: err.warnings, modeler: modeler };
});
}
it('should allow you to add a script to a script task', function() {
let xml = require('./diagram.bpmn').default;
return createModeler(xml).then(function(result) {
expect(result.error).not.to.exist;
// a. There should be a properties panel
expect(domQuery('.bio-properties-panel', propertiesContainer)).to.exist;
// 1. Select the script task 'my_script_task'
// 2. Assure properties panel has 'SpiffWorkflow Properties'
// 3. Assere there is a text input called 'script'
// 4. Adding text to that script input updates the script in the bpmn.
});
// 3. Assere there is a text input called 'script'
// 4. Adding text to that script input updates the script in the bpmn.
});
});

View File

@ -2,8 +2,8 @@
<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_19o7vxg" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="5.0.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.17.0">
<bpmn:process id="Process_1mzevep" isExecutable="true">
<bpmn:ioSpecification>
<bpmn:dataInput id="ID_3" name="num_dogs" />
<bpmn:dataOutput id="ID_5" name="happy_index" />
<bpmn:dataInput id="num_dogs" name="Number of Dogs" />
<bpmn:dataOutput id="happy_index" name="Happiness Index" />
</bpmn:ioSpecification>
<bpmn:startEvent id="StartEvent_1">
<bpmn:outgoing>Flow_1mezzcx</bpmn:outgoing>
@ -16,20 +16,32 @@
<bpmn:manualTask id="Activity_15zz6ya" name="eat hot dog">
<bpmn:incoming>Flow_1mezzcx</bpmn:incoming>
<bpmn:outgoing>Flow_01jg677</bpmn:outgoing>
<bpmn:dataOutputAssociation id="DataOutputAssociation_1uj5jzs">
<bpmn:targetRef>my_data_ref_1</bpmn:targetRef>
</bpmn:dataOutputAssociation>
<bpmn:standardLoopCharacteristics />
</bpmn:manualTask>
<bpmn:sequenceFlow id="Flow_0q4oys2" sourceRef="my_script_task" targetRef="Event_14wzv4j" />
<bpmn:scriptTask id="my_script_task" name="calculate contentment">
<bpmn:incoming>Flow_01jg677</bpmn:incoming>
<bpmn:outgoing>Flow_0q4oys2</bpmn:outgoing>
<bpmn:property id="Property_1w1963p" name="__targetRef_placeholder" />
<bpmn:dataInputAssociation id="DataInputAssociation_0thubmi">
<bpmn:sourceRef>my_data_ref_2</bpmn:sourceRef>
<bpmn:targetRef>Property_1w1963p</bpmn:targetRef>
</bpmn:dataInputAssociation>
</bpmn:scriptTask>
<bpmn:dataObjectReference id="my_data_ref_1" name="Data 1" dataObjectRef="DataObject_13tnlgu" />
<bpmn:dataObject id="DataObject_13tnlgu" />
<bpmn:dataObjectReference id="my_data_ref_2" name="Data 2" dataObjectRef="DataObject_0n982mk" />
<bpmn:dataObject id="DataObject_0n982mk" />
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1mzevep">
<bpmndi:BPMNShape id="dataInput_2" bpmnElement="ID_5">
<bpmndi:BPMNShape id="dataInput_2" bpmnElement="happy_index">
<dc:Bounds x="602" y="85" width="36" height="50" />
<bpmndi:BPMNLabel>
<dc:Bounds x="589" y="142" width="63" height="14" />
<dc:Bounds x="580" y="142" width="83" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="Flow_0q4oys2_di" bpmnElement="Flow_0q4oys2">
@ -51,10 +63,10 @@
<dc:Bounds x="280" y="157" width="100" height="80" />
<bpmndi:BPMNLabel />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="dataInput_1" bpmnElement="ID_3">
<bpmndi:BPMNShape id="dataInput_1" bpmnElement="num_dogs">
<dc:Bounds x="179" y="85" width="36" height="50" />
<bpmndi:BPMNLabel>
<dc:Bounds x="172" y="135" width="52" height="14" />
<dc:Bounds x="158" y="135" width="81" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Event_14wzv4j_di" bpmnElement="Event_14wzv4j">
@ -63,6 +75,26 @@
<bpmndi:BPMNShape id="Activity_0h86vbv_di" bpmnElement="my_script_task">
<dc:Bounds x="440" y="157" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="DataObjectReference_1cezipn_di" bpmnElement="my_data_ref_1">
<dc:Bounds x="312" y="275" width="36" height="50" />
<bpmndi:BPMNLabel>
<dc:Bounds x="314" y="332" width="33" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="DataObjectReference_08bm72g_di" bpmnElement="my_data_ref_2">
<dc:Bounds x="462" y="275" width="36" height="50" />
<bpmndi:BPMNLabel>
<dc:Bounds x="464" y="332" width="33" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="DataOutputAssociation_1uj5jzs_di" bpmnElement="DataOutputAssociation_1uj5jzs">
<di:waypoint x="329" y="237" />
<di:waypoint x="328" y="275" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="DataInputAssociation_0thubmi_di" bpmnElement="DataInputAssociation_0thubmi">
<di:waypoint x="483" y="275" />
<di:waypoint x="489" y="237" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>

107
test/spec/helpers.js Normal file
View File

@ -0,0 +1,107 @@
import {
query as domQuery,
} from 'min-dom';
import { act } from '@testing-library/preact';
import {
getBpmnJS,
} from 'bpmn-js/test/helper';
import Modeler from 'bpmn-js/lib/Modeler';
import TestContainer from 'mocha-test-container-support';
import { bootstrapBpmnJS, inject, insertCSS } from 'bpmn-js/test/helper';
export let PROPERTIES_PANEL_CONTAINER;
export let CONTAINER;
export function bootstrapPropertiesPanel(diagram, options, locals) {
return async function() {
CONTAINER = TestContainer.get(this);
insertBpmnStyles();
insertCoreStyles();
options.container = CONTAINER;
const createModeler = bootstrapBpmnJS(Modeler, diagram, options, locals);
await act(() => createModeler.call(this));
// (2) clean-up properties panel
clearPropertiesPanelContainer();
// (3) attach properties panel
const attachPropertiesPanel = inject(function(propertiesPanel) {
PROPERTIES_PANEL_CONTAINER = document.createElement('div');
PROPERTIES_PANEL_CONTAINER.classList.add('properties-container');
CONTAINER.appendChild(PROPERTIES_PANEL_CONTAINER);
return act(() => propertiesPanel.attachTo(PROPERTIES_PANEL_CONTAINER));
});
await attachPropertiesPanel();
};
}
export function clearPropertiesPanelContainer() {
if (PROPERTIES_PANEL_CONTAINER) {
PROPERTIES_PANEL_CONTAINER.remove();
}
}
export function insertCoreStyles() {
insertCSS(
'properties-panel.css',
require('bpmn-js-properties-panel/dist/assets/properties-panel.css').default
);
insertCSS(
'test.css',
require('./test.css').default
);
}
export function insertBpmnStyles() {
insertCSS(
'diagram.css',
require('bpmn-js/dist/assets/diagram-js.css').default
);
// @barmac: this fails before bpmn-js@9
insertCSS(
'bpmn-js.css',
require('bpmn-js/dist/assets/bpmn-js.css').default
);
insertCSS(
'bpmn-font.css',
require('bpmn-js/dist/assets/bpmn-font/css/bpmn-embedded.css').default
);
}
export function expectSelected(id) {
return getBpmnJS().invoke(async function(elementRegistry, selection) {
const element = elementRegistry.get(id);
await act(() => {
selection.select(element);
});
return element;
});
}
export function findEntry(id, container) {
return domQuery(`[data-entry-id='${ id }']`, container);
}
export function findInput(type, container) {
return domQuery(`input[type='${ type }']`, container);
}
export function findSelect(container) {
return domQuery('select', container);
}
export function findTextarea(container) {
return domQuery('textarea', container);
}

40
test/spec/test.css Normal file
View File

@ -0,0 +1,40 @@
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@300;400;500;600&display=swap');
html, body, .modeler-container, .modeler-container > div {
height: 100%;
margin: 0;
font-family: 'IBM Plex Sans', sans-serif;
}
.test-container {
height: 800px !important;
}
.test-content-container {
width: 100%;
height: calc(100% - 24px) !important;
display: flex;
flex: 1;
flex-direction: row;
}
.modeler-container {
flex: 1;
position: relative;
}
.modeler-container, .properties-container {
overflow-y: auto;
}
.properties-container {
position: relative;
flex: none;
height: 100%;
width: 300px;
border-left: solid 1px #cccccc;
}
.properties-container .bio-properties-panel {
--font-family: 'IBM Plex Sans', sans-serif !important;
}