aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorjeresig <jeresig@gmail.com>2011-04-10 16:51:22 -0400
committerjeresig <jeresig@gmail.com>2011-04-10 16:51:22 -0400
commit14ecd9a992fe97461297bb9c2fd55aa669f1e2e8 (patch)
treea5366eb9e5cc789d44c6e4ae92fd3ca373c22d4e /test
parent909a6ff60a88b17155bc000ab49d02c2dd6938f2 (diff)
parent574ae3b1be555dbd5242532739cd8e0a34e0569c (diff)
downloadjquery-14ecd9a992fe97461297bb9c2fd55aa669f1e2e8.tar.gz
jquery-14ecd9a992fe97461297bb9c2fd55aa669f1e2e8.zip
Merge branch 'proxy-native-bind' of https://github.com/gf3/jquery into gf3-proxy-native-bind
Diffstat (limited to 'test')
-rw-r--r--test/unit/core.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/test/unit/core.js b/test/unit/core.js
index ed1fb5918..c2a23b1a8 100644
--- a/test/unit/core.js
+++ b/test/unit/core.js
@@ -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(){