Side navigation
Ticket #3134: toString-tests.2.diff
File toString-tests.2.diff, 0.9 KB (added by genezys, July 07, 2008 09:52AM UTC)
Complex version but passes all tests
Index: test/unit/core.js
===================================================================
--- test/unit/core.js (révision 5772)
+++ test/unit/core.js (copie de travail)
@@ -107,7 +107,7 @@
});
test("isFunction", function() {
- expect(21);
+ expect(23);
// Make sure that false values return false
ok( !jQuery.isFunction(), "No Value" );
@@ -139,6 +139,14 @@
var fn = function(){};
ok( jQuery.isFunction(fn), "Normal Function" );
+ // Function with toString() overridden (bug #3134)
+ var fnWithToString = function(){};
+ fnWithToString.toString = function(){ return "Test"; };
+ ok( jQuery.isFunction(fnWithToString), "Normal Function with toString() overridden" );
+
+ // Object with toString() function (bug #3134)
+ ok( !jQuery.isFunction({ toString: function(){ return "function"; } }), "Object with toString() function" );
+
var obj = document.createElement("object");
// Firefox says this is a function
Download in other formats:
Original Format
File toString-tests.2.diff, 0.9 KB (added by genezys, July 07, 2008 09:52AM UTC)
Complex version but passes all tests
Index: test/unit/core.js
===================================================================
--- test/unit/core.js (révision 5772)
+++ test/unit/core.js (copie de travail)
@@ -107,7 +107,7 @@
});
test("isFunction", function() {
- expect(21);
+ expect(23);
// Make sure that false values return false
ok( !jQuery.isFunction(), "No Value" );
@@ -139,6 +139,14 @@
var fn = function(){};
ok( jQuery.isFunction(fn), "Normal Function" );
+ // Function with toString() overridden (bug #3134)
+ var fnWithToString = function(){};
+ fnWithToString.toString = function(){ return "Test"; };
+ ok( jQuery.isFunction(fnWithToString), "Normal Function with toString() overridden" );
+
+ // Object with toString() function (bug #3134)
+ ok( !jQuery.isFunction({ toString: function(){ return "function"; } }), "Object with toString() function" );
+
var obj = document.createElement("object");
// Firefox says this is a function