diff options
author | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2019-09-24 02:04:53 +0200 |
---|---|---|
committer | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2019-09-24 02:05:39 +0200 |
commit | 409cbda7fe85d7026aaa4423d3384f288eed5be2 (patch) | |
tree | 39e7af5d20a014746f099fe504d2b61ee0a610c8 /test/unit/core.js | |
parent | 0c67da4b74394d17991511b80f3ccff9f0c423be (diff) | |
download | jquery-409cbda7fe85d7026aaa4423d3384f288eed5be2.tar.gz jquery-409cbda7fe85d7026aaa4423d3384f288eed5be2.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
(cherry picked from commit 78420d427cf3734d9264405fcbe08b76be182a95)
Diffstat (limited to 'test/unit/core.js')
-rw-r--r-- | test/unit/core.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/unit/core.js b/test/unit/core.js index 2f40462f3..b8e556b85 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -670,6 +670,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 ); |