feat(import): wire root element

Related to #151
This commit is contained in:
Nico Rehwaldt 2014-11-26 11:49:14 +01:00
parent 1c6058e6cb
commit e2aaf342f7
2 changed files with 21 additions and 0 deletions

View File

@ -62,6 +62,8 @@ BpmnImporter.prototype.add = function(semantic, parentElement) {
// add a virtual element (not being drawn) // add a virtual element (not being drawn)
element = this._elementFactory.createRoot(elementData(semantic)); element = this._elementFactory.createRoot(elementData(semantic));
this._canvas.setRootElement(element);
} }
// SHAPE // SHAPE

View File

@ -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() { it('should wire parent child relationship', function() {
// when // when