GUI -- Sketching out GlyphService.
- Added areFunctions() to FnService.
- First unit test for GlyphService.
- Added note about debugging unit tests.

Change-Id: I377b6a1cf1845fb57e506e1a935970b49dbf0bbb
diff --git a/web/gui/src/main/webapp/app/fw/svg/glyph.js b/web/gui/src/main/webapp/app/fw/svg/glyph.js
index ab540a1..1775a11 100644
--- a/web/gui/src/main/webapp/app/fw/svg/glyph.js
+++ b/web/gui/src/main/webapp/app/fw/svg/glyph.js
@@ -22,14 +22,38 @@
 (function () {
     'use strict';
 
-    var $log;
+    var $log,
+        glyphs = d3.map();
 
     angular.module('onosSvg')
         .factory('GlyphService', ['$log', function (_$log_) {
             $log = _$log_;
 
+
+            function init() {
+                // TODO: load the core set of glyphs
+
+            }
+
+            function register(viewBox, data, overwrite) {
+                // TODO: register specified glyph definitions
+
+            }
+
+            function ids() {
+                return glyphs.keys();
+            }
+
+            function loadDefs(defs) {
+                // TODO: clear defs element, then load all glyph definitions
+
+            }
+
             return {
-                tbd: function () {}
+                init: init,
+                register: register,
+                ids: ids,
+                loadDefs: loadDefs
             };
         }]);
 
diff --git a/web/gui/src/main/webapp/app/fw/util/fn.js b/web/gui/src/main/webapp/app/fw/util/fn.js
index 062da3a..5858e5a 100644
--- a/web/gui/src/main/webapp/app/fw/util/fn.js
+++ b/web/gui/src/main/webapp/app/fw/util/fn.js
@@ -42,6 +42,23 @@
         return isA(a) && a.indexOf(x) > -1;
     }
 
+    // Returns true if all names in the array are defined as functions
+    // on the given api object; false otherwise.
+    function areFunctions(api, fnNames) {
+        if (!isA(fnNames)) {
+            return false;
+        }
+        var n = fnNames.length,
+            i, name;
+        for (i=0; i<n; i++) {
+            name = fnNames[i];
+            if (!isF(api[name])) {
+                return false;
+            }
+        }
+        return true;
+    }
+
     angular.module('onosUtil')
         .factory('FnService', [function () {
             return {
@@ -49,7 +66,8 @@
                 isA: isA,
                 isS: isS,
                 isO: isO,
-                contains: contains
+                contains: contains,
+                areFunctions: areFunctions
             };
     }]);