aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/core.js
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2019-09-24 02:04:53 +0200
committerGitHub <noreply@github.com>2019-09-24 02:04:53 +0200
commit78420d427cf3734d9264405fcbe08b76be182a95 (patch)
tree83a4cc9b453f84228d9e1fe9015aa39e482c4b37 /test/unit/core.js
parentf810080e8e92278bb5288cba7cc0169481471780 (diff)
downloadjquery-78420d427cf3734d9264405fcbe08b76be182a95.tar.gz
jquery-78420d427cf3734d9264405fcbe08b76be182a95.zip
Core: Implement .even() & .odd() to replace POS :even & :odd
`:even` & `:odd` are deprecated since jQuery 3.4.0 & will be removed in 4.0.0. The new `even()` & `odd()` methods will make the migration easier. Closes gh-4485
Diffstat (limited to 'test/unit/core.js')
-rw-r--r--test/unit/core.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/unit/core.js b/test/unit/core.js
index ca644fe20..be09163ac 100644
--- a/test/unit/core.js
+++ b/test/unit/core.js
@@ -648,6 +648,18 @@ QUnit.test( "first()/last()", function( assert ) {
assert.deepEqual( $none.last().get(), [], "last() none" );
} );
+QUnit.test( "even()/odd()", function( assert ) {
+ assert.expect( 4 );
+
+ var $links = jQuery( "#ap a" ), $none = jQuery( "asdf" );
+
+ assert.deepEqual( $links.even().get(), q( "google", "anchor1" ), "even()" );
+ assert.deepEqual( $links.odd().get(), q( "groups", "mark" ), "odd()" );
+
+ assert.deepEqual( $none.even().get(), [], "even() none" );
+ assert.deepEqual( $none.odd().get(), [], "odd() none" );
+} );
+
QUnit.test( "map()", function( assert ) {
assert.expect( 2 );