Merge branch 'proxy-native-bind' of https://github.com/gf3/jquery into gf3-proxy-native-bind

This commit is contained in:
jeresig 2011-04-10 16:51:22 -04:00
commit 14ecd9a992
4 changed files with 83 additions and 39 deletions

View file

@ -903,7 +903,7 @@ test("jQuery.isEmptyObject", function(){
});
test("jQuery.proxy", function(){
expect(4);
expect(6);
var test = function(){ equals( this, thisObject, "Make sure that scope is set properly." ); };
var thisObject = { foo: "bar", method: test };
@ -917,8 +917,17 @@ test("jQuery.proxy", function(){
// 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" )();
// Partial application
var test2 = function( a ){ equals( a, "pre-applied", "Ensure arguments can be pre-applied." ); };
jQuery.proxy( test2, null, "pre-applied" )();
// Partial application w/ normal arguments
var test3 = function( a, b ){ equals( b, "normal", "Ensure arguments can be pre-applied and passed as usual." ); };
jQuery.proxy( test3, null, "pre-applied" )( "normal" );
// Test old syntax
var test4 = { meth: function( a ){ equals( a, "boom", "Ensure old syntax works." ); } };
jQuery.proxy( test4, "meth" )( "boom" );
});
test("jQuery.parseJSON", function(){