Done with Fixing Broken Tests

This commit is contained in:
theaubmov 2023-12-02 18:53:23 +01:00
parent 37e71bdef2
commit 511a9c9c31
3 changed files with 36 additions and 25 deletions

View File

@ -10,6 +10,7 @@ import {
findDataObjectReferenceShapes,
updateDataObjectReferencesName,
idToHumanReadableName,
findDataObject,
} from '../DataObjectHelpers';
/**
@ -122,6 +123,12 @@ function DataObjectTextField(props) {
const setValue = (value) => {
try {
// Check if new dataObject Id is not unique
if(findDataObject(element.businessObject, value) !== undefined){
alert('Data Object ID Should be unique');
return;
}
// let doName = idToHumanReadableName(value);
commandStack.execute('element.updateModdleProperties', {
element,

View File

@ -1,4 +1,4 @@
import { bootstrapPropertiesPanel } from './helpers';
import { bootstrapPropertiesPanel, changeInput, expectSelected, findEntry, findInput } from './helpers';
import dataObjectInterceptor from '../../app/spiffworkflow/DataObject';
import { BpmnPropertiesPanelModule, BpmnPropertiesProviderModule } from 'bpmn-js-properties-panel';
import {
@ -165,28 +165,4 @@ describe('DataObject Interceptor', function() {
}));
it('should not allow two dataObjects to have the same ID', inject(async function(canvas, modeling) {
// Creating the first dataObject
let rootShape = canvas.getRootElement();
const dataObject1 = modeling.createShape({ type: 'bpmn:DataObject' },
{ x: 100, y: 100 }, rootShape);
// Creating the second dataObject
const dataObject2 = modeling.createShape({ type: 'bpmn:DataObject' },
{ x: 150, y: 100 }, rootShape);
await expectSelected(dataObject2.id);
let entry = findEntry('dataObjectId', container);
let idInput = findInput('text', entry);
const duplicateId = dataObject1.businessObject.id;
changeInput(idInput, duplicateId);
// Check that the ID change is not successful
expect(dataObject2.businessObject.id).not.to.equal(duplicateId);
}));
});

View File

@ -7,6 +7,10 @@ import {
findSelect
} from './helpers';
import {
inject,
} from 'bpmn-js/test/helper';
import {
BpmnPropertiesPanelModule,
BpmnPropertiesProviderModule
@ -127,4 +131,28 @@ describe('Properties Panel for Data Objects', function() {
expect(businessObject.name).not.to.equal('my_data_object');
});
it('should not allow two dataObjects to have the same ID', inject(async function(canvas, modeling) {
// Creating the first dataObject
let rootShape = canvas.getRootElement();
const dataObject1 = modeling.createShape({ type: 'bpmn:DataObject' },
{ x: 100, y: 100 }, rootShape);
// Creating the second dataObject
const dataObject2 = modeling.createShape({ type: 'bpmn:DataObject' },
{ x: 150, y: 100 }, rootShape);
await expectSelected(dataObject2.id);
let entry = findEntry('dataObjectId', container);
let idInput = findInput('text', entry);
const duplicateId = dataObject1.businessObject.id;
changeInput(idInput, duplicateId);
// Check that the ID change is not successful
expect(dataObject2.businessObject.id).not.to.equal(duplicateId);
}));
});