76089888052f9fccb5080272512c5908edc31835
1 describe('tr.graphing.Radar', function () {
3 return d3
.select("body").append("svg");
6 it('sets the size', function () {
8 spyOn(svg
, 'attr').andReturn(svg
);
10 var radarGraph
= new tr
.graphing
.Radar(svg
, 500);
12 expect(svg
.attr
).toHaveBeenCalledWith('width', 500);
13 expect(svg
.attr
).toHaveBeenCalledWith('height', 500);
16 describe('lines', function () {
17 it('plots a vertical line in the center', function () {
19 spyOn(svg
, 'append').andReturn(svg
);
20 spyOn(svg
, 'attr').andReturn(svg
);
22 var radarGraph
= new tr
.graphing
.Radar(svg
, 500);
26 expect(svg
.append
).toHaveBeenCalledWith('line');
27 expect(svg
.attr
).toHaveBeenCalledWith('x1', 500 / 2);
28 expect(svg
.attr
).toHaveBeenCalledWith('y1', 0);
29 expect(svg
.attr
).toHaveBeenCalledWith('x2', 500 / 2);
30 expect(svg
.attr
).toHaveBeenCalledWith('y2', 500);
31 expect(svg
.attr
).toHaveBeenCalledWith('stroke-width', 5);
34 it('plots a horizontal line in the center', function () {
36 spyOn(svg
, 'append').andReturn(svg
);
37 spyOn(svg
, 'attr').andReturn(svg
);
39 var radarGraph
= new tr
.graphing
.Radar(svg
, 500);
43 expect(svg
.append
).toHaveBeenCalledWith('line');
44 expect(svg
.attr
).toHaveBeenCalledWith('x1', 0);
45 expect(svg
.attr
).toHaveBeenCalledWith('y1', 500 / 2);
46 expect(svg
.attr
).toHaveBeenCalledWith('x2', 500);
47 expect(svg
.attr
).toHaveBeenCalledWith('y2', 500 / 2);
48 expect(svg
.attr
).toHaveBeenCalledWith('stroke-width', 5);