X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=test%2Funit%2Fcore.js;h=d50997b2ccb16303944bf988b7413531abd8e96f;hb=230614b4df313493813d688b63ab68f3812a0030;hp=30205430e274a24667c0d6b26489fc38713cedd5;hpb=0645b71ee6139c19c2c5a488f16f50dc1c31e9ac;p=jquery.git diff --git a/test/unit/core.js b/test/unit/core.js index 3020543..d50997b 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -825,3 +825,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" )(); +});