Side navigation
Ticket #3134: toString-tests.diff
File toString-tests.diff, 1.1 KB (added by genezys, July 07, 2008 09:53AM UTC)
Added test for alert() and prompt() in IE
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(25);
// Make sure that false values return false
ok( !jQuery.isFunction(), "No Value" );
@@ -139,6 +139,18 @@
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" );
+
+ // Native functions in IE
+ ok( jQuery.isFunction( window.alert ), "alert()" );
+ ok( jQuery.isFunction( window.prompt ), "prompt()" );
+
var obj = document.createElement("object");
// Firefox says this is a function
Download in other formats:
Original Format
File toString-tests.diff, 1.1 KB (added by genezys, July 07, 2008 09:53AM UTC)
Added test for alert() and prompt() in IE
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(25);
// Make sure that false values return false
ok( !jQuery.isFunction(), "No Value" );
@@ -139,6 +139,18 @@
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" );
+
+ // Native functions in IE
+ ok( jQuery.isFunction( window.alert ), "alert()" );
+ ok( jQuery.isFunction( window.prompt ), "prompt()" );
+
var obj = document.createElement("object");
// Firefox says this is a function