Squashed 'bpmn-js-spiffworkflow/' changes from 96dcd1a24..24c2cc360

24c2cc360 don't flake out when no dmn options are returned.

git-subtree-dir: bpmn-js-spiffworkflow
git-subtree-split: 24c2cc36067adf8fed75990c6bf4a1a67bc9122b
This commit is contained in:
jasquat 2022-11-09 15:03:55 -05:00
parent 9213cea140
commit 25a1e84439
2 changed files with 14 additions and 14 deletions

View File

@ -46,9 +46,9 @@ export function SpiffExtensionSelect(props) {
if ( if (
!(optionType in spiffExtensionOptions) || !(optionType in spiffExtensionOptions) ||
spiffExtensionOptions[optionType].length === 0 spiffExtensionOptions[optionType] === null
) { ) {
spiffExtensionOptions[optionType] = []; spiffExtensionOptions[optionType] = null;
requestOptions(eventBus, element, commandStack, optionType); requestOptions(eventBus, element, commandStack, optionType);
} }
const getOptions = () => { const getOptions = () => {

View File

@ -33,23 +33,22 @@ describe('Business Rule Properties Panel', function () {
}) })
); );
function addOptionsToEventBus(bpmnModeler) {
bpmnModeler.on('spiff.dmn_files.requested', (event) => { const return_files = (event) => {
event.eventBus.fire('spiff.dmn_files.returned', { console.log("Return Files called.")
options: [ event.eventBus.fire('spiff.dmn_files.returned', {
{ label: 'Calculate Pizza Price', value: 'Decision_Pizza_Price' }, options: [
{ label: 'Viking Availability', value: 'Decision_Vikings' }, { label: 'Calculate Pizza Price', value: 'Decision_Pizza_Price' },
{ label: 'Test Decision', value: 'test_decision' }, { label: 'Viking Availability', value: 'Decision_Vikings' },
], { label: 'Test Decision', value: 'test_decision' },
}); ],
}); });
} }
it('should display a dropdown to select from available decision tables', async function () { it('should display a dropdown to select from available decision tables', async function () {
const modeler = getBpmnJS(); const modeler = getBpmnJS();
addOptionsToEventBus(modeler); modeler.get('eventBus').once('spiff.dmn_files.requested', return_files);
expectSelected('business_rule_task'); expectSelected('business_rule_task');
// THEN - a properties panel exists with a section for editing that script // THEN - a properties panel exists with a section for editing that script
const entry = findEntry('extension_spiffworkflow:calledDecisionId', getPropertiesPanel()); const entry = findEntry('extension_spiffworkflow:calledDecisionId', getPropertiesPanel());
expect(entry, 'No Entry').to.exist; expect(entry, 'No Entry').to.exist;
@ -60,7 +59,7 @@ describe('Business Rule Properties Panel', function () {
it('should update the spiffworkflow:calledDecisionId tag when you modify the called decision select box', async function () { it('should update the spiffworkflow:calledDecisionId tag when you modify the called decision select box', async function () {
// IF - a script tag is selected, and you change the script in the properties panel // IF - a script tag is selected, and you change the script in the properties panel
const modeler = getBpmnJS(); const modeler = getBpmnJS();
addOptionsToEventBus(modeler); modeler.get('eventBus').once('spiff.dmn_files.requested', return_files);
const businessRuleTask = await expectSelected('business_rule_task'); const businessRuleTask = await expectSelected('business_rule_task');
const entry = findEntry('extension_calledDecisionId', getPropertiesPanel()); const entry = findEntry('extension_calledDecisionId', getPropertiesPanel());
const selectList = findSelect(entry); const selectList = findSelect(entry);
@ -85,4 +84,5 @@ describe('Business Rule Properties Panel', function () {
const element = businessObject.extensionElements.values[0]; const element = businessObject.extensionElements.values[0];
expect(element.value).to.equal('test_decision'); expect(element.value).to.equal('test_decision');
}); });
}); });