From 081ff35f5dc76b625d9de1a3e4d740a1b36a1903 Mon Sep 17 00:00:00 2001 From: Michael Hackstein Date: Mon, 22 Jul 2013 14:48:28 +0200 Subject: [PATCH] GraphViewer: All tests pass again --- html/admin/js/graphViewer/graph/JSONAdapter.js | 16 +++++----------- .../jasmine_test/specAdapter/jsonAdapterSpec.js | 2 +- html/admin/js/graphViewer/karma/karma.conf.js | 4 +++- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/html/admin/js/graphViewer/graph/JSONAdapter.js b/html/admin/js/graphViewer/graph/JSONAdapter.js index 4badc4e236..9dd19f7fb1 100644 --- a/html/admin/js/graphViewer/graph/JSONAdapter.js +++ b/html/admin/js/graphViewer/graph/JSONAdapter.js @@ -122,20 +122,12 @@ function JSONAdapter(jsonPath, nodes, edges, width, height) { if (error !== undefined && error !== null) { console.log(error); } - var n = findNode(node); - if (!n) { - n = absAdapter.insertNode(node); - } else { - n.children = node.children; - } + var n = absAdapter.insertNode(node); self.requestCentralityChildren(nodeId, function(c) { n._centrality = c; }); - _.each(n.children, function(c) { - var check = findNode(c), e; - if (!check) { - check = absAdapter.insertNode(c); - } + _.each(node.children, function(c) { + var check = absAdapter.insertNode(c), e = { _from: n._id, _to: check._id, @@ -145,7 +137,9 @@ function JSONAdapter(jsonPath, nodes, edges, width, height) { self.requestCentralityChildren(check._id, function(c) { n._centrality = c; }); + delete check._data.children; }); + delete n._data.children; if (callback) { callback(n); } diff --git a/html/admin/js/graphViewer/jasmine_test/specAdapter/jsonAdapterSpec.js b/html/admin/js/graphViewer/jasmine_test/specAdapter/jsonAdapterSpec.js index bcbb3f0cab..6e007568b4 100644 --- a/html/admin/js/graphViewer/jasmine_test/specAdapter/jsonAdapterSpec.js +++ b/html/admin/js/graphViewer/jasmine_test/specAdapter/jsonAdapterSpec.js @@ -83,7 +83,7 @@ adapter = new JSONAdapter(jsonPath, nodes, edges); }); - it('should be able to load a tree node form a json file', function() { + it('should be able to load a tree node from a json file', function() { var callbackCheck; runs(function() { diff --git a/html/admin/js/graphViewer/karma/karma.conf.js b/html/admin/js/graphViewer/karma/karma.conf.js index 0fadf61251..de6f8f8d16 100644 --- a/html/admin/js/graphViewer/karma/karma.conf.js +++ b/html/admin/js/graphViewer/karma/karma.conf.js @@ -32,6 +32,7 @@ module.exports = function(karma) { // Core Modules '../graphViewer.js', + '../graph/domObserverFactory.js', '../graph/colourMapper.js', '../graph/communityNode.js', '../graph/webWorkerWrapper.js', @@ -63,6 +64,7 @@ module.exports = function(karma) { // Specs 'specColourMapper/colourMapperSpec.js', + 'specWindowObjects/domObserverFactorySpec.js', 'specCommunityNode/communityNodeSpec.js', 'specAdapter/interfaceSpec.js', 'specAdapter/abstractAdapterSpec.js', @@ -87,7 +89,7 @@ module.exports = function(karma) { 'specGraphViewer/graphViewerPreviewSpec.js', 'specNodeReducer/nodeReducerSpec.js', 'specNodeReducer/modularityJoinerSpec.js', - 'specWebWorker/workerWrapperSpec.js', + 'specWindowObjects/workerWrapperSpec.js', 'specJSLint/jsLintSpec.js' ],