Bug Tracker

Ticket #3134: toString-tests.2.diff

File toString-tests.2.diff, 964 bytes (added by genezys, 14 years ago)

Complex version but passes all tests

  • test/unit/core.js

     
    107107});
    108108
    109109test("isFunction", function() {
    110         expect(21);
     110        expect(23);
    111111
    112112        // Make sure that false values return false
    113113        ok( !jQuery.isFunction(), "No Value" );
     
    139139        var fn = function(){};
    140140        ok( jQuery.isFunction(fn), "Normal Function" );
    141141
     142        // Function with toString() overridden (bug #3134)
     143        var fnWithToString = function(){};
     144        fnWithToString.toString = function(){ return "Test"; };
     145        ok( jQuery.isFunction(fnWithToString), "Normal Function with toString() overridden" );
     146
     147        // Object with toString() function (bug #3134)
     148        ok( !jQuery.isFunction({ toString: function(){ return "function"; } }), "Object with toString() function" );
     149       
    142150        var obj = document.createElement("object");
    143151
    144152        // Firefox says this is a function