From e2aaf342f7271d1ee8496d3dab345f1f302197cb Mon Sep 17 00:00:00 2001 From: Nico Rehwaldt Date: Wed, 26 Nov 2014 11:49:14 +0100 Subject: [PATCH] feat(import): wire root element Related to #151 --- lib/import/BpmnImporter.js | 2 ++ test/spec/import/ImporterSpec.js | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/lib/import/BpmnImporter.js b/lib/import/BpmnImporter.js index 7886bc1a..0fa3bbf2 100644 --- a/lib/import/BpmnImporter.js +++ b/lib/import/BpmnImporter.js @@ -62,6 +62,8 @@ BpmnImporter.prototype.add = function(semantic, parentElement) { // add a virtual element (not being drawn) element = this._elementFactory.createRoot(elementData(semantic)); + + this._canvas.setRootElement(element); } // SHAPE diff --git a/test/spec/import/ImporterSpec.js b/test/spec/import/ImporterSpec.js index ac9b3054..66574637 100644 --- a/test/spec/import/ImporterSpec.js +++ b/test/spec/import/ImporterSpec.js @@ -173,6 +173,25 @@ describe('import - importer', function() { }); + it('should wire root element', function() { + + // given + var canvas = diagram.get('canvas'); + + // when + var root = elements[0]; + var anyChild = elements[1]; + + // assume + expect(root.businessObject.$instanceOf('bpmn:Process')).toBe(true); + expect(anyChild.parent).toBe(root); + + // then + expect(canvas.getRootElement()).toBe(root); + expect(canvas.getGraphics('Process_1')).toBe(canvas._svg); + }); + + it('should wire parent child relationship', function() { // when