diff options
author | jeresig <jeresig@gmail.com> | 2011-04-10 16:46:14 -0400 |
---|---|---|
committer | jeresig <jeresig@gmail.com> | 2011-04-10 16:46:14 -0400 |
commit | 247363b9a77281b202de7d535f356a6921a25cf5 (patch) | |
tree | a789d12ac420dd46deedeaa6f463f5ea03301328 /test | |
parent | 523db95de2fe9a66e515d75a7cbcce204c40c93b (diff) | |
parent | c0389e3e37447aa7eb70cfb4837f4df6cdec5bba (diff) | |
download | jquery-247363b9a77281b202de7d535f356a6921a25cf5.tar.gz jquery-247363b9a77281b202de7d535f356a6921a25cf5.zip |
Merge branch 'map-object.1.6' of https://github.com/danheberden/jquery into danheberden-map-object.1.6
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/core.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/test/unit/core.js b/test/unit/core.js index 79710025e..ed1fb5918 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -642,7 +642,7 @@ test("first()/last()", function() { }); test("map()", function() { - expect(2);//expect(6); + expect(7); same( jQuery("#ap").map(function(){ @@ -660,32 +660,32 @@ test("map()", function() { "Single Map" ); - return;//these haven't been accepted yet - //for #2616 var keys = jQuery.map( {a:1,b:2}, function( v, k ){ return k; - }, [ ] ); - + }); equals( keys.join(""), "ab", "Map the keys from a hash to an array" ); var values = jQuery.map( {a:1,b:2}, function( v, k ){ return v; - }, [ ] ); - + }); equals( values.join(""), "12", "Map the values from a hash to an array" ); + // object with length prop + var values = jQuery.map( {a:1,b:2, length:3}, function( v, k ){ + return v; + }); + equals( values.join(""), "123", "Map the values from a hash with a length property to an array" ); + var scripts = document.getElementsByTagName("script"); var mapped = jQuery.map( scripts, function( v, k ){ return v; - }, {length:0} ); - + }); equals( mapped.length, scripts.length, "Map an array(-like) to a hash" ); var flat = jQuery.map( Array(4), function( v, k ){ return k % 2 ? k : [k,k,k];//try mixing array and regular returns }); - equals( flat.join(""), "00012223", "try the new flatten technique(#2616)" ); }); |