From 9c1d9afac816e10024b8a8c54ee299a106dce305 Mon Sep 17 00:00:00 2001 From: theaubmov Date: Sun, 3 Dec 2023 12:22:26 +0100 Subject: [PATCH] Implement new tests --- .../DataObjectPropertiesProvider.js | 4 +- test/spec/DataObjectPropsSpec.js | 41 ++++++++++++++++++- test/spec/bpmn/diagram.bpmn | 11 +++++ 3 files changed, 52 insertions(+), 4 deletions(-) diff --git a/app/spiffworkflow/DataObject/propertiesPanel/DataObjectPropertiesProvider.js b/app/spiffworkflow/DataObject/propertiesPanel/DataObjectPropertiesProvider.js index dfcde52..ce63e27 100644 --- a/app/spiffworkflow/DataObject/propertiesPanel/DataObjectPropertiesProvider.js +++ b/app/spiffworkflow/DataObject/propertiesPanel/DataObjectPropertiesProvider.js @@ -168,8 +168,8 @@ function createDataStateTextField(props) { element, id: `${id}-textField`, name: 'spiffworkflow:DataStateLabel', - label: 'Which Data State does this reference?', - description: 'Select the Data State this represents.', + label: 'Enter Data State of this reference?', + description: 'Enter the Data State for this reference.', getValue, setValue, debounce, diff --git a/test/spec/DataObjectPropsSpec.js b/test/spec/DataObjectPropsSpec.js index 224add9..3b27f50 100644 --- a/test/spec/DataObjectPropsSpec.js +++ b/test/spec/DataObjectPropsSpec.js @@ -57,7 +57,6 @@ describe('Properties Panel for Data Objects', function () { expect(selector.length).to.equal(3); }); - it('selecting a different data object should change the data model.', async function () { // IF - a data object reference is selected @@ -104,7 +103,7 @@ describe('Properties Panel for Data Objects', function () { // expect(my_data_ref_1.businessObject.name).to.equal('My Object 1'); }); - it('renaming a data object, does not change the label of references', async function () { + it('renaming a data object ID, does not change the label of references', async function () { // IF - a process is selected, and the name of a data object is changed. let entry = findEntry('ProcessTest-dataObj-2-id', container); let textInput = findInput('text', entry); @@ -115,6 +114,44 @@ describe('Properties Panel for Data Objects', function () { expect(my_data_ref_1.businessObject.name).not.to.equal('My Nifty New Name'); }); + it('renaming a data object name, does change the label of references', async function () { + + let entry = findEntry('ProcessTest-dataObj-2-name', container); + let textInput = findInput('text', entry); + let newDataObjectName = 'A New Data Object Name'; + + changeInput(textInput, newDataObjectName); + + let my_data_ref_1 = await expectSelected('my_data_ref_1'); + let my_data_ref_2 = await expectSelected('my_data_ref_2'); + + // THEN - the label of any references are updated. + expect(my_data_ref_1.businessObject.name).to.equal(newDataObjectName); + expect(my_data_ref_2.businessObject.name).to.equal(newDataObjectName); + + // Test References with DataState + let my_data_ref_3 = await expectSelected('my_data_ref_3'); + let my_data_ref_3_DataState = my_data_ref_3.businessObject.dataState.name; + + expect(my_data_ref_3.businessObject.name).to.equal(`${newDataObjectName} [${my_data_ref_3_DataState}]`); + }); + + it('renaming a data object reference state, does change the label of references', async function () { + + let my_data_ref_1 = await expectSelected('my_data_ref_1'); + let dtObjCurrentName = my_data_ref_1.businessObject.name; + let entry = findEntry('selectDataState-textField', container); + let idInput = findInput('text', entry); + let nwState = "New State"; + + // Change Data State + changeInput(idInput, nwState); + + // Expect new DataObjectRef Name to be like 'DataObjectRefName [DataState]' + expect(my_data_ref_1.businessObject.name).to.equal(`${dtObjCurrentName} [${nwState}]`); + expect(my_data_ref_1.businessObject.name).not.to.equal(dtObjCurrentName); + }); + it('selecting a different data object should not change the data object reference name.', async function () { // IF - a data object reference is selected diff --git a/test/spec/bpmn/diagram.bpmn b/test/spec/bpmn/diagram.bpmn index 0f0c041..de82f6e 100644 --- a/test/spec/bpmn/diagram.bpmn +++ b/test/spec/bpmn/diagram.bpmn @@ -61,6 +61,11 @@ + + + + + @@ -119,6 +124,12 @@ + + + + + +