diff options
author | Ariel Flesler <aflesler@gmail.com> | 2009-06-20 15:51:19 +0000 |
---|---|---|
committer | Ariel Flesler <aflesler@gmail.com> | 2009-06-20 15:51:19 +0000 |
commit | c6b9654ea8524e76f49f17f1bb0f6a38ce36bca3 (patch) | |
tree | 40da8e73b91d6486a5e715e729637c76105df34e /test | |
parent | ee34b6982ab25cd7699f68506d7b18a02c3c4d44 (diff) | |
download | jquery-c6b9654ea8524e76f49f17f1bb0f6a38ce36bca3.tar.gz jquery-c6b9654ea8524e76f49f17f1bb0f6a38ce36bca3.zip |
jquery core: Closes #2827. jQuery.each iterates over functions
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/core.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/test/unit/core.js b/test/unit/core.js index ade341527..ac93ddaa2 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -494,7 +494,7 @@ test("jQuery.extend(Object, Object)", function() { }); test("jQuery.each(Object,Function)", function() { - expect(12); + expect(13); jQuery.each( [0,1,2], function(i, n){ equals( i, n, "Check array iteration" ); }); @@ -519,6 +519,13 @@ test("jQuery.each(Object,Function)", function() { total = 0; jQuery.each({"a":3,"b":3,"c":3}, function(i,v){ total += v; return false; }); equals( total, 3, "Looping over an object, with break" ); + + var f = function(){}; + f.foo = 'bar'; + jQuery.each(f, function(i){ + f[i] = 'baz'; + }); + equals( "baz", f.foo, "Loop over a function" ); }); test("jQuery.makeArray", function(){ |