Skip to content

Commit df822ca

Browse files
ufologistmgol
authored andcommitted
CSS: Add animation-iteration-count to cssNumber, fix tests
Fixes jquerygh-2792 Closes jquerygh-2793
1 parent a4d16a2 commit df822ca

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/css.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@ jQuery.extend( {
190190

191191
// Don't automatically add "px" to these possibly-unitless properties
192192
cssNumber: {
193+
"animationIterationCount": true,
193194
"columnCount": true,
194195
"fillOpacity": true,
195196
"flexGrow": true,

test/unit/css.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -840,26 +840,35 @@ if ( jQuery.fn.offset ) {
840840
} );
841841
}
842842

843-
QUnit.test( "Do not append px (#9548, #12990)", function( assert ) {
844-
assert.expect( 2 );
843+
QUnit.test( "Do not append px (#9548, #12990, #2792)", function( assert ) {
844+
assert.expect( 3 );
845845

846846
var $div = jQuery( "<div>" ).appendTo( "#qunit-fixture" );
847847

848848
$div.css( "fill-opacity", 1 );
849849

850850
// Support: Android 2.3 (no support for fill-opacity)
851-
if ( $div.css( "fill-opacity" ) ) {
851+
if ( $div.css( "fill-opacity" ) !== undefined ) {
852852
assert.equal( $div.css( "fill-opacity" ), 1, "Do not append px to 'fill-opacity'" );
853853
} else {
854854
assert.ok( true, "No support for fill-opacity CSS property" );
855855
}
856856

857857
$div.css( "column-count", 1 );
858-
if ( $div.css( "column-count" ) ) {
858+
if ( $div.css( "column-count" ) !== undefined ) {
859859
assert.equal( $div.css( "column-count" ), 1, "Do not append px to 'column-count'" );
860860
} else {
861861
assert.ok( true, "No support for column-count CSS property" );
862862
}
863+
864+
$div.css( "animation-iteration-count", 2 );
865+
if ( $div.css( "animation-iteration-count" ) !== undefined ) {
866+
// if $div.css( "animation-iteration-count" ) return "1",
867+
// it actually return the default value of animation-iteration-count
868+
assert.equal( $div.css( "animation-iteration-count" ), 2, "Do not append px to 'animation-iteration-count'" );
869+
} else {
870+
assert.ok( true, "No support for animation-iteration-count CSS property" );
871+
}
863872
} );
864873

865874
QUnit.test( "css('width') and css('height') should respect box-sizing, see #11004", function( assert ) {

0 commit comments

Comments
 (0)