X-Git-Url: https://pwan.org/git/?p=tech-radar.git;a=blobdiff_plain;f=test%2Fgraphing%2Fradar-spec.js;h=f02ef0629632094bd4f85ea879b41e9495f854d0;hp=02c3e29bcc893df18d9e1af445feea129f4ea2c8;hb=98727f4b22defac583218fbbde96b914638482e8;hpb=a38bbd158706ac00e91a29fa96b3f783e8cb555f diff --git a/test/graphing/radar-spec.js b/test/graphing/radar-spec.js index 02c3e29..f02ef06 100644 --- a/test/graphing/radar-spec.js +++ b/test/graphing/radar-spec.js @@ -38,7 +38,7 @@ describe('tr.graphing.Radar', function () { expect(svg.attr).toHaveBeenCalledWith('y1', 0); expect(svg.attr).toHaveBeenCalledWith('x2', 500 / 2); expect(svg.attr).toHaveBeenCalledWith('y2', 500); - expect(svg.attr).toHaveBeenCalledWith('stroke-width', 5); + expect(svg.attr).toHaveBeenCalledWith('stroke-width', 14); }); it('plots a horizontal line in the center', function () { @@ -57,7 +57,7 @@ describe('tr.graphing.Radar', function () { expect(svg.attr).toHaveBeenCalledWith('y1', 500 / 2); expect(svg.attr).toHaveBeenCalledWith('x2', 500); expect(svg.attr).toHaveBeenCalledWith('y2', 500 / 2); - expect(svg.attr).toHaveBeenCalledWith('stroke-width', 5); + expect(svg.attr).toHaveBeenCalledWith('stroke-width', 14); }); }); @@ -79,7 +79,7 @@ describe('tr.graphing.Radar', function () { radarGraph = new tr.graphing.Radar(svg, 500, radar); }); - it('plots the circles for the cicles', function () { + it('plots the circles for the cycles', function () { radarGraph.plot(); expect(svg.append).toHaveBeenCalledWith('circle'); @@ -92,5 +92,39 @@ describe('tr.graphing.Radar', function () { expect(svg.attr).toHaveBeenCalledWith('cy', 500 / 2); expect(svg.attr).toHaveBeenCalledWith('r', 250); }); + + it('adds the name of each cycle for the right side', function () { + var center = 500 / 2; + spyOn(svg, 'text').andReturn(svg); + radarGraph.plot(); + + expect(svg.append).toHaveBeenCalledWith('text'); + expect(svg.attr).toHaveBeenCalledWith('y', center + 4); + expect(svg.attr).toHaveBeenCalledWith('x', 0 + 10); + expect(svg.text).toHaveBeenCalledWith('Adopt'); + + expect(svg.append).toHaveBeenCalledWith('text'); + expect(svg.attr).toHaveBeenCalledWith('y', center + 4); + expect(svg.attr).toHaveBeenCalledWith('x', 0 + (center / 2) + 10); + expect(svg.text).toHaveBeenCalledWith('Hold'); + }); + + it('adds the name of each cycle for the right side', function () { + var center = 500 / 2; + spyOn(svg, 'text').andReturn(svg); + radarGraph.plot(); + + expect(svg.append).toHaveBeenCalledWith('text'); + expect(svg.attr).toHaveBeenCalledWith('y', center + 4); + expect(svg.attr).toHaveBeenCalledWith('x', 500 - 10); + expect(svg.attr).toHaveBeenCalledWith('text-anchor', 'end'); + expect(svg.text).toHaveBeenCalledWith('Adopt'); + + expect(svg.append).toHaveBeenCalledWith('text'); + expect(svg.attr).toHaveBeenCalledWith('y', center + 4); + expect(svg.attr).toHaveBeenCalledWith('x', 500 - (center / 2) - 10); + expect(svg.attr).toHaveBeenCalledWith('text-anchor', 'end'); + expect(svg.text).toHaveBeenCalledWith('Hold'); + }); }); });