+test("slice()", function() {
+ expect(7);
+
+ var $links = jQuery("#ap a");
+
+ same( $links.slice(1,2).get(), q("groups"), "slice(1,2)" );
+ same( $links.slice(1).get(), q("groups", "anchor1", "mark"), "slice(1)" );
+ same( $links.slice(0,3).get(), q("google", "groups", "anchor1"), "slice(0,3)" );
+ same( $links.slice(-1).get(), q("mark"), "slice(-1)" );
+
+ same( $links.eq(1).get(), q("groups"), "eq(1)" );
+ same( $links.eq('2').get(), q("anchor1"), "eq('2')" );
+ same( $links.eq(-1).get(), q("mark"), "eq(-1)" );
+});
+
+test("first()/last()", function() {
+ expect(4);
+
+ var $links = jQuery("#ap a"), $none = jQuery("asdf");
+
+ same( $links.first().get(), q("google"), "first()" );
+ same( $links.last().get(), q("mark"), "last()" );
+
+ same( $none.first().get(), [], "first() none" );
+ same( $none.last().get(), [], "last() none" );
+});
+
+test("map()", function() {
+ expect(2);//expect(6);
+
+ same(
+ jQuery("#ap").map(function(){
+ return jQuery(this).find("a").get();
+ }).get(),
+ q("google", "groups", "anchor1", "mark"),
+ "Array Map"
+ );
+
+ same(
+ jQuery("#ap > a").map(function(){
+ return this.parentNode;
+ }).get(),
+ q("ap","ap","ap"),
+ "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" );
+
+ 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" );