parent
824d8c209a
commit
eefa78240b
|
@ -7,7 +7,7 @@ import { isExpanded } from '../../../util/DiUtil';
|
|||
import { getBusinessObject, is } from '../../../util/ModelUtil';
|
||||
import { getMid } from 'diagram-js/lib/layout/LayoutUtil';
|
||||
import { getBBox } from 'diagram-js/lib/util/Elements';
|
||||
import { asPlaneId, planeId } from '../../../util/DrilldownUtil';
|
||||
import { asPlaneId, isPlane, planeId } from '../../../util/DrilldownUtil';
|
||||
|
||||
|
||||
var LOW_PRIORITY = 400;
|
||||
|
@ -158,12 +158,12 @@ export default function SubProcessPlaneBehavior(
|
|||
}, true);
|
||||
|
||||
|
||||
// rename secondary elements (roots) when the primary element changes
|
||||
// rename primary elements when the secondary element changes
|
||||
// this ensures rootElement.id = element.id + '_plane'
|
||||
this.executed('element.updateProperties', function(context) {
|
||||
var shape = context.element;
|
||||
|
||||
if (!isCollapsedSubProcess(shape)) {
|
||||
if (!is(shape, 'bpmn:SubProcess')) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -177,13 +177,20 @@ export default function SubProcessPlaneBehavior(
|
|||
return;
|
||||
}
|
||||
|
||||
if (isPlane(shape)) {
|
||||
elementRegistry.updateId(shape, asPlaneId(newId));
|
||||
elementRegistry.updateId(oldId, newId);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var planeElement = elementRegistry.get(asPlaneId(oldId));
|
||||
|
||||
if (!planeElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
elementRegistry.updateId(planeElement, asPlaneId(newId));
|
||||
elementRegistry.updateId(asPlaneId(oldId), asPlaneId(newId));
|
||||
}, true);
|
||||
|
||||
|
||||
|
|
|
@ -262,6 +262,53 @@ describe('features/modeling/behavior - subprocess planes', function() {
|
|||
|
||||
});
|
||||
|
||||
|
||||
describe('update', function() {
|
||||
|
||||
var multipleDiagramXML = require('./SubProcessBehavior.multiple-planes.bpmn');
|
||||
|
||||
beforeEach(bootstrapModeler(multipleDiagramXML, {
|
||||
modules: [
|
||||
coreModule,
|
||||
modelingModule,
|
||||
replaceModule
|
||||
]
|
||||
}));
|
||||
|
||||
|
||||
it('should update plane id when primary shape is changed',
|
||||
inject(function(modeling, elementRegistry) {
|
||||
|
||||
// given
|
||||
var subProcess = elementRegistry.get('SubProcess_2'),
|
||||
plane = elementRegistry.get('SubProcess_2_plane');
|
||||
|
||||
// when
|
||||
modeling.updateProperties(subProcess, { id: 'new_name' });
|
||||
|
||||
// then
|
||||
expect(subProcess.id).to.equal('new_name');
|
||||
expect(plane.id).to.equal('new_name_plane');
|
||||
}));
|
||||
|
||||
|
||||
it('should update primary shape id when plane is changed',
|
||||
inject(function(modeling, elementRegistry) {
|
||||
|
||||
// given
|
||||
var subProcess = elementRegistry.get('SubProcess_2'),
|
||||
plane = elementRegistry.get('SubProcess_2_plane');
|
||||
|
||||
// when
|
||||
modeling.updateProperties(plane, { id: 'new_name' });
|
||||
|
||||
// then
|
||||
expect(subProcess.id).to.equal('new_name');
|
||||
expect(plane.id).to.equal('new_name_plane');
|
||||
}));
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue