🌐 AI搜索 & 代理 主页
Skip to content

Commit 0dd32d3

Browse files
committed
Tests: Add tests for not auto-appending "px" to CSS Grid properties
Ref jquerygh-4007 Ref jquerygh-4028
1 parent dfa92cc commit 0dd32d3

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

test/unit/css.js

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1143,6 +1143,56 @@ QUnit.test( "Do not append px (#9548, #12990, #2792)", function( assert ) {
11431143
}
11441144
} );
11451145

1146+
1147+
QUnit[
1148+
jQuery( "<div/>" )[ 0 ].style.gridArea === "" ?
1149+
"test" :
1150+
"skip"
1151+
]( "Do not append px to CSS Grid-related properties (gh-4007)", function( assert ) {
1152+
assert.expect( 12 );
1153+
1154+
var prop, value, subProp, subValue, $div,
1155+
gridProps = {
1156+
"grid-area": {
1157+
"grid-row-start": "2",
1158+
"grid-row-end": "auto",
1159+
"grid-column-start": "auto",
1160+
"grid-column-end": "auto"
1161+
},
1162+
"grid-column": {
1163+
"grid-column-start": "2",
1164+
"grid-column-end": "auto"
1165+
},
1166+
"grid-column-end": true,
1167+
"grid-column-start": true,
1168+
"grid-row": {
1169+
"grid-row-start": "2",
1170+
"grid-row-end": "auto"
1171+
},
1172+
"grid-row-end": true,
1173+
"grid-row-start": true
1174+
};
1175+
1176+
for ( prop in gridProps ) {
1177+
$div = jQuery( "<div/>" ).appendTo( "#qunit-fixture" );
1178+
$div.css( prop, 2 );
1179+
1180+
value = gridProps[ prop ];
1181+
1182+
if ( typeof value === "object" ) {
1183+
for ( subProp in value ) {
1184+
subValue = value[ subProp ];
1185+
assert.equal( $div.css( subProp ), subValue,
1186+
"Do not append px to '" + prop + "' (retrieved " + subProp + ")" );
1187+
}
1188+
} else {
1189+
assert.equal( $div.css( prop ), "2", "Do not append px to '" + prop + "'" );
1190+
}
1191+
1192+
$div.remove();
1193+
}
1194+
} );
1195+
11461196
QUnit.test( "css('width') and css('height') should respect box-sizing, see #11004", function( assert ) {
11471197
assert.expect( 4 );
11481198

0 commit comments

Comments
 (0)