mirror of
https://github.com/jquery/jquery.git
synced 2026-02-01 14:05:00 -05:00
Selector: add jQuery.uniqueSort; deprecate jQuery.unique
Fixes gh-2228
This commit is contained in:
@@ -385,7 +385,7 @@ test( "jQuery.contains", function() {
|
||||
ok( !jQuery.contains(document, detached), "document container (negative)" );
|
||||
});
|
||||
|
||||
test("jQuery.unique", function() {
|
||||
test("jQuery.uniqueSort", function() {
|
||||
expect( 14 );
|
||||
|
||||
function Arrayish( arr ) {
|
||||
@@ -459,8 +459,8 @@ test("jQuery.unique", function() {
|
||||
|
||||
jQuery.each( tests, function( label, test ) {
|
||||
var length = test.length || test.input.length;
|
||||
deepEqual( jQuery.unique( test.input ).slice( 0, length ), test.expected, label + " (array)" );
|
||||
deepEqual( jQuery.unique( new Arrayish(test.input) ).slice( 0, length ), test.expected, label + " (quasi-array)" );
|
||||
deepEqual( jQuery.uniqueSort( test.input ).slice( 0, length ), test.expected, label + " (array)" );
|
||||
deepEqual( jQuery.uniqueSort( new Arrayish(test.input) ).slice( 0, length ), test.expected, label + " (quasi-array)" );
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -696,7 +696,7 @@ test("sort direction", function() {
|
||||
|
||||
jQuery.each( methodDirections, function( method, reversed ) {
|
||||
var actual = elems[ method ]().get(),
|
||||
forward = jQuery.unique( [].concat( actual ) );
|
||||
forward = jQuery.uniqueSort( [].concat( actual ) );
|
||||
deepEqual( actual, reversed ? forward.reverse() : forward, "Correct sort direction for " + method );
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user