Implement new tests

This commit is contained in:
theaubmov 2023-12-03 12:22:26 +01:00
parent 123037d8ee
commit 9c1d9afac8
3 changed files with 52 additions and 4 deletions

View File

@ -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,

View File

@ -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

View File

@ -61,6 +61,11 @@
</camunda:properties>
</bpmn:extensionElements>
</bpmn:dataObjectReference>
<bpmn:dataObjectReference id="my_data_ref_3" name="my_data_object" dataObjectRef="my_data_object">
<bpmn:dataState id="DataState_my_data_ref_3" name="OK" />
</bpmn:dataObjectReference>
<bpmn:dataObject id="my_data_object" />
<bpmn:sequenceFlow id="Flow_1lu1qyz" sourceRef="business_rule_task" targetRef="Event_14wzv4j" />
<bpmn:businessRuleTask id="business_rule_task">
@ -119,6 +124,12 @@
<dc:Bounds x="451" y="322" width="78" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="DataObjectReference_08bm73g_di" bpmnElement="my_data_ref_3">
<dc:Bounds x="472" y="265" width="36" height="50" />
<bpmndi:BPMNLabel>
<dc:Bounds x="451" y="322" width="78" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="dataInput_1" bpmnElement="num_dogs">
<dc:Bounds x="172" y="85" width="36" height="50" />
<bpmndi:BPMNLabel>