+ describe('init', function () {
+ it('appends the svg', function () {
+ var radarGraph, selection;
+
+ radarGraph = new tr.graphing.Radar(500, radar);
+ selection = { append: jasmine.createSpy() };
+ spyOn(d3, 'select').andReturn(selection);
+
+ radarGraph.init();
+
+ expect(selection.append).toHaveBeenCalledWith('svg');
+ });
+
+ it('selects body if no selector provided', function () {
+ var radarGraph;
+
+ radarGraph = new tr.graphing.Radar(500, radar);
+ spyOn(d3, 'select').andCallThrough();
+
+ radarGraph.init();
+
+ expect(d3.select).toHaveBeenCalledWith('body');
+ });
+
+ it('selects the selector if provided', function () {
+ var radarGraph;
+
+ radarGraph = new tr.graphing.Radar(500, radar);
+ spyOn(d3, 'select').andCallThrough();
+
+ radarGraph.init('#radar');
+
+ expect(d3.select).toHaveBeenCalledWith('#radar');
+ });
+ });
+