Before implementing new tests
This commit is contained in:
parent
84a0667ec4
commit
123037d8ee
|
@ -5,8 +5,7 @@ const LOW_PRIORITY = 500;
|
|||
|
||||
export default function DataObjectLabelEditingProvider(eventBus, canvas, directEditing, commandStack, modeling) {
|
||||
|
||||
directEditing.registerProvider(LOW_PRIORITY, this);
|
||||
|
||||
// directEditing.registerProvider(LOW_PRIORITY, this);
|
||||
let el;
|
||||
|
||||
// listen to dblclick on non-root elements
|
||||
|
@ -21,27 +20,21 @@ export default function DataObjectLabelEditingProvider(eventBus, canvas, directE
|
|||
}
|
||||
});
|
||||
|
||||
eventBus.on('directEditing.activate', async function (event) {
|
||||
const { element } = event.active;
|
||||
if (is(element.businessObject, 'bpmn:DataObjectReference')) { }
|
||||
});
|
||||
// eventBus.on('directEditing.activate', async function (event) {
|
||||
// const { element } = event.active;
|
||||
// if (is(element.businessObject, 'bpmn:DataObjectReference')) { }
|
||||
// });
|
||||
|
||||
eventBus.on('directEditing.complete', function (event) {
|
||||
|
||||
const element = el;
|
||||
|
||||
if (element && is(element.businessObject, 'bpmn:DataObjectReference')) {
|
||||
|
||||
const process = element.parent.businessObject;
|
||||
const dataObject = findDataObject(process, element.businessObject.dataObjectRef.id);
|
||||
const dataState = element.businessObject.dataState && element.businessObject.dataState.name;
|
||||
|
||||
let newLabel = element.businessObject.name;
|
||||
|
||||
console.log('newLabel', newLabel);
|
||||
console.log('dataObject', dataObject);
|
||||
console.log('element', element);
|
||||
|
||||
commandStack.execute('element.updateModdleProperties', {
|
||||
element,
|
||||
moddleElement: dataObject,
|
||||
|
@ -50,8 +43,6 @@ export default function DataObjectLabelEditingProvider(eventBus, canvas, directE
|
|||
},
|
||||
});
|
||||
|
||||
console.log('cdataObject', dataObject);
|
||||
|
||||
// Update references name
|
||||
updateDataObjectReferencesName(element.parent, newLabel, dataObject.id, commandStack);
|
||||
|
||||
|
@ -63,11 +54,8 @@ export default function DataObjectLabelEditingProvider(eventBus, canvas, directE
|
|||
// Update the label with the data state
|
||||
modeling.updateLabel(element, newLabel);
|
||||
el = undefined;
|
||||
|
||||
console.log('---------------------');
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
DataObjectLabelEditingProvider.$inject = [
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { bootstrapPropertiesPanel, changeInput, expectSelected, findEntry, findInput } from './helpers';
|
||||
import { bootstrapPropertiesPanel } from './helpers';
|
||||
import dataObjectInterceptor from '../../app/spiffworkflow/DataObject';
|
||||
import { BpmnPropertiesPanelModule, BpmnPropertiesProviderModule } from 'bpmn-js-properties-panel';
|
||||
import {
|
||||
|
@ -10,7 +10,7 @@ import {
|
|||
idToHumanReadableName,
|
||||
} from '../../app/spiffworkflow/DataObject/DataObjectHelpers';
|
||||
|
||||
describe('DataObject Interceptor', function() {
|
||||
describe('DataObject Interceptor', function () {
|
||||
|
||||
let xml = require('./bpmn/empty_diagram.bpmn').default;
|
||||
|
||||
|
@ -23,7 +23,7 @@ describe('DataObject Interceptor', function() {
|
|||
]
|
||||
}));
|
||||
|
||||
it('New Data Object References should create a data object if none exist.', inject(function(canvas, modeling) {
|
||||
it('New Data Object References should create a data object if none exist.', inject(function (canvas, modeling) {
|
||||
|
||||
// IF - a new dataObjectReference is created
|
||||
let rootShape = canvas.getRootElement();
|
||||
|
@ -37,7 +37,7 @@ describe('DataObject Interceptor', function() {
|
|||
|
||||
}));
|
||||
|
||||
it('New Data Object References should connect to the first available data Object if it exists', inject(function(canvas, modeling) {
|
||||
it('New Data Object References should connect to the first available data Object if it exists', inject(function (canvas, modeling) {
|
||||
|
||||
// IF - two dataObjectReferences are created
|
||||
let rootShape = canvas.getRootElement();
|
||||
|
@ -54,7 +54,7 @@ describe('DataObject Interceptor', function() {
|
|||
|
||||
}));
|
||||
|
||||
it('Deleting a data object reference does not delete the data object, unless it is the last reference', inject(function(canvas, modeling) {
|
||||
it('Deleting a data object reference does not delete the data object, unless it is the last reference', inject(function (canvas, modeling) {
|
||||
|
||||
// IF - two dataObjectReferences are created
|
||||
let rootShape = canvas.getRootElement();
|
||||
|
@ -71,7 +71,7 @@ describe('DataObject Interceptor', function() {
|
|||
expect(dataObjects.length).to.equal(1);
|
||||
}));
|
||||
|
||||
it('Deleting all the data references will also delete the data object', inject(function(canvas, modeling) {
|
||||
it('Deleting all the data references will also delete the data object', inject(function (canvas, modeling) {
|
||||
|
||||
// IF - two dataObjectReferences are created
|
||||
let rootShape = canvas.getRootElement();
|
||||
|
@ -88,8 +88,8 @@ describe('DataObject Interceptor', function() {
|
|||
const dataObjects = findDataObjects(rootShape.businessObject);
|
||||
expect(dataObjects.length).to.equal(0);
|
||||
}));
|
||||
|
||||
it('Creating a new Reference will update the name to match the DataObject', inject(function(canvas, modeling) {
|
||||
|
||||
it('Creating a new Reference will update the name to match the DataObject', inject(function (canvas, modeling) {
|
||||
|
||||
// IF - a Data Reference Exists
|
||||
let rootShape = canvas.getRootElement();
|
||||
|
@ -101,7 +101,7 @@ describe('DataObject Interceptor', function() {
|
|||
expect(dataObjectRefShape1.businessObject.name).to.equal(human_readable_name);
|
||||
}));
|
||||
|
||||
it('should allow you to add a data object to a subprocess', inject(function(canvas, modeling, elementRegistry) {
|
||||
it('should allow you to add a data object to a subprocess', inject(function (canvas, modeling, elementRegistry) {
|
||||
|
||||
// IF - A data object reference is added to a sup-process
|
||||
let subProcessShape = elementRegistry.get('my_subprocess');
|
||||
|
@ -117,7 +117,7 @@ describe('DataObject Interceptor', function() {
|
|||
expect(dataObjects.length).to.equal(1);
|
||||
}));
|
||||
|
||||
it('Data objects in a process should be visible in a subprocess', inject(function(canvas, modeling, elementRegistry) {
|
||||
it('Data objects in a process should be visible in a subprocess', inject(function (canvas, modeling, elementRegistry) {
|
||||
|
||||
let subProcessShape = elementRegistry.get('my_subprocess');
|
||||
let subProcess = subProcessShape.businessObject;
|
||||
|
@ -132,7 +132,7 @@ describe('DataObject Interceptor', function() {
|
|||
expect(dataObjects.length).to.equal(1);
|
||||
}));
|
||||
|
||||
it('Data objects in a subprocess should not be visible in a process', inject(function(canvas, modeling, elementRegistry) {
|
||||
it('Data objects in a subprocess should not be visible in a process', inject(function (canvas, modeling, elementRegistry) {
|
||||
|
||||
let subProcessShape = elementRegistry.get('my_subprocess');
|
||||
let subProcess = subProcessShape.businessObject;
|
||||
|
@ -147,7 +147,7 @@ describe('DataObject Interceptor', function() {
|
|||
expect(dataObjects.length).to.equal(0);
|
||||
}));
|
||||
|
||||
it('References inside subprocesses should be visible in a process', inject(function(canvas, modeling, elementRegistry) {
|
||||
it('References inside subprocesses should be visible in a process', inject(function (canvas, modeling, elementRegistry) {
|
||||
|
||||
let rootShape = canvas.getRootElement();
|
||||
const refOne = modeling.createShape({ type: 'bpmn:DataObjectReference' },
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import {
|
||||
bootstrapPropertiesPanel,
|
||||
bootstrapPropertiesPanel,
|
||||
changeInput,
|
||||
expectSelected,
|
||||
findEntry,
|
||||
findInput,
|
||||
findEntry,
|
||||
findInput,
|
||||
findSelect
|
||||
} from './helpers';
|
||||
|
||||
|
@ -11,20 +11,20 @@ import {
|
|||
inject,
|
||||
} from 'bpmn-js/test/helper';
|
||||
|
||||
import {
|
||||
BpmnPropertiesPanelModule,
|
||||
BpmnPropertiesProviderModule
|
||||
import {
|
||||
BpmnPropertiesPanelModule,
|
||||
BpmnPropertiesProviderModule
|
||||
} from 'bpmn-js-properties-panel';
|
||||
|
||||
import spiffModdleExtension from '../../app/spiffworkflow/moddle/spiffworkflow.json';
|
||||
import TestContainer from 'mocha-test-container-support';
|
||||
import DataObject from '../../app/spiffworkflow/DataObject';
|
||||
|
||||
describe('Properties Panel for Data Objects', function() {
|
||||
describe('Properties Panel for Data Objects', function () {
|
||||
let xml = require('./bpmn/diagram.bpmn').default;
|
||||
let container;
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
container = TestContainer.get(this);
|
||||
});
|
||||
|
||||
|
@ -41,7 +41,7 @@ describe('Properties Panel for Data Objects', function() {
|
|||
},
|
||||
}));
|
||||
|
||||
it('should allow you to see a list of data objects', async function() {
|
||||
it('should allow you to see a list of data objects', async function () {
|
||||
|
||||
// IF - a data object reference is selected
|
||||
let my_data_ref_1 = await expectSelected('my_data_ref_1');
|
||||
|
@ -58,7 +58,7 @@ describe('Properties Panel for Data Objects', function() {
|
|||
});
|
||||
|
||||
|
||||
it('selecting a different data object should change the data model.', async function() {
|
||||
it('selecting a different data object should change the data model.', async function () {
|
||||
|
||||
// IF - a data object reference is selected
|
||||
let my_data_ref_1 = await expectSelected('my_data_ref_1');
|
||||
|
@ -89,8 +89,8 @@ describe('Properties Panel for Data Objects', function() {
|
|||
// expect(my_data_ref_1.businessObject.dataObjectRef.id).to.equal('my_nifty_new_name');
|
||||
// expect(my_data_ref_1.businessObject.name).to.equal('My Nifty New Name');
|
||||
// });
|
||||
|
||||
it('renaming a data object creates a lable without losing the numbers', async function() {
|
||||
|
||||
it('renaming a data object creates a lable without losing the numbers', async function () {
|
||||
|
||||
// IF - a process is selected, and the name of a data object is changed.
|
||||
let entry = findEntry('ProcessTest-dataObj-2-id', container);
|
||||
|
@ -104,7 +104,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, 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,7 +115,7 @@ describe('Properties Panel for Data Objects', function() {
|
|||
expect(my_data_ref_1.businessObject.name).not.to.equal('My Nifty New Name');
|
||||
});
|
||||
|
||||
it('selecting a different data object should not change the data object reference name.', async function() {
|
||||
it('selecting a different data object should not change the data object reference name.', async function () {
|
||||
|
||||
// IF - a data object reference is selected
|
||||
let my_data_ref_1 = await expectSelected('my_data_ref_1');
|
||||
|
@ -123,7 +123,7 @@ describe('Properties Panel for Data Objects', function() {
|
|||
let entry = findEntry('selectDataObject', container);
|
||||
let selector = findSelect(entry);
|
||||
let businessObject = my_data_ref_1.businessObject;
|
||||
|
||||
|
||||
changeInput(selector, 'my_third_data_object');
|
||||
|
||||
expect(businessObject.get('dataObjectRef').id).to.equal('my_third_data_object');
|
||||
|
@ -131,28 +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) {
|
||||
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