Skip to content

Commit 01fb17b

Browse files
ufologistmgol
authored andcommitted
CSS: Add animation-iteration-count to cssNumber, fix tests
(cherry-picked from df822ca) Fixes gh-2792 Closes gh-2793
1 parent 41c83f5 commit 01fb17b

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/css.js

+1
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ jQuery.extend( {
255255

256256
// Don't automatically add "px" to these possibly-unitless properties
257257
cssNumber: {
258+
"animationIterationCount": true,
258259
"columnCount": true,
259260
"fillOpacity": true,
260261
"flexGrow": true,

test/unit/css.js

+13-4
Original file line numberDiff line numberDiff line change
@@ -916,26 +916,35 @@ if ( jQuery.fn.offset ) {
916916
} );
917917
}
918918

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

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

924924
$div.css( "fill-opacity", 1 );
925925

926926
// Support: Android 2.3 (no support for fill-opacity)
927-
if ( $div.css( "fill-opacity" ) ) {
927+
if ( $div.css( "fill-opacity" ) !== undefined ) {
928928
assert.equal( $div.css( "fill-opacity" ), 1, "Do not append px to 'fill-opacity'" );
929929
} else {
930930
assert.ok( true, "No support for fill-opacity CSS property" );
931931
}
932932

933933
$div.css( "column-count", 1 );
934-
if ( $div.css( "column-count" ) ) {
934+
if ( $div.css( "column-count" ) !== undefined ) {
935935
assert.equal( $div.css( "column-count" ), 1, "Do not append px to 'column-count'" );
936936
} else {
937937
assert.ok( true, "No support for column-count CSS property" );
938938
}
939+
940+
$div.css( "animation-iteration-count", 2 );
941+
if ( $div.css( "animation-iteration-count" ) !== undefined ) {
942+
// if $div.css( "animation-iteration-count" ) return "1",
943+
// it actually return the default value of animation-iteration-count
944+
assert.equal( $div.css( "animation-iteration-count" ), 2, "Do not append px to 'animation-iteration-count'" );
945+
} else {
946+
assert.ok( true, "No support for animation-iteration-count CSS property" );
947+
}
939948
} );
940949

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

0 commit comments

Comments
 (0)