From 25a1e844397a26c4c8282d23671062edda059a13 Mon Sep 17 00:00:00 2001 From: jasquat Date: Wed, 9 Nov 2022 15:03:55 -0500 Subject: [PATCH] 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 --- .../propertiesPanel/SpiffExtensionSelect.js | 4 ++-- test/spec/BusinessRulePropsSpec.js | 24 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionSelect.js b/app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionSelect.js index edbc80a2..5bc6f505 100644 --- a/app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionSelect.js +++ b/app/spiffworkflow/extensions/propertiesPanel/SpiffExtensionSelect.js @@ -46,9 +46,9 @@ export function SpiffExtensionSelect(props) { if ( !(optionType in spiffExtensionOptions) || - spiffExtensionOptions[optionType].length === 0 + spiffExtensionOptions[optionType] === null ) { - spiffExtensionOptions[optionType] = []; + spiffExtensionOptions[optionType] = null; requestOptions(eventBus, element, commandStack, optionType); } const getOptions = () => { diff --git a/test/spec/BusinessRulePropsSpec.js b/test/spec/BusinessRulePropsSpec.js index 5ff37d93..6111a898 100644 --- a/test/spec/BusinessRulePropsSpec.js +++ b/test/spec/BusinessRulePropsSpec.js @@ -33,23 +33,22 @@ describe('Business Rule Properties Panel', function () { }) ); - function addOptionsToEventBus(bpmnModeler) { - bpmnModeler.on('spiff.dmn_files.requested', (event) => { - event.eventBus.fire('spiff.dmn_files.returned', { - options: [ - { label: 'Calculate Pizza Price', value: 'Decision_Pizza_Price' }, - { label: 'Viking Availability', value: 'Decision_Vikings' }, - { label: 'Test Decision', value: 'test_decision' }, - ], - }); + + const return_files = (event) => { + console.log("Return Files called.") + event.eventBus.fire('spiff.dmn_files.returned', { + options: [ + { label: 'Calculate Pizza Price', value: 'Decision_Pizza_Price' }, + { 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 () { const modeler = getBpmnJS(); - addOptionsToEventBus(modeler); + modeler.get('eventBus').once('spiff.dmn_files.requested', return_files); expectSelected('business_rule_task'); - // THEN - a properties panel exists with a section for editing that script const entry = findEntry('extension_spiffworkflow:calledDecisionId', getPropertiesPanel()); 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 () { // IF - a script tag is selected, and you change the script in the properties panel const modeler = getBpmnJS(); - addOptionsToEventBus(modeler); + modeler.get('eventBus').once('spiff.dmn_files.requested', return_files); const businessRuleTask = await expectSelected('business_rule_task'); const entry = findEntry('extension_calledDecisionId', getPropertiesPanel()); const selectList = findSelect(entry); @@ -85,4 +84,5 @@ describe('Business Rule Properties Panel', function () { const element = businessObject.extensionElements.values[0]; expect(element.value).to.equal('test_decision'); }); + });