diff options
author | John Resig <jeresig@gmail.com> | 2011-05-02 13:25:53 -0400 |
---|---|---|
committer | John Resig <jeresig@gmail.com> | 2011-05-02 13:25:53 -0400 |
commit | 6c449fd5df3e0ec50e893d055da9aea486e7d71c (patch) | |
tree | 9434297af87668ce6b161df156801092dc17e2bc /test/unit | |
parent | 86aa764f0b7b659fbd8eec9333d22c3a79bdfcd5 (diff) | |
download | jquery-6c449fd5df3e0ec50e893d055da9aea486e7d71c.tar.gz jquery-6c449fd5df3e0ec50e893d055da9aea486e7d71c.zip |
Make sure that empty nodelists continue to map properly. Fixes #8993.
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/core.js | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/test/unit/core.js b/test/unit/core.js index 7690756d9..75d3e0e2c 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -653,7 +653,7 @@ test("first()/last()", function() { }); test("map()", function() { - expect(7); + expect(8); same( jQuery("#ap").map(function(){ @@ -694,6 +694,12 @@ test("map()", function() { }); equals( mapped.length, scripts.length, "Map an array(-like) to a hash" ); + var nonsense = document.getElementsByTagName("asdf"); + var mapped = jQuery.map( nonsense, function( v, k ){ + return v; + }); + equals( mapped.length, nonsense.length, "Map an empty 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 }); |