Skip to content

Commit b9a6958

Browse files
ufologistmgol
authored andcommitted
CSS: Add animation-iteration-count to cssNumber, fix tests
Fixes gh-2792 Closes gh-2793
1 parent 636a2bd commit b9a6958

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
@@ -252,6 +252,7 @@ jQuery.extend( {
252252

253253
// Don't automatically add "px" to these possibly-unitless properties
254254
cssNumber: {
255+
"animationIterationCount": true,
255256
"columnCount": true,
256257
"fillOpacity": true,
257258
"flexGrow": true,

test/unit/css.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -848,26 +848,35 @@ if ( jQuery.fn.offset ) {
848848
} );
849849
}
850850

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

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

856856
$div.css( "fill-opacity", 1 );
857857

858858
// Support: Android 2.3 (no support for fill-opacity)
859-
if ( $div.css( "fill-opacity" ) ) {
859+
if ( $div.css( "fill-opacity" ) !== undefined ) {
860860
assert.equal( $div.css( "fill-opacity" ), 1, "Do not append px to 'fill-opacity'" );
861861
} else {
862862
assert.ok( true, "No support for fill-opacity CSS property" );
863863
}
864864

865865
$div.css( "column-count", 1 );
866-
if ( $div.css( "column-count" ) ) {
866+
if ( $div.css( "column-count" ) !== undefined ) {
867867
assert.equal( $div.css( "column-count" ), 1, "Do not append px to 'column-count'" );
868868
} else {
869869
assert.ok( true, "No support for column-count CSS property" );
870870
}
871+
872+
$div.css( "animation-iteration-count", 2 );
873+
if ( $div.css( "animation-iteration-count" ) !== undefined ) {
874+
// if $div.css( "animation-iteration-count" ) return "1",
875+
// it actually return the default value of animation-iteration-count
876+
assert.equal( $div.css( "animation-iteration-count" ), 2, "Do not append px to 'animation-iteration-count'" );
877+
} else {
878+
assert.ok( true, "No support for animation-iteration-count CSS property" );
879+
}
871880
} );
872881

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

0 commit comments

Comments
 (0)