Simon Hunt

GUI -- Fixed broken unit tests; cleaned up glyph tests.

Change-Id: I6950ada7ea8bd05c5a6917c8730857c40684157f
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
20 describe('factory: fw/svg/glyph.js', function() { 20 describe('factory: fw/svg/glyph.js', function() {
21 var $log, fs, gs, d3Elem, svg; 21 var $log, fs, gs, d3Elem, svg;
22 22
23 - var numBaseGlyphs = 30, 23 + var numBaseGlyphs = 34,
24 vbBird = '352 224 113 112', 24 vbBird = '352 224 113 112',
25 vbGlyph = '0 0 110 110', 25 vbGlyph = '0 0 110 110',
26 vbBadge = '0 0 10 10', 26 vbBadge = '0 0 10 10',
...@@ -61,11 +61,26 @@ describe('factory: fw/svg/glyph.js', function() { ...@@ -61,11 +61,26 @@ describe('factory: fw/svg/glyph.js', function() {
61 xMark: 'M9.0,7.2C8.2', 61 xMark: 'M9.0,7.2C8.2',
62 triangleUp: 'M0.5,6.2c0', 62 triangleUp: 'M0.5,6.2c0',
63 triangleDown: 'M9.5,4.2c0', 63 triangleDown: 'M9.5,4.2c0',
64 + plus: 'M4,2h2v2h2v2',
65 + minus: 'M2,4h6v2',
66 + play: 'M2.5,2l5.5,3',
67 + stop: 'M2.5,2.5h5',
64 68
65 // our test ones.. 69 // our test ones..
66 triangle: 'M.5,.2', 70 triangle: 'M.5,.2',
67 diamond: 'M.2,.5' 71 diamond: 'M.2,.5'
68 - }; 72 + },
73 + glyphIds = [
74 + 'unknown', 'node', 'switch', 'roadm', 'endstation', 'router',
75 + 'bgpSpeaker', 'chain', 'crown', 'lock',
76 + 'summary', 'details', 'ports', 'map', 'cycleLabels', 'oblique',
77 + 'resetZoom', 'relatedIntents', 'nextIntent', 'prevIntent',
78 + 'intentTraffic', 'allTraffic', 'flows', 'eqMaster'
79 + ],
80 + badgeIds = [
81 + 'uiAttached', 'checkMark', 'xMark', 'triangleUp', 'triangleDown',
82 + 'plus', 'minus', 'play', 'stop'
83 + ];
69 84
70 beforeEach(module('onosUtil', 'onosSvg')); 85 beforeEach(module('onosUtil', 'onosSvg'));
71 86
...@@ -122,114 +137,29 @@ describe('factory: fw/svg/glyph.js', function() { ...@@ -122,114 +137,29 @@ describe('factory: fw/svg/glyph.js', function() {
122 expect(glyph.d.slice(0, plen)).toEqual(prefix); 137 expect(glyph.d.slice(0, plen)).toEqual(prefix);
123 } 138 }
124 139
140 + it('should be configured with the correct number of glyphs', function () {
141 + expect(1 + glyphIds.length + badgeIds.length).toEqual(numBaseGlyphs);
142 + });
143 +
125 it('should load the bird glyph', function() { 144 it('should load the bird glyph', function() {
126 gs.init(); 145 gs.init();
127 verifyGlyphLoadedInCache('bird', vbBird); 146 verifyGlyphLoadedInCache('bird', vbBird);
128 }); 147 });
129 - it('should load the unknown glyph', function() { 148 +
130 - gs.init(); 149 + it('should load the regular glyphs', function () {
131 - verifyGlyphLoadedInCache('unknown', vbGlyph);
132 - });
133 - it('should load the node glyph', function() {
134 - gs.init();
135 - verifyGlyphLoadedInCache('node', vbGlyph);
136 - });
137 - it('should load the switch glyph', function() {
138 - gs.init();
139 - verifyGlyphLoadedInCache('switch', vbGlyph);
140 - });
141 - it('should load the roadm glyph', function() {
142 - gs.init();
143 - verifyGlyphLoadedInCache('roadm', vbGlyph);
144 - });
145 - it('should load the endstation glyph', function() {
146 - gs.init();
147 - verifyGlyphLoadedInCache('endstation', vbGlyph);
148 - });
149 - it('should load the router glyph', function() {
150 - gs.init();
151 - verifyGlyphLoadedInCache('router', vbGlyph);
152 - });
153 - it('should load the bgpSpeaker glyph', function() {
154 - gs.init();
155 - verifyGlyphLoadedInCache('bgpSpeaker', vbGlyph);
156 - });
157 - it('should load the chain glyph', function() {
158 - gs.init();
159 - verifyGlyphLoadedInCache('chain', vbGlyph);
160 - });
161 - it('should load the crown glyph', function() {
162 - gs.init();
163 - verifyGlyphLoadedInCache('crown', vbGlyph);
164 - });
165 - it('should load the lock glyph', function() {
166 - gs.init();
167 - verifyGlyphLoadedInCache('lock', vbGlyph);
168 - });
169 - it('should load the summary glyph', function () {
170 - gs.init();
171 - verifyGlyphLoadedInCache('summary', vbGlyph);
172 - });
173 - it('should load the details glyph', function () {
174 - gs.init();
175 - verifyGlyphLoadedInCache('details', vbGlyph);
176 - });
177 - it('should load the ports glyph', function () {
178 - gs.init();
179 - verifyGlyphLoadedInCache('ports', vbGlyph);
180 - });
181 - it('should load the map glyph', function () {
182 - gs.init();
183 - verifyGlyphLoadedInCache('map', vbGlyph);
184 - });
185 - it('should load the cycleLabels glyph', function () {
186 - gs.init();
187 - verifyGlyphLoadedInCache('cycleLabels', vbGlyph);
188 - });
189 - it('should load the oblique glyph', function () {
190 - gs.init();
191 - verifyGlyphLoadedInCache('oblique', vbGlyph);
192 - });
193 - it('should load the resetZoom glyph', function () {
194 - gs.init();
195 - verifyGlyphLoadedInCache('resetZoom', vbGlyph);
196 - });
197 - it('should load the relatedIntents glyph', function () {
198 - gs.init();
199 - verifyGlyphLoadedInCache('relatedIntents', vbGlyph);
200 - });
201 - it('should load the nextIntent glyph', function () {
202 - gs.init();
203 - verifyGlyphLoadedInCache('nextIntent', vbGlyph);
204 - });
205 - it('should load the prevIntent glyph', function () {
206 - gs.init();
207 - verifyGlyphLoadedInCache('prevIntent', vbGlyph);
208 - });
209 - it('should load the intentTraffic glyph', function () {
210 - gs.init();
211 - verifyGlyphLoadedInCache('intentTraffic', vbGlyph);
212 - });
213 - it('should load the flows glyph', function () {
214 - gs.init();
215 - verifyGlyphLoadedInCache('flows', vbGlyph);
216 - });
217 - it('should load the flows eqMaster', function () {
218 - gs.init();
219 - verifyGlyphLoadedInCache('eqMaster', vbGlyph);
220 - });
221 - it('should load the uiAttached glyph', function() {
222 - gs.init();
223 - verifyGlyphLoadedInCache('uiAttached', vbBadge);
224 - });
225 - it('should load the checkMark glyph', function() {
226 gs.init(); 150 gs.init();
227 - verifyGlyphLoadedInCache('checkMark', vbBadge); 151 + glyphIds.forEach(function (id) {
152 + verifyGlyphLoadedInCache(id, vbGlyph);
153 + });
228 }); 154 });
229 - it('should load the xMark glyph', function() { 155 +
156 + it('should load the badge glyphs', function () {
230 gs.init(); 157 gs.init();
231 - verifyGlyphLoadedInCache('xMark', vbBadge); 158 + badgeIds.forEach(function (id) {
159 + verifyGlyphLoadedInCache(id, vbBadge);
232 }); 160 });
161 + });
162 +
233 163
234 // define some glyphs that we want to install 164 // define some glyphs that we want to install
235 165
......
...@@ -22,7 +22,7 @@ describe('factory: fw/widget/table.js', function () { ...@@ -22,7 +22,7 @@ describe('factory: fw/widget/table.js', function () {
22 fs, is, 22 fs, is,
23 scope, compiled, 23 scope, compiled,
24 table, thead, tbody, 24 table, thead, tbody,
25 - tableIconTdSize = 33, 25 + tableIconTdSize = 100,
26 bottomMargin = 200, 26 bottomMargin = 200,
27 numTestElems = 4; 27 numTestElems = 4;
28 28
......
...@@ -38,12 +38,14 @@ describe('factory: view/topo/topoPanel.js', function() { ...@@ -38,12 +38,14 @@ describe('factory: view/topo/topoPanel.js', function() {
38 'destroyPanels', 38 'destroyPanels',
39 'showSummary', 39 'showSummary',
40 'toggleSummary', 40 'toggleSummary',
41 + 'toggleDetails',
41 'displaySingle', 42 'displaySingle',
42 'displayMulti', 43 'displayMulti',
43 'addAction', 44 'addAction',
45 + 'displayLink',
46 + 'displayNothing',
47 + 'displaySomething',
44 'hideSummaryPanel', 48 'hideSummaryPanel',
45 - 'showDetailPanel',
46 - 'hideDetailPanel',
47 'detailVisible', 49 'detailVisible',
48 'summaryVisible' 50 'summaryVisible'
49 ])).toBeTruthy(); 51 ])).toBeTruthy();
......
...@@ -34,10 +34,13 @@ describe('factory: view/topo/topoSelect.js', function() { ...@@ -34,10 +34,13 @@ describe('factory: view/topo/topoSelect.js', function() {
34 34
35 it('should define api functions', function () { 35 it('should define api functions', function () {
36 expect(fs.areFunctions(tss, [ 36 expect(fs.areFunctions(tss, [
37 - 'initSelect', 'destroySelect', 'showDetails', 'toggleDetails', 37 + 'initSelect', 'destroySelect',
38 + 'showDetails',
38 'nodeMouseOver', 'nodeMouseOut', 'selectObject', 'deselectObject', 39 'nodeMouseOver', 'nodeMouseOut', 'selectObject', 'deselectObject',
39 - 'deselectAll', 'hovered', 'haveDetails', 'selectOrder', 40 + 'deselectAll',
40 - 'validateSelectionContext' 41 + 'hovered', 'selectOrder',
42 + 'validateSelectionContext',
43 + 'clickConsumed'
41 ])).toBeTruthy(); 44 ])).toBeTruthy();
42 }); 45 });
43 46
......