1
0
Fork 0

GraphViewer: The main graphViewer class now knows about the preview adapter

This commit is contained in:
Michael Hackstein 2013-06-27 09:56:58 +02:00
parent 8dd44978cd
commit 4ba6422f2e
2 changed files with 19 additions and 2 deletions

View File

@ -1,6 +1,6 @@
/*jslint indent: 2, nomen: true, maxlen: 100, white: true plusplus: true */
/*global _*/
/*global ArangoAdapter, JSONAdapter, FoxxAdapter */
/*global ArangoAdapter, JSONAdapter, FoxxAdapter, PreviewAdapter */
/*global ForceLayouter, EdgeShaper, NodeShaper, ZoomManager */
////////////////////////////////////////////////////////////////////////////////
/// @brief Graph functionality
@ -139,6 +139,13 @@ function GraphViewer(svg, width, height, adapterConfig, config) {
height
);
break;
case "preview":
self.adapter = new PreviewAdapter(
nodes,
edges,
adapterConfig
);
break;
default:
throw "Sorry unknown adapter type.";
}

View File

@ -127,7 +127,17 @@ describe("Graph Viewer", function() {
);
});
it('should be able to be setup with a preview adapter', function() {
var adapterConfig = {type: "preview"},
gv;
spyOn(window, "PreviewAdapter");
gv = new GraphViewer(svg, 10, 10, adapterConfig);
expect(window.PreviewAdapter).wasCalledWith(
jasmine.any(Array),
jasmine.any(Array),
jasmine.any(Object)
);
});
});
describe('set up correctly', function() {