Done with Fixing Broken Tests
This commit is contained in:
parent
37e71bdef2
commit
511a9c9c31
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
||||
}));
|
||||
|
||||
});
|
||||
|
|
|
@ -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);
|
||||
|
||||
}));
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue