GUI -- Continued porting topology behavior over to the new codebase. WIP.
- added FnService.windowSize() function.
- added MastService and mastHeight() function.
- implemented SvgUtilService.createDragBehavior().

Change-Id: I5dae35244ab8220e1b95ddfd55b180e6adcb7a00
diff --git a/web/gui/src/main/webapp/tests/app/fw/mast/mast-spec.js b/web/gui/src/main/webapp/tests/app/fw/mast/mast-spec.js
index 131be1f..67fbfbb 100644
--- a/web/gui/src/main/webapp/tests/app/fw/mast/mast-spec.js
+++ b/web/gui/src/main/webapp/tests/app/fw/mast/mast-spec.js
@@ -21,15 +21,20 @@
     // instantiate the masthead module
     beforeEach(module('onosMast'));
 
-    var $log, ctrl;
+    var $log, ctrl, ms;
 
     // we need an instance of the controller
-    beforeEach(inject(function(_$log_, $controller) {
+    beforeEach(inject(function(_$log_, $controller, MastService) {
         $log = _$log_;
         ctrl = $controller('MastCtrl');
+        ms = MastService;
     }));
 
     it('should start with no radio buttons', function () {
         expect(ctrl.radio).toBeNull();
     });
+
+    it('should declare height to be 36', function () {
+        expect(ms.mastHeight()).toBe(36);
+    })
 });
diff --git a/web/gui/src/main/webapp/tests/app/fw/util/fn-spec.js b/web/gui/src/main/webapp/tests/app/fw/util/fn-spec.js
index 56819ae..e5b7223 100644
--- a/web/gui/src/main/webapp/tests/app/fw/util/fn-spec.js
+++ b/web/gui/src/main/webapp/tests/app/fw/util/fn-spec.js
@@ -18,7 +18,8 @@
  ONOS GUI -- Util -- General Purpose Functions - Unit Tests
  */
 describe('factory: fw/util/fn.js', function() {
-    var fs,
+    var $window,
+        fs,
         someFunction = function () {},
         someArray = [1, 2, 3],
         someObject = { foo: 'bar'},
@@ -29,8 +30,12 @@
 
     beforeEach(module('onosUtil'));
 
-    beforeEach(inject(function (FnService) {
+    beforeEach(inject(function (_$window_, FnService) {
+        $window = _$window_;
         fs = FnService;
+
+        $window.innerWidth = 400;
+        $window.innerHeight = 200;
     }));
 
 
@@ -186,4 +191,28 @@
     });
 
 
+    // === Tests for windowSize()
+    it('windowSize(): noargs', function () {
+        var dim = fs.windowSize();
+        expect(dim.width).toEqual(400);
+        expect(dim.height).toEqual(200);
+    });
+
+    it('windowSize(): adjust height', function () {
+        var dim = fs.windowSize(50);
+        expect(dim.width).toEqual(400);
+        expect(dim.height).toEqual(150);
+    });
+
+    it('windowSize(): adjust width', function () {
+        var dim = fs.windowSize(0, 50);
+        expect(dim.width).toEqual(350);
+        expect(dim.height).toEqual(200);
+    });
+
+    it('windowSize(): adjust width and height', function () {
+        var dim = fs.windowSize(101, 201);
+        expect(dim.width).toEqual(199);
+        expect(dim.height).toEqual(99);
+    });
 });
diff --git a/web/gui/src/main/webapp/tests/app/view/topo/topoForce-spec.js b/web/gui/src/main/webapp/tests/app/view/topo/topoForce-spec.js
index e5f0073..f8b4e66 100644
--- a/web/gui/src/main/webapp/tests/app/view/topo/topoForce-spec.js
+++ b/web/gui/src/main/webapp/tests/app/view/topo/topoForce-spec.js
@@ -34,7 +34,7 @@
 
     it('should define api functions', function () {
         expect(fs.areFunctions(tfs, [
-            'initForce'
+            'initForce', 'resize'
         ])).toBeTruthy();
     });