]> git.ipfire.org Git - thirdparty/foundation/foundation-sites.git/commitdiff
Use pull request #10941 from dragthor/getfnname-tests for v6.5.0
authorKristofer Krause <kris.krause@gmail.com>
Sat, 16 Jun 2018 07:15:55 +0000 (09:15 +0200)
committerNicolas Coden <nicolas@ncoden.fr>
Sat, 16 Jun 2018 07:15:55 +0000 (09:15 +0200)
51373515c getFnName unit tests

Signed-off-by: Nicolas Coden <nicolas@ncoden.fr>
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() {
   });