GUI -- Topology View all, packet, and optical layer radio buttons are now part of the topology view toolbar, instead of being in the masthead. Keystroke 'N' for cycle node layers added. Button glyph added. Fixed previously unseen broken unit tests for table.js.

Change-Id: I6e53bdc6cacbf41b990abd07d30fc99ef4c3b8c0
diff --git a/web/gui/src/main/webapp/tests/app/fw/svg/glyph-spec.js b/web/gui/src/main/webapp/tests/app/fw/svg/glyph-spec.js
index c5b47d4..9b24e47 100644
--- a/web/gui/src/main/webapp/tests/app/fw/svg/glyph-spec.js
+++ b/web/gui/src/main/webapp/tests/app/fw/svg/glyph-spec.js
@@ -20,7 +20,7 @@
 describe('factory: fw/svg/glyph.js', function() {
     var $log, fs, gs, d3Elem, svg;
 
-    var numBaseGlyphs = 34,
+    var numBaseGlyphs = 35,
         vbBird = '352 224 113 112',
         vbGlyph = '0 0 110 110',
         vbBadge = '0 0 10 10',
@@ -46,6 +46,7 @@
             map: 'M95.8,9.2H14.2c-2.8,0-5,2.2-5,5v66',
             cycleLabels: 'M72.5,33.9c',
             oblique: 'M80.9,30.2h',
+            filters: 'M24.8,13.3L',
             resetZoom: 'M86,79.8L',
             relatedIntents: 'M99.9,43.7',
             nextIntent: 'M88.1,55.7',
@@ -74,8 +75,8 @@
             'unknown', 'node', 'switch', 'roadm', 'endstation', 'router',
             'bgpSpeaker', 'chain', 'crown', 'lock',
             'summary', 'details', 'ports', 'map', 'cycleLabels', 'oblique',
-            'resetZoom', 'relatedIntents', 'nextIntent', 'prevIntent',
-            'intentTraffic', 'allTraffic', 'flows', 'eqMaster'
+            'filters', 'resetZoom', 'relatedIntents', 'nextIntent',
+            'prevIntent', 'intentTraffic', 'allTraffic', 'flows', 'eqMaster'
         ],
         badgeIds = [
             'uiAttached', 'checkMark', 'xMark', 'triangleUp', 'triangleDown',
diff --git a/web/gui/src/main/webapp/tests/app/fw/widget/table-spec.js b/web/gui/src/main/webapp/tests/app/fw/widget/table-spec.js
index 908ea16..29927cd 100644
--- a/web/gui/src/main/webapp/tests/app/fw/widget/table-spec.js
+++ b/web/gui/src/main/webapp/tests/app/fw/widget/table-spec.js
@@ -19,11 +19,12 @@
  */
 describe('factory: fw/widget/table.js', function () {
     var $log, $compile, $rootScope,
-        fs, is,
+        fs, mast, is,
         scope, compiled,
-        table, thead, tbody,
+        table, thead, tbody, mockHeader,
+        mockh2Height = '10px',
         tableIconTdSize = 100,
-        bottomMargin = 200,
+        pdgTop = 101,
         numTestElems = 4;
 
     var onosFixedHeaderTags = '<table ' +
@@ -73,7 +74,7 @@
                                 '</tbody>' +
                                 '</table>';
 
-    beforeEach(module('onosWidget', 'onosUtil', 'onosSvg'));
+    beforeEach(module('onosWidget', 'onosUtil', 'onosMast', 'onosSvg'));
 
     var mockWindow = {
         innerWidth: 400,
@@ -92,11 +93,12 @@
     });
 
     beforeEach(inject(function (_$log_, _$compile_, _$rootScope_,
-                                FnService, IconService) {
+                                FnService, MastService, IconService) {
         $log = _$log_;
         $compile = _$compile_;
         $rootScope = _$rootScope_;
         fs = FnService;
+        mast = MastService;
         is = IconService;
     }));
 
@@ -104,10 +106,18 @@
         scope = $rootScope.$new();
     });
 
+    beforeEach(function () {
+        mockHeader = d3.select('body')
+            .append('h2')
+            .style('height', mockh2Height)
+            .html('Some Header');
+    });
+
     afterEach(function () {
         table = null;
         thead = null;
         tbody = null;
+        mockHeader.remove();
     });
 
     function compileTable() {
@@ -127,11 +137,11 @@
     }
 
     function verifyCssDisplay() {
-        var winHeight = fs.windowSize().height;
+        var tableHeight = fs.windowSize(pdgTop).height;
 
         expect(thead.css('display')).toBe('block');
         expect(tbody.css('display')).toBe('block');
-        expect(tbody.css('height')).toBe((winHeight - bottomMargin) + 'px');
+        expect(tbody.css('height')).toBe(tableHeight + 'px');
         expect(tbody.css('overflow')).toBe('auto');
     }
 
diff --git a/web/gui/src/main/webapp/tests/app/view/topo/topoFilter-spec.js b/web/gui/src/main/webapp/tests/app/view/topo/topoFilter-spec.js
index 8466dbe..fc5b512 100644
--- a/web/gui/src/main/webapp/tests/app/view/topo/topoFilter-spec.js
+++ b/web/gui/src/main/webapp/tests/app/view/topo/topoFilter-spec.js
@@ -18,7 +18,7 @@
  ONOS GUI -- Topo View -- Topo Filter Service - Unit Tests
  */
 describe('factory: view/topo/topoFilter.js', function() {
-    var $log, fs, fltr, d3Elem, api;
+    var $log, fs, fltr, api;
 
     var mockNodes = {
             each: function () {},
@@ -35,7 +35,6 @@
         $log = _$log_;
         fs = FnService;
         fltr = TopoFilterService;
-        d3Elem = d3.select('body').append('div').attr('id', 'myMastDiv');
 
         api = {
             node: function () { return mockNodes; },
@@ -44,7 +43,7 @@
     }));
 
     afterEach(function () {
-        d3.select('#myMastDiv').remove();
+
     });
 
     it('should define TopoFilterService', function () {
@@ -53,45 +52,16 @@
 
     it('should define api functions', function () {
         expect(fs.areFunctions(fltr, [
-            'initFilter', 'destroyFilter',
-            'clickAction', 'selected', 'inLayer',
+            'initFilter',
+            'clickAction', 'selected', 'inLayer'
         ])).toBeTruthy();
     });
 
-    it('should inject the buttons into the given div', function () {
-        fltr.initFilter(api, d3Elem);
-        var grpdiv = d3Elem.select('#topo-radio-group');
-        expect(grpdiv.size()).toBe(1);
-
-        var btns = grpdiv.selectAll('span');
-        expect(btns.size()).toBe(3);
-
-        var prefix = 'topo-rb-',
-            expIds = [ 'all', 'pkt', 'opt' ];
-
-        btns.each(function (d, i) {
-            var b = d3.select(this);
-            expect(b.attr('id')).toEqual(prefix + expIds[i]);
-            // 0th button is active - others are not
-            expect(b.classed('active')).toEqual(i === 0);
-        });
-    });
-
-    it('should remove the buttons from the given div', function () {
-        fltr.initFilter(api, d3Elem);
-        var grpdiv = d3Elem.select('#topo-radio-group');
-        expect(grpdiv.size()).toBe(1);
-
-        fltr.destroyFilter();
-        grpdiv = d3Elem.select('#topo-radio-group');
-        expect(grpdiv.size()).toBe(0);
-    });
-
     it('should report the selected button', function () {
-        fltr.initFilter(api, d3Elem);
+        fltr.initFilter(api);
         expect(fltr.selected()).toEqual('all');
     });
 
-    // TODO: figure out how to trigger the click function on the spans..
+    // TODO: test the on click functions
 
 });