X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=test%2Funit%2Fcore.js;h=eb00f23a6b7cca8deeaf0ae922fee4882759e485;hb=1d2b1a57dae0b73b3d99197f73f4edb623b5574a;hp=e3adc604f7445c7df9b80fcb4a89340dfd291161;hpb=a5dbca4a06a930865a17a1d02fd88893b5a2b690;p=jquery.git diff --git a/test/unit/core.js b/test/unit/core.js index e3adc60..eb00f23 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -839,3 +839,22 @@ test("jQuery.isEmptyObject", function(){ // What about this ? // equals(true, jQuery.isEmptyObject(null), "isEmptyObject on null" ); }); + +test("jQuery.proxy", function(){ + expect(4); + + var test = function(){ equals( this, thisObject, "Make sure that scope is set properly." ); }; + var thisObject = { foo: "bar", method: test }; + + // Make sure normal works + test.call( thisObject ); + + // Basic scoping + jQuery.proxy( test, thisObject )(); + + // Make sure it doesn't freak out + equals( jQuery.proxy( null, thisObject ), undefined, "Make sure no function was returned." ); + + // Use the string shortcut + jQuery.proxy( thisObject, "method" )(); +});