@@ -1202,30 +1202,100 @@ if ( includesModule( "offset" ) ) {
12021202 } ) ;
12031203}
12041204
1205- QUnit . test ( "Do not append px (trac-9548, trac-12990, gh-2792)" , function ( assert ) {
1206- assert . expect ( 3 ) ;
1205+ QUnit . test ( "Do not append px (trac-9548, trac-12990, gh-2792, gh-5179 )" , function ( assert ) {
1206+ assert . expect ( 10 ) ;
12071207
1208- var $div = jQuery ( "<div>" ) . appendTo ( "#qunit-fixture" ) ;
1208+ var $div = jQuery ( "<div>" ) ,
1209+ $svg = jQuery (
1210+ "<svg xmlns='http://www.w3.org/2000/svg' width='200' height='200'>" +
1211+ " <path d=\" M 2,2 h 2\"></path>" +
1212+ "</svg>"
1213+ ) ,
1214+ $svgPath = $svg . find ( "path" ) ;
12091215
1210- $div . css ( "fill-opacity" , 1 ) ;
1216+ jQuery ( "#qunit-fixture" )
1217+ . append ( $div )
1218+ . append ( $svg ) ;
12111219
1212- assert . equal ( $div . css ( "fill-opacity" ) , 1 , "Do not append px to 'fill-opacity'" ) ;
1220+ // HTML
1221+
1222+ $div . css ( "animation-iteration-count" , 2 ) ;
1223+ if ( $div . css ( "animation-iteration-count" ) !== undefined ) {
1224+ // if $div.css( "animation-iteration-count" ) returns "1",
1225+ // it actually returns the default value of animation-iteration-count
1226+ assert . equal ( $div . css ( "animation-iteration-count" ) , "2" ,
1227+ "Does not append px to 'animation-iteration-count'" ) ;
1228+ } else {
1229+ assert . ok ( true , "No support for 'animation-iteration-count' CSS property" ) ;
1230+ }
1231+
1232+ // Support: Safari <15 only, iOS <15 only
1233+ // Older Safari doesn't support 'aspect-ratio' but it supports a non-standard
1234+ // 'WebkitAspectRatio' which interferes with this test.
1235+ if ( $div . css ( "-webkit-aspect-ratio" ) !== "auto" ) {
1236+ $div . css ( "aspect-ratio" , 2 ) ;
1237+ console . log ( "getComputedStyle( $div[ 0 ] ).aspectRatio" ,
1238+ getComputedStyle ( $div [ 0 ] ) . aspectRatio ) ;
1239+ window . div = $div [ 0 ] ;
1240+ if ( $div . css ( "aspect-ratio" ) !== undefined ) {
1241+ assert . equal ( $div . css ( "aspect-ratio" ) , "2 / 1" ,
1242+ "Does not append px to 'aspect-ratio'" ) ;
1243+ } else {
1244+ assert . ok ( true , "No support for 'aspect-ratio' CSS property" ) ;
1245+ }
1246+ } else {
1247+ assert . ok ( true , "No support for 'aspect-ratio' CSS property (WebKit)" ) ;
1248+ }
1249+
1250+ $div . css ( "border-image-slice" , 2 ) ;
1251+ if ( $div . css ( "border-image-slice" ) !== undefined ) {
1252+ assert . equal ( $div . css ( "border-image-slice" ) , "2" ,
1253+ "Does not append px to 'border-image-slice'" ) ;
1254+ } else {
1255+ assert . ok ( true , "No support for 'border-image-slice' CSS property" ) ;
1256+ }
12131257
12141258 $div . css ( "column-count" , 1 ) ;
12151259 if ( $div . css ( "column-count" ) !== undefined ) {
1216- assert . equal ( $div . css ( "column-count" ) , 1 , "Do not append px to 'column-count'" ) ;
1260+ assert . equal ( $div . css ( "column-count" ) , "1" ,
1261+ "Does not append px to 'column-count'" ) ;
12171262 } else {
1218- assert . ok ( true , "No support for column-count CSS property" ) ;
1263+ assert . ok ( true , "No support for ' column-count' CSS property" ) ;
12191264 }
12201265
1221- $div . css ( "animation-iteration-count" , 2 ) ;
1222- if ( $div . css ( "animation-iteration-count" ) !== undefined ) {
1223- // if $div.css( "animation-iteration-count" ) return "1",
1224- // it actually return the default value of animation-iteration-count
1225- assert . equal ( $div . css ( "animation-iteration-count" ) , 2 , "Do not append px to 'animation-iteration-count'" ) ;
1266+ $div . css ( "scale" , 2 ) ;
1267+ if ( $div . css ( "scale" ) !== undefined ) {
1268+ assert . equal ( $div . css ( "scale" ) , "2" , "Does not append px to 'scale'" ) ;
1269+ } else {
1270+ assert . ok ( true , "No support for 'scale' CSS property" ) ;
1271+ }
1272+
1273+ // SVG
1274+
1275+ $svgPath . css ( "fill-opacity" , 0.5 ) ;
1276+ assert . equal ( $svgPath . css ( "fill-opacity" ) , "0.5" ,
1277+ "Does not append px to 'fill-opacity'" ) ;
1278+
1279+ $svgPath . css ( "flood-opacity" , 0.5 ) ;
1280+ if ( $svgPath . css ( "flood-opacity" ) !== undefined ) {
1281+ assert . equal ( $svgPath . css ( "flood-opacity" ) , "0.5" ,
1282+ "Does not append px to 'flood-opacity'" ) ;
12261283 } else {
1227- assert . ok ( true , "No support for animation-iteration-count CSS property" ) ;
1284+ assert . ok ( true , "No support for 'flood-opacity' CSS property" ) ;
12281285 }
1286+
1287+ $svgPath . css ( "stop-opacity" , 0.5 ) ;
1288+ assert . equal ( $svgPath . css ( "stop-opacity" ) , "0.5" ,
1289+ "Does not append px to 'stop-opacity'" ) ;
1290+
1291+ $svgPath . css ( "stroke-miterlimit" , 1.5 ) ;
1292+ assert . equal ( $svgPath . css ( "stroke-miterlimit" ) , "1.5" ,
1293+ "Does not append px to 'stroke-miterlimit'" ) ;
1294+
1295+ $svgPath . css ( "stroke-opacity" , 0.5 ) ;
1296+ assert . equal ( $svgPath . css ( "stroke-opacity" ) , "0.5" ,
1297+ "Does not append px to 'stroke-opacity'" ) ;
1298+
12291299} ) ;
12301300
12311301
0 commit comments