diff options
author | Jun Sun <klsforever@gmail.com> | 2015-12-30 15:40:08 +0800 |
---|---|---|
committer | Michał Gołębiowski <m.goleb@gmail.com> | 2016-01-07 21:56:19 +0100 |
commit | 01fb17be63d3d08789303f2e0eb7b6fcccc8fd56 (patch) | |
tree | 4f28d7733e707794ef58389219f4720ec29f754c | |
parent | 41c83f5c016a99b0d3f39d1320799b4c11df22f3 (diff) | |
download | jquery-01fb17be63d3d08789303f2e0eb7b6fcccc8fd56.tar.gz jquery-01fb17be63d3d08789303f2e0eb7b6fcccc8fd56.zip |
CSS: Add animation-iteration-count to cssNumber, fix tests
(cherry-picked from df822caff079177d1840d67e03d6b24a93ea99a5)
Fixes gh-2792
Closes gh-2793
-rw-r--r-- | src/css.js | 1 | ||||
-rw-r--r-- | test/unit/css.js | 17 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/css.js b/src/css.js index 610267d44..f96600b45 100644 --- a/src/css.js +++ b/src/css.js @@ -255,6 +255,7 @@ jQuery.extend( { // Don't automatically add "px" to these possibly-unitless properties cssNumber: { + "animationIterationCount": true, "columnCount": true, "fillOpacity": true, "flexGrow": true, diff --git a/test/unit/css.js b/test/unit/css.js index adfc46cb8..95ba69669 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -916,26 +916,35 @@ if ( jQuery.fn.offset ) { } ); } -QUnit.test( "Do not append px (#9548, #12990)", function( assert ) { - assert.expect( 2 ); +QUnit.test( "Do not append px (#9548, #12990, #2792)", function( assert ) { + assert.expect( 3 ); var $div = jQuery( "<div>" ).appendTo( "#qunit-fixture" ); $div.css( "fill-opacity", 1 ); // Support: Android 2.3 (no support for fill-opacity) - if ( $div.css( "fill-opacity" ) ) { + if ( $div.css( "fill-opacity" ) !== undefined ) { assert.equal( $div.css( "fill-opacity" ), 1, "Do not append px to 'fill-opacity'" ); } else { assert.ok( true, "No support for fill-opacity CSS property" ); } $div.css( "column-count", 1 ); - if ( $div.css( "column-count" ) ) { + if ( $div.css( "column-count" ) !== undefined ) { assert.equal( $div.css( "column-count" ), 1, "Do not append px to 'column-count'" ); } else { assert.ok( true, "No support for column-count CSS property" ); } + + $div.css( "animation-iteration-count", 2 ); + if ( $div.css( "animation-iteration-count" ) !== undefined ) { + // if $div.css( "animation-iteration-count" ) return "1", + // it actually return the default value of animation-iteration-count + assert.equal( $div.css( "animation-iteration-count" ), 2, "Do not append px to 'animation-iteration-count'" ); + } else { + assert.ok( true, "No support for animation-iteration-count CSS property" ); + } } ); QUnit.test( "css('width') and css('height') should respect box-sizing, see #11004", function( assert ) { |