diff options
Diffstat (limited to 'test/unit/traversing.js')
-rw-r--r-- | test/unit/traversing.js | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/unit/traversing.js b/test/unit/traversing.js index b98abdcd4..a622ba902 100644 --- a/test/unit/traversing.js +++ b/test/unit/traversing.js @@ -673,6 +673,32 @@ test("contents()", function() { equal( c[0].nodeValue, "hi", "Check node,textnode,comment contents is just the one from span" ); }); +test("sort direction", function() { + expect( 12 ); + + var elems = jQuery("#ap, #select1 > *, #moretests > form"), + methodDirections = { + parent: false, + parents: true, + parentsUntil: true, + next: false, + prev: true, + nextAll: false, + prevAll: true, + nextUntil: false, + prevUntil: true, + siblings: false, + children: false, + contents: false + }; + + jQuery.each( methodDirections, function( method, reversed ) { + var actual = elems[ method ]().get(), + forward = jQuery.unique( [].concat( actual ) ); + deepEqual( actual, reversed ? forward.reverse() : forward, "Correct sort direction for " + method ); + }); +}); + test("add(String|Element|Array|undefined)", function() { expect( 15 ); |