aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorGianni Chiappetta <gianni@runlevel6.org>2010-12-14 21:53:04 -0500
committerGianni Chiappetta <gianni@runlevel6.org>2010-12-14 21:53:04 -0500
commit9f8cd6c499844451468257140e71f611abb3a040 (patch)
tree0390a7c2268c29b0e1a28c4d6fe80b8e5e2eb808 /test
parentc9c9057c4d4097767ca181bdb4bb27d6fd2d8fbd (diff)
downloadjquery-9f8cd6c499844451468257140e71f611abb3a040.tar.gz
jquery-9f8cd6c499844451468257140e71f611abb3a040.zip
Fixing $.proxy to work like (and use) Function.prototype.bind (ticket #7783)
http://bugs.jquery.com/ticket/7783
Diffstat (limited to 'test')
-rw-r--r--test/unit/core.js11
1 files changed, 8 insertions, 3 deletions
diff --git a/test/unit/core.js b/test/unit/core.js
index 705778370..9f9078a49 100644
--- a/test/unit/core.js
+++ b/test/unit/core.js
@@ -858,7 +858,7 @@ test("jQuery.isEmptyObject", function(){
});
test("jQuery.proxy", function(){
- expect(4);
+ expect(5);
var test = function(){ equals( this, thisObject, "Make sure that scope is set properly." ); };
var thisObject = { foo: "bar", method: test };
@@ -872,8 +872,13 @@ 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("jQuery.parseJSON", function(){