]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
getFnName unit tests 10941/head
authorKristofer Krause <kris.krause@gmail.com>
Wed, 14 Feb 2018 22:00:05 +0000 (17:00 -0500)
committerKristofer Krause <kris.krause@gmail.com>
Wed, 14 Feb 2018 22:00:05 +0000 (17:00 -0500)
test/javascript/util/core.js

index cd78116a8794e690c361e33db425df77d53265c2..d69d7d57851bba5ea2d0b2f6dbee659379f45002 100644 (file)
@@ -84,8 +84,31 @@ describe('Foundation core', function() {
   });
 
   describe('getFnName()', function() {
-  });
+    it('should handle a function declaration', function() {
+      function A() {};
+      var name = Foundation.getFnName(A);
+
+      name.should.be.a('string');
+      name.should.be.equal('A');
+    });
+
+    it('should handle a function expression', function() {
+      var B = function(){}; 
+      var name = Foundation.getFnName(B);
 
+      name.should.be.a('string');
+      name.should.be.equal('');
+    });
+    
+    it('should handle a named function expression', function() {
+      var D = function foo(){};
+      var name = Foundation.getFnName(D);
+
+      name.should.be.a('string');
+      name.should.be.equal('foo');
+    });
+  });
+  
   describe('transitionEnd()', function() {
   });