1 describe('tr.graphing.RefTable', function () {
2 var radar
, toolsQuadrant
, techniquesQuadrant
, platformsQuadrant
, languageFramework
, element
;
4 beforeEach(function () {
5 toolsQuadrant
= new tr
.models
.Quadrant('Tools');
6 techniquesQuadrant
= new tr
.models
.Quadrant('Techniques');
7 platformsQuadrant
= new tr
.models
.Quadrant('Platforms');
8 languageFramework
= new tr
.models
.Quadrant('Languages');
10 radar
= new tr
.models
.Radar();
11 radar
.setFirstQuadrant(toolsQuadrant
);
12 radar
.setSecondQuadrant(techniquesQuadrant
);
13 radar
.setThirdQuadrant(platformsQuadrant
);
14 radar
.setFourthQuadrant(languageFramework
);
16 element
= { innerHTML
: '' };
17 spyOn(document
, 'querySelector').andReturn(element
);
20 describe('render', function () {
21 it("groups blips by cycle", function () {
22 var adopt
= new tr
.models
.Cycle('Adopt');
23 var assess
= new tr
.models
.Cycle('Assess');
26 new tr
.models
.Blip('foo', adopt
, true, 'this is foo'),
27 new tr
.models
.Blip('bar', assess
, true, 'this is bar'),
28 new tr
.models
.Blip('baz', adopt
, true, 'this is baz')
31 var table
= new tr
.graphing
.RefTable(radar
);
32 table
.init('#some-id').render();
34 expect(element
.innerHTML
).toEqual(
35 '<table class="radar-ref-table">' +
36 '<tr class="radar-ref-status-group"><td colspan="3">Adopt</td></tr>' +
37 '<tr><td>-1</td><td>foo</td><td>this is foo</td></tr>' +
38 '<tr><td>-1</td><td>baz</td><td>this is baz</td></tr>' +
39 '<tr class="radar-ref-status-group"><td colspan="3">Assess</td></tr>' +
40 '<tr><td>-1</td><td>bar</td><td>this is bar</td></tr>' +
44 it("respects the assigned order of cycles", function () {
45 var adopt
= new tr
.models
.Cycle('Adopt', 1);
46 var assess
= new tr
.models
.Cycle('Assess', 3);
47 var hold
= new tr
.models
.Cycle('Hold', 2);
50 new tr
.models
.Blip('foo', adopt
, true, 'this is foo'),
51 new tr
.models
.Blip('bar', assess
, true, 'this is bar'),
52 new tr
.models
.Blip('baz', hold
, true, 'this is baz')
55 var table
= new tr
.graphing
.RefTable(radar
);
56 table
.init('#some-id').render();
58 expect(element
.innerHTML
).toEqual(
59 '<table class="radar-ref-table">' +
60 '<tr class="radar-ref-status-group"><td colspan="3">Adopt</td></tr>' +
61 '<tr><td>-1</td><td>foo</td><td>this is foo</td></tr>' +
62 '<tr class="radar-ref-status-group"><td colspan="3">Hold</td></tr>' +
63 '<tr><td>-1</td><td>baz</td><td>this is baz</td></tr>' +
64 '<tr class="radar-ref-status-group"><td colspan="3">Assess</td></tr>' +
65 '<tr><td>-1</td><td>bar</td><td>this is bar</td></tr>' +