From 3a377a3871774a5592956e9c04ce5fc7cda9d388 Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Mon, 17 Nov 2014 17:36:22 +0100 Subject: [PATCH] chore(core/ElementRegistry): pull API changes Related to #153 --- lib/draw/BpmnRenderer.js | 2 +- lib/import/BpmnImporter.js | 3 +- test/spec/ViewerSpec.js | 2 +- .../label-editing/LabelEditingProviderSpec.js | 16 ++--- .../spec/features/modeling/AppendShapeSpec.js | 70 +++++++++---------- .../features/modeling/CreateConnectionSpec.js | 12 ++-- .../features/modeling/DeleteConnectionSpec.js | 6 +- .../spec/features/modeling/DeleteShapeSpec.js | 6 +- .../features/modeling/LayoutConnectionSpec.js | 6 +- .../features/modeling/MoveConnectionSpec.js | 6 +- test/spec/features/modeling/MoveShapeSpec.js | 16 ++--- test/spec/import/ImporterSpec.js | 2 +- test/spec/import/elements/AssociationSpec.js | 12 ++-- test/spec/import/elements/CollapsedSpec.js | 42 +++++------ test/spec/import/elements/LabelSpec.js | 4 +- 15 files changed, 103 insertions(+), 102 deletions(-) diff --git a/lib/draw/BpmnRenderer.js b/lib/draw/BpmnRenderer.js index 40ec51d2..a8ee6783 100644 --- a/lib/draw/BpmnRenderer.js +++ b/lib/draw/BpmnRenderer.js @@ -1509,4 +1509,4 @@ BpmnRenderer.prototype = Object.create(DefaultRenderer.prototype); BpmnRenderer.$inject = [ 'eventBus', 'styles', 'pathMap' ]; -module.exports = BpmnRenderer; +module.exports = BpmnRenderer; \ No newline at end of file diff --git a/lib/import/BpmnImporter.js b/lib/import/BpmnImporter.js index 493e2f83..7886bc1a 100644 --- a/lib/import/BpmnImporter.js +++ b/lib/import/BpmnImporter.js @@ -106,6 +106,7 @@ BpmnImporter.prototype.add = function(semantic, parentElement) { this.addLabel(semantic, element); } + this._eventBus.fire('bpmnElement.added', { element: element }); return element; @@ -183,5 +184,5 @@ BpmnImporter.prototype._getTarget = function(semantic) { BpmnImporter.prototype._getElement = function(semantic) { - return this._elementRegistry.getById(semantic.id); + return this._elementRegistry.get(semantic.id); }; \ No newline at end of file diff --git a/test/spec/ViewerSpec.js b/test/spec/ViewerSpec.js index d83a18e2..5981e3f7 100644 --- a/test/spec/ViewerSpec.js +++ b/test/spec/ViewerSpec.js @@ -104,7 +104,7 @@ describe('viewer', function() { expect(elementRegistry).toBeDefined(); // given - var subProcessShape = elementRegistry.getById('SubProcess_1'); + var subProcessShape = elementRegistry.get('SubProcess_1'); // when overlays.add('SubProcess_1', { diff --git a/test/spec/features/label-editing/LabelEditingProviderSpec.js b/test/spec/features/label-editing/LabelEditingProviderSpec.js index 8e54e644..9cf2eb77 100644 --- a/test/spec/features/label-editing/LabelEditingProviderSpec.js +++ b/test/spec/features/label-editing/LabelEditingProviderSpec.js @@ -34,7 +34,7 @@ describe('features - label-editing', function() { it('should register on dblclick', inject(function(elementRegistry, directEditing, eventBus) { // given - var shape = elementRegistry.getById('task-nested-embedded'); + var shape = elementRegistry.get('task-nested-embedded'); // when eventBus.fire('shape.dblclick', { element: shape }); @@ -47,7 +47,7 @@ describe('features - label-editing', function() { it('should cancel on ', inject(function(elementRegistry, directEditing, eventBus) { // given - var shape = elementRegistry.getById('task-nested-embedded'), + var shape = elementRegistry.get('task-nested-embedded'), task = shape.businessObject; var oldName = task.name; @@ -72,7 +72,7 @@ describe('features - label-editing', function() { it('should submit on ', inject(function(elementRegistry, directEditing, eventBus) { // given - var shape = elementRegistry.getById('task-nested-embedded'), + var shape = elementRegistry.get('task-nested-embedded'), task = shape.businessObject; // activate @@ -136,7 +136,7 @@ describe('features - label-editing', function() { it('should update via command stack', function() { // given - var diagramElement = elementRegistry.getById('user-task'); + var diagramElement = elementRegistry.get('user-task'); var listenerCalled; @@ -156,7 +156,7 @@ describe('features - label-editing', function() { it('should undo via command stack', inject(function(commandStack) { // given - var diagramElement = elementRegistry.getById('user-task'); + var diagramElement = elementRegistry.get('user-task'); var oldLabel = LabelUtil.getLabel(diagramElement); @@ -179,7 +179,7 @@ describe('features - label-editing', function() { it('on shape change', function() { // given - var diagramElement = elementRegistry.getById('user-task'); + var diagramElement = elementRegistry.get('user-task'); var listenerCalled; @@ -201,7 +201,7 @@ describe('features - label-editing', function() { it('on connection on change', function() { // given - var diagramElement = elementRegistry.getById('sequence-flow-no'); + var diagramElement = elementRegistry.get('sequence-flow-no'); var listenerCalled; @@ -228,7 +228,7 @@ describe('features - label-editing', function() { return inject(function(elementRegistry, eventBus, directEditing) { - var diagramElement = elementRegistry.getById(elementId); + var diagramElement = elementRegistry.get(elementId); var label = LabelUtil.getLabel(diagramElement); diff --git a/test/spec/features/modeling/AppendShapeSpec.js b/test/spec/features/modeling/AppendShapeSpec.js index c7e6f845..052ef18e 100644 --- a/test/spec/features/modeling/AppendShapeSpec.js +++ b/test/spec/features/modeling/AppendShapeSpec.js @@ -33,7 +33,7 @@ describe('features/modeling - append shape', function() { it('should execute', inject(function(elementRegistry, modeling) { // given - var startEventShape = elementRegistry.getById('StartEvent_1'); + var startEventShape = elementRegistry.get('StartEvent_1'); // when var targetShape = modeling.appendFlowNode(startEventShape, 'bpmn:Task'), @@ -48,8 +48,8 @@ describe('features/modeling - append shape', function() { it('should create DI', inject(function(elementRegistry, modeling) { // given - var startEventShape = elementRegistry.getById('StartEvent_1'); - var subProcessShape = elementRegistry.getById('SubProcess_1'); + var startEventShape = elementRegistry.get('StartEvent_1'); + var subProcessShape = elementRegistry.get('SubProcess_1'); var startEvent = startEventShape.businessObject, subProcess = subProcessShape.businessObject; @@ -72,8 +72,8 @@ describe('features/modeling - append shape', function() { it('should add to parent (sub process)', inject(function(elementRegistry, modeling) { // given - var startEventShape = elementRegistry.getById('StartEvent_1'); - var subProcessShape = elementRegistry.getById('SubProcess_1'); + var startEventShape = elementRegistry.get('StartEvent_1'); + var subProcessShape = elementRegistry.get('SubProcess_1'); var startEvent = startEventShape.businessObject, subProcess = subProcessShape.businessObject; @@ -92,8 +92,8 @@ describe('features/modeling - append shape', function() { it('correctly wired and positioned', inject(function(elementRegistry, modeling, commandStack) { // given - var startEventShape = elementRegistry.getById('StartEvent_1'); - var subProcessShape = elementRegistry.getById('SubProcess_1'); + var startEventShape = elementRegistry.get('StartEvent_1'); + var subProcessShape = elementRegistry.get('SubProcess_1'); var startEvent = startEventShape.businessObject, subProcess = subProcessShape.businessObject; @@ -106,7 +106,7 @@ describe('features/modeling - append shape', function() { // then expect(label).toBeDefined(); - expect(elementRegistry.getById(label.id)).toBeDefined(); + expect(elementRegistry.get(label.id)).toBeDefined(); expect(label.x).toBe(443); expect(label.y).toBe(278); @@ -118,8 +118,8 @@ describe('features/modeling - append shape', function() { it('with di', inject(function(elementRegistry, modeling, commandStack) { // given - var startEventShape = elementRegistry.getById('StartEvent_1'); - var subProcessShape = elementRegistry.getById('SubProcess_1'); + var startEventShape = elementRegistry.get('StartEvent_1'); + var subProcessShape = elementRegistry.get('SubProcess_1'); var startEvent = startEventShape.businessObject, subProcess = subProcessShape.businessObject; @@ -143,8 +143,8 @@ describe('features/modeling - append shape', function() { it('should add connection', inject(function(elementRegistry, modeling) { // given - var startEventShape = elementRegistry.getById('StartEvent_1'); - var subProcessShape = elementRegistry.getById('SubProcess_1'); + var startEventShape = elementRegistry.get('StartEvent_1'); + var subProcessShape = elementRegistry.get('SubProcess_1'); var startEvent = startEventShape.businessObject, subProcess = subProcessShape.businessObject; @@ -170,8 +170,8 @@ describe('features/modeling - append shape', function() { it('should undo add to parent', inject(function(elementRegistry, modeling, commandStack) { // given - var startEventShape = elementRegistry.getById('StartEvent_1'); - var subProcessShape = elementRegistry.getById('SubProcess_1'); + var startEventShape = elementRegistry.get('StartEvent_1'); + var subProcessShape = elementRegistry.get('SubProcess_1'); var startEvent = startEventShape.businessObject, subProcess = subProcessShape.businessObject; @@ -191,8 +191,8 @@ describe('features/modeling - append shape', function() { it('should undo add shape label', inject(function(elementRegistry, modeling, commandStack) { // given - var startEventShape = elementRegistry.getById('StartEvent_1'); - var subProcessShape = elementRegistry.getById('SubProcess_1'); + var startEventShape = elementRegistry.get('StartEvent_1'); + var subProcessShape = elementRegistry.get('SubProcess_1'); var startEvent = startEventShape.businessObject, subProcess = subProcessShape.businessObject; @@ -214,15 +214,15 @@ describe('features/modeling - append shape', function() { expect(subProcess.di.$parent.get('planeElement')).not.toContain(connection.di); expect(targetShape.label).not.toBeDefined(); - expect(elementRegistry.getById(target.id + '_label')).not.toBeDefined(); + expect(elementRegistry.get(target.id + '_label')).not.toBeDefined(); })); it('should undo add connection', inject(function(elementRegistry, modeling, commandStack) { // given - var startEventShape = elementRegistry.getById('StartEvent_1'); - var subProcessShape = elementRegistry.getById('SubProcess_1'); + var startEventShape = elementRegistry.get('StartEvent_1'); + var subProcessShape = elementRegistry.get('SubProcess_1'); var startEvent = startEventShape.businessObject, subProcess = subProcessShape.businessObject; @@ -247,15 +247,15 @@ describe('features/modeling - append shape', function() { expect(connection.$parent).toBe(null); expect(subProcess.di.$parent.get('planeElement')).not.toContain(connection.di); - expect(elementRegistry.getById(targetShape.id)).not.toBeDefined(); + expect(elementRegistry.get(targetShape.id)).not.toBeDefined(); })); it('should undo add connection label', inject(function(elementRegistry, modeling, commandStack) { // given - var startEventShape = elementRegistry.getById('StartEvent_1'); - var subProcessShape = elementRegistry.getById('SubProcess_1'); + var startEventShape = elementRegistry.get('StartEvent_1'); + var subProcessShape = elementRegistry.get('SubProcess_1'); var startEvent = startEventShape.businessObject, subProcess = subProcessShape.businessObject; @@ -276,15 +276,15 @@ describe('features/modeling - append shape', function() { expect(connection.$parent).toBe(null); expect(subProcess.di.$parent.get('planeElement')).not.toContain(connection.di); - expect(elementRegistry.getById(connection.id + '_label')).not.toBeDefined(); + expect(elementRegistry.get(connection.id + '_label')).not.toBeDefined(); })); it('should redo appending multiple shapes', inject(function(elementRegistry, modeling, commandStack) { // given - var startEventShape = elementRegistry.getById('StartEvent_1'); - var subProcessShape = elementRegistry.getById('SubProcess_1'); + var startEventShape = elementRegistry.get('StartEvent_1'); + var subProcessShape = elementRegistry.get('SubProcess_1'); var startEvent = startEventShape.businessObject, subProcess = subProcessShape.businessObject; @@ -310,15 +310,15 @@ describe('features/modeling - append shape', function() { // then expect(targetShape2.parent).toBe(null); - expect(elementRegistry.getById(targetShape2.id)).not.toBeDefined(); + expect(elementRegistry.get(targetShape2.id)).not.toBeDefined(); })); it('should redo add connection', inject(function(elementRegistry, modeling, commandStack) { // given - var startEventShape = elementRegistry.getById('StartEvent_1'); - var subProcessShape = elementRegistry.getById('SubProcess_1'); + var startEventShape = elementRegistry.get('StartEvent_1'); + var subProcessShape = elementRegistry.get('SubProcess_1'); var startEvent = startEventShape.businessObject, subProcess = subProcessShape.businessObject; @@ -353,7 +353,7 @@ describe('features/modeling - append shape', function() { it('should wire connection source + target', inject(function(elementRegistry, modeling) { // given - var startEventShape = elementRegistry.getById('StartEvent_1'); + var startEventShape = elementRegistry.get('StartEvent_1'); // when var targetShape = modeling.appendTextAnnotation(startEventShape, 'bpmn:TextAnnotation'), @@ -378,7 +378,7 @@ describe('features/modeling - append shape', function() { it('should undo wire connection source + target', inject(function(elementRegistry, modeling, commandStack) { // given - var startEventShape = elementRegistry.getById('StartEvent_1'); + var startEventShape = elementRegistry.get('StartEvent_1'); var targetShape = modeling.appendTextAnnotation(startEventShape, 'bpmn:TextAnnotation'), target = targetShape.businessObject; @@ -405,7 +405,7 @@ describe('features/modeling - append shape', function() { it('should append', inject(function(elementRegistry, modeling) { // given - var startEventShape = elementRegistry.getById('StartEvent_1'); + var startEventShape = elementRegistry.get('StartEvent_1'); // when var targetShape = modeling.appendFlowNode(startEventShape, 'bpmn:ExclusiveGateway'), @@ -420,8 +420,8 @@ describe('features/modeling - append shape', function() { it('should add to parent (sub process)', inject(function(elementRegistry, modeling) { // given - var startEventShape = elementRegistry.getById('StartEvent_1'); - var subProcessShape = elementRegistry.getById('SubProcess_1'); + var startEventShape = elementRegistry.get('StartEvent_1'); + var subProcessShape = elementRegistry.get('SubProcess_1'); var startEvent = startEventShape.businessObject, subProcess = subProcessShape.businessObject; @@ -438,8 +438,8 @@ describe('features/modeling - append shape', function() { it('should undo append', inject(function(elementRegistry, modeling, commandStack) { // given - var startEventShape = elementRegistry.getById('StartEvent_1'); - var subProcessShape = elementRegistry.getById('SubProcess_1'); + var startEventShape = elementRegistry.get('StartEvent_1'); + var subProcessShape = elementRegistry.get('SubProcess_1'); var startEvent = startEventShape.businessObject, subProcess = subProcessShape.businessObject; diff --git a/test/spec/features/modeling/CreateConnectionSpec.js b/test/spec/features/modeling/CreateConnectionSpec.js index 2e549ee4..addb010d 100644 --- a/test/spec/features/modeling/CreateConnectionSpec.js +++ b/test/spec/features/modeling/CreateConnectionSpec.js @@ -30,9 +30,9 @@ describe('features/modeling - create connection', function() { it('should execute', inject(function(elementRegistry, modeling) { // given - var taskShape = elementRegistry.getById('Task_1'), + var taskShape = elementRegistry.get('Task_1'), task = taskShape.businessObject, - gatewayShape = elementRegistry.getById('Gateway_1'), + gatewayShape = elementRegistry.get('Gateway_1'), gateway = gatewayShape.businessObject; @@ -81,9 +81,9 @@ describe('features/modeling - create connection', function() { it('should undo', inject(function(elementRegistry, commandStack, modeling) { // given - var taskShape = elementRegistry.getById('Task_1'), + var taskShape = elementRegistry.get('Task_1'), task = taskShape.businessObject, - gatewayShape = elementRegistry.getById('Gateway_1'), + gatewayShape = elementRegistry.get('Gateway_1'), gateway = gatewayShape.businessObject; @@ -113,9 +113,9 @@ describe('features/modeling - create connection', function() { it('should redo', inject(function(elementRegistry, commandStack, modeling) { // given - var taskShape = elementRegistry.getById('Task_1'), + var taskShape = elementRegistry.get('Task_1'), task = taskShape.businessObject, - gatewayShape = elementRegistry.getById('Gateway_1'), + gatewayShape = elementRegistry.get('Gateway_1'), gateway = gatewayShape.businessObject; diff --git a/test/spec/features/modeling/DeleteConnectionSpec.js b/test/spec/features/modeling/DeleteConnectionSpec.js index 7e40989e..65df76f7 100644 --- a/test/spec/features/modeling/DeleteConnectionSpec.js +++ b/test/spec/features/modeling/DeleteConnectionSpec.js @@ -30,7 +30,7 @@ describe('features/modeling - #removeConnection', function() { it('should execute', inject(function(elementRegistry, modeling) { // given - var sequenceFlowShape = elementRegistry.getById('SequenceFlow_2'), + var sequenceFlowShape = elementRegistry.get('SequenceFlow_2'), sequenceFlow = sequenceFlowShape.businessObject; // when @@ -47,7 +47,7 @@ describe('features/modeling - #removeConnection', function() { it('should undo', inject(function(elementRegistry, modeling, commandStack) { // given - var sequenceFlowShape = elementRegistry.getById('SequenceFlow_2'), + var sequenceFlowShape = elementRegistry.get('SequenceFlow_2'), sequenceFlow = sequenceFlowShape.businessObject, parent = sequenceFlow.$parent; @@ -66,7 +66,7 @@ describe('features/modeling - #removeConnection', function() { it('redo', inject(function(elementRegistry, modeling, commandStack) { // given - var sequenceFlowShape = elementRegistry.getById('SequenceFlow_2'), + var sequenceFlowShape = elementRegistry.get('SequenceFlow_2'), sequenceFlow = sequenceFlowShape.businessObject, parent = sequenceFlow.$parent; diff --git a/test/spec/features/modeling/DeleteShapeSpec.js b/test/spec/features/modeling/DeleteShapeSpec.js index f9ea7c6f..a84fe586 100644 --- a/test/spec/features/modeling/DeleteShapeSpec.js +++ b/test/spec/features/modeling/DeleteShapeSpec.js @@ -30,7 +30,7 @@ describe('features/modeling - #removeShape', function() { it('should execute', inject(function(elementRegistry, modeling) { // given - var taskShape = elementRegistry.getById('Task_1'), + var taskShape = elementRegistry.get('Task_1'), task = taskShape.businessObject; // when @@ -47,7 +47,7 @@ describe('features/modeling - #removeShape', function() { it('should undo', inject(function(elementRegistry, modeling, commandStack) { // given - var taskShape = elementRegistry.getById('Task_1'), + var taskShape = elementRegistry.get('Task_1'), task = taskShape.businessObject, parent = task.$parent; @@ -66,7 +66,7 @@ describe('features/modeling - #removeShape', function() { it('redo', inject(function(elementRegistry, modeling, commandStack) { // given - var taskShape = elementRegistry.getById('Task_1'), + var taskShape = elementRegistry.get('Task_1'), task = taskShape.businessObject, parent = task.$parent; diff --git a/test/spec/features/modeling/LayoutConnectionSpec.js b/test/spec/features/modeling/LayoutConnectionSpec.js index 25f5cf1d..4fe97fd9 100644 --- a/test/spec/features/modeling/LayoutConnectionSpec.js +++ b/test/spec/features/modeling/LayoutConnectionSpec.js @@ -30,7 +30,7 @@ describe('features/modeling - layout connection', function() { it('should execute', inject(function(elementRegistry, modeling) { // given - var sequenceFlowConnection = elementRegistry.getById('SequenceFlow_1'), + var sequenceFlowConnection = elementRegistry.get('SequenceFlow_1'), sequenceFlow = sequenceFlowConnection.businessObject; // when @@ -63,7 +63,7 @@ describe('features/modeling - layout connection', function() { it('should undo', inject(function(elementRegistry, commandStack, modeling) { // given - var sequenceFlowConnection = elementRegistry.getById('SequenceFlow_1'), + var sequenceFlowConnection = elementRegistry.get('SequenceFlow_1'), sequenceFlow = sequenceFlowConnection.businessObject; var oldWaypoints = sequenceFlowConnection.waypoints, @@ -87,7 +87,7 @@ describe('features/modeling - layout connection', function() { it('should redo', inject(function(elementRegistry, commandStack, modeling) { // given - var sequenceFlowConnection = elementRegistry.getById('SequenceFlow_1'), + var sequenceFlowConnection = elementRegistry.get('SequenceFlow_1'), sequenceFlow = sequenceFlowConnection.businessObject; modeling.layoutConnection(sequenceFlowConnection); diff --git a/test/spec/features/modeling/MoveConnectionSpec.js b/test/spec/features/modeling/MoveConnectionSpec.js index c16e48bc..b782883f 100644 --- a/test/spec/features/modeling/MoveConnectionSpec.js +++ b/test/spec/features/modeling/MoveConnectionSpec.js @@ -30,7 +30,7 @@ describe('features/modeling - move connection', function() { it('should execute', inject(function(elementRegistry, modeling) { // given - var sequenceFlowConnection = elementRegistry.getById('SequenceFlow_1'), + var sequenceFlowConnection = elementRegistry.get('SequenceFlow_1'), sequenceFlow = sequenceFlowConnection.businessObject; // when @@ -63,7 +63,7 @@ describe('features/modeling - move connection', function() { it('should undo', inject(function(elementRegistry, commandStack, modeling) { // given - var sequenceFlowConnection = elementRegistry.getById('SequenceFlow_1'), + var sequenceFlowConnection = elementRegistry.get('SequenceFlow_1'), sequenceFlow = sequenceFlowConnection.businessObject; var oldWaypoints = sequenceFlowConnection.waypoints, @@ -87,7 +87,7 @@ describe('features/modeling - move connection', function() { it('should redo', inject(function(elementRegistry, commandStack, modeling) { // given - var sequenceFlowConnection = elementRegistry.getById('SequenceFlow_1'), + var sequenceFlowConnection = elementRegistry.get('SequenceFlow_1'), sequenceFlow = sequenceFlowConnection.businessObject; modeling.moveConnection(sequenceFlowConnection, { x: 20, y: 10 }); diff --git a/test/spec/features/modeling/MoveShapeSpec.js b/test/spec/features/modeling/MoveShapeSpec.js index 1ecdbdf4..fc65a857 100644 --- a/test/spec/features/modeling/MoveShapeSpec.js +++ b/test/spec/features/modeling/MoveShapeSpec.js @@ -30,10 +30,10 @@ describe('features/modeling - move shape', function() { it('should execute', inject(function(elementRegistry, modeling) { // given - var startEventElement = elementRegistry.getById('StartEvent_1'), + var startEventElement = elementRegistry.get('StartEvent_1'), startEvent = startEventElement.businessObject; - var sequenceFlowElement = elementRegistry.getById('SequenceFlow_1'), + var sequenceFlowElement = elementRegistry.get('SequenceFlow_1'), sequenceFlow = sequenceFlowElement.businessObject; var oldPosition = { @@ -68,7 +68,7 @@ describe('features/modeling - move shape', function() { it('should execute on label', inject(function(elementRegistry, modeling) { // given - var labelElement = elementRegistry.getById('StartEvent_1_label'), + var labelElement = elementRegistry.get('StartEvent_1_label'), startEvent = labelElement.businessObject; var oldPosition = { @@ -88,7 +88,7 @@ describe('features/modeling - move shape', function() { it('should move label with element', inject(function(elementRegistry, modeling) { // given - var startEventElement = elementRegistry.getById('StartEvent_1'), + var startEventElement = elementRegistry.get('StartEvent_1'), startEvent = startEventElement.businessObject; var label = startEventElement.label; @@ -114,7 +114,7 @@ describe('features/modeling - move shape', function() { it('should undo', inject(function(elementRegistry, commandStack, modeling) { // given - var startEventElement = elementRegistry.getById('StartEvent_1'), + var startEventElement = elementRegistry.get('StartEvent_1'), startEvent = startEventElement.businessObject; var oldPosition = { @@ -136,7 +136,7 @@ describe('features/modeling - move shape', function() { it('should undo on label', inject(function(elementRegistry, commandStack, modeling) { // given - var labelElement = elementRegistry.getById('StartEvent_1_label'), + var labelElement = elementRegistry.get('StartEvent_1_label'), startEvent = labelElement.businessObject; var oldPosition = { @@ -162,7 +162,7 @@ describe('features/modeling - move shape', function() { it('should redo', inject(function(elementRegistry, commandStack, modeling) { // given - var startEventElement = elementRegistry.getById('StartEvent_1'), + var startEventElement = elementRegistry.get('StartEvent_1'), startEvent = startEventElement.businessObject; @@ -186,7 +186,7 @@ describe('features/modeling - move shape', function() { it('should redo on label', inject(function(elementRegistry, commandStack, modeling) { // given - var labelElement = elementRegistry.getById('StartEvent_1_label'), + var labelElement = elementRegistry.get('StartEvent_1_label'), startEvent = labelElement.businessObject; modeling.moveShape(labelElement, { x: 0, y: 50 }); diff --git a/test/spec/import/ImporterSpec.js b/test/spec/import/ImporterSpec.js index c32b57bc..ac9b3054 100644 --- a/test/spec/import/ImporterSpec.js +++ b/test/spec/import/ImporterSpec.js @@ -268,7 +268,7 @@ describe('import - importer', function() { var elementRegistry = diagram.get('elementRegistry'); - var element = elementRegistry.getById('GATEWAY_1'); + var element = elementRegistry.get('GATEWAY_1'); expect(element.businessObject.eventGatewayType).toEqual('Exclusive'); diff --git a/test/spec/import/elements/AssociationSpec.js b/test/spec/import/elements/AssociationSpec.js index 143ba992..e8af83ed 100644 --- a/test/spec/import/elements/AssociationSpec.js +++ b/test/spec/import/elements/AssociationSpec.js @@ -28,7 +28,7 @@ describe('import - associations', function() { // when inject(function(elementRegistry) { - var association = elementRegistry.getById('Association_1'); + var association = elementRegistry.get('Association_1'); // then expect(association).toBeDefined(); @@ -54,7 +54,7 @@ describe('import - associations', function() { // when inject(function(elementRegistry) { - var association = elementRegistry.getById('Association_1'); + var association = elementRegistry.get('Association_1'); // then expect(association).toBeDefined(); @@ -84,8 +84,8 @@ describe('import - associations', function() { // when inject(function(elementRegistry) { - var dataInputAssociation = elementRegistry.getById('DataInputAssociation_1'); - var dataOutputAssociation = elementRegistry.getById('DataOutputAssociation_1'); + var dataInputAssociation = elementRegistry.get('DataInputAssociation_1'); + var dataOutputAssociation = elementRegistry.get('DataOutputAssociation_1'); // then expect(dataInputAssociation).toBeDefined(); @@ -112,8 +112,8 @@ describe('import - associations', function() { // when inject(function(elementRegistry) { - var dataInputAssociation = elementRegistry.getById('DataInputAssociation_1'); - var dataOutputAssociation = elementRegistry.getById('DataOutputAssociation_1'); + var dataInputAssociation = elementRegistry.get('DataInputAssociation_1'); + var dataOutputAssociation = elementRegistry.get('DataOutputAssociation_1'); // then expect(dataInputAssociation).toBeDefined(); diff --git a/test/spec/import/elements/CollapsedSpec.js b/test/spec/import/elements/CollapsedSpec.js index e80d402a..19e8b587 100644 --- a/test/spec/import/elements/CollapsedSpec.js +++ b/test/spec/import/elements/CollapsedSpec.js @@ -22,8 +22,8 @@ describe('import - collapsed container', function() { it('should import collapsed subProcess', inject(function(elementRegistry) { - var collapsedShape = elementRegistry.getById('SubProcess_1'); - var childShape = elementRegistry.getById('IntermediateCatchEvent_1'); + var collapsedShape = elementRegistry.get('SubProcess_1'); + var childShape = elementRegistry.get('IntermediateCatchEvent_1'); expect(collapsedShape.collapsed).toBe(true); expect(childShape.hidden).toBe(true); @@ -31,8 +31,8 @@ describe('import - collapsed container', function() { it('should import collapsed transaction', inject(function(elementRegistry) { - var collapsedShape = elementRegistry.getById('Transaction_1'); - var childShape = elementRegistry.getById('UserTask_1'); + var collapsedShape = elementRegistry.get('Transaction_1'); + var childShape = elementRegistry.get('UserTask_1'); expect(collapsedShape.collapsed).toBe(true); expect(childShape.hidden).toBe(true); @@ -40,8 +40,8 @@ describe('import - collapsed container', function() { it('should import collapsed adhocSubProcess', inject(function(elementRegistry) { - var collapsedShape = elementRegistry.getById('AdHocSubProcess_1'); - var childShape = elementRegistry.getById('StartEvent_1'); + var collapsedShape = elementRegistry.get('AdHocSubProcess_1'); + var childShape = elementRegistry.get('StartEvent_1'); expect(collapsedShape.collapsed).toBe(true); expect(childShape.hidden).toBe(true); @@ -49,9 +49,9 @@ describe('import - collapsed container', function() { it('should import collapsed with nested elements', inject(function(elementRegistry) { - var collapsedShape = elementRegistry.getById('SubProcess_4'); - var childShape = elementRegistry.getById('SubProcess_5'); - var nestedChildShape = elementRegistry.getById('Task_3'); + var collapsedShape = elementRegistry.get('SubProcess_4'); + var childShape = elementRegistry.get('SubProcess_5'); + var nestedChildShape = elementRegistry.get('Task_3'); expect(collapsedShape.collapsed).toBe(true); expect(childShape.hidden).toBe(true); @@ -60,17 +60,17 @@ describe('import - collapsed container', function() { it('should import collapsed with nested elements', inject(function(elementRegistry) { - var hiddenEventShape = elementRegistry.getById('StartEvent_2'); + var hiddenEventShape = elementRegistry.get('StartEvent_2'); expect(hiddenEventShape.label.hidden).toBe(true); - var hiddenDataShape = elementRegistry.getById('DataObjectReference_1'); + var hiddenDataShape = elementRegistry.get('DataObjectReference_1'); expect(hiddenDataShape.label.hidden).toBe(true); })); it('should import expanded subProcess', inject(function(elementRegistry) { - var expandedShape = elementRegistry.getById('SubProcess_3'); - var childShape = elementRegistry.getById('Task_2'); + var expandedShape = elementRegistry.get('SubProcess_3'); + var childShape = elementRegistry.get('Task_2'); expect(expandedShape.collapsed).toBe(false); expect(childShape.hidden).toBe(false); @@ -87,8 +87,8 @@ describe('import - collapsed container', function() { it('should import collapsed subProcess in pool', inject(function(elementRegistry) { - var expandedShape = elementRegistry.getById('SubProcess_1'); - var childShape = elementRegistry.getById('Task_1'); + var expandedShape = elementRegistry.get('SubProcess_1'); + var childShape = elementRegistry.get('Task_1'); expect(expandedShape.collapsed).toBe(true); expect(childShape.hidden).toBe(true); @@ -96,8 +96,8 @@ describe('import - collapsed container', function() { it('should import expanded subProcess in pool', inject(function(elementRegistry) { - var expandedShape = elementRegistry.getById('SubProcess_2'); - var childShape = elementRegistry.getById('StartEvent_1'); + var expandedShape = elementRegistry.get('SubProcess_2'); + var childShape = elementRegistry.get('StartEvent_1'); expect(expandedShape.collapsed).toBe(false); expect(childShape.hidden).toBe(false); @@ -105,8 +105,8 @@ describe('import - collapsed container', function() { it('should import collapsed subProcess in lane', inject(function(elementRegistry) { - var expandedShape = elementRegistry.getById('SubProcess_4'); - var childShape = elementRegistry.getById('Task_2'); + var expandedShape = elementRegistry.get('SubProcess_4'); + var childShape = elementRegistry.get('Task_2'); expect(expandedShape.collapsed).toBe(true); expect(childShape.hidden).toBe(true); @@ -114,8 +114,8 @@ describe('import - collapsed container', function() { it('should import expanded subProcess in lane', inject(function(elementRegistry) { - var expandedShape = elementRegistry.getById('SubProcess_3'); - var childShape = elementRegistry.getById('StartEvent_2'); + var expandedShape = elementRegistry.get('SubProcess_3'); + var childShape = elementRegistry.get('StartEvent_2'); expect(expandedShape.collapsed).toBe(false); expect(childShape.hidden).toBe(false); diff --git a/test/spec/import/elements/LabelSpec.js b/test/spec/import/elements/LabelSpec.js index b0e2b603..cf9a6edd 100644 --- a/test/spec/import/elements/LabelSpec.js +++ b/test/spec/import/elements/LabelSpec.js @@ -55,8 +55,8 @@ describe('import - labels', function() { // when inject(function(elementRegistry) { - var endEvent = elementRegistry.getById('EndEvent_1'), - sequenceFlow = elementRegistry.getById('SequenceFlow_1'); + var endEvent = elementRegistry.get('EndEvent_1'), + sequenceFlow = elementRegistry.get('SequenceFlow_1'); // then expect(bounds(endEvent.label)).toEqual({ x: 211, y: 256, width: 119, height: 44 });