mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
Tests: Use allowlist instead of whitelist
Closes gh-5420
This commit is contained in:
parent
c21c6f4ddf
commit
2b97b6bbcf
@ -1278,10 +1278,10 @@ QUnit.test( "Do not append px to most properties not accepting integer values",
|
|||||||
assert.equal( $div.css( "letter-spacing" ), "2px", "Do not append px to 'letter-spacing'" );
|
assert.equal( $div.css( "letter-spacing" ), "2px", "Do not append px to 'letter-spacing'" );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
QUnit.test( "Append px to whitelisted properties", function( assert ) {
|
QUnit.test( "Append px to allowlisted properties", function( assert ) {
|
||||||
var prop,
|
var prop,
|
||||||
$div = jQuery( "<div>" ).appendTo( "#qunit-fixture" ),
|
$div = jQuery( "<div>" ).appendTo( "#qunit-fixture" ),
|
||||||
whitelist = {
|
allowlist = {
|
||||||
margin: "marginTop",
|
margin: "marginTop",
|
||||||
marginTop: undefined,
|
marginTop: undefined,
|
||||||
marginRight: undefined,
|
marginRight: undefined,
|
||||||
@ -1314,10 +1314,10 @@ QUnit.test( "Append px to whitelisted properties", function( assert ) {
|
|||||||
borderLeftWidth: undefined
|
borderLeftWidth: undefined
|
||||||
};
|
};
|
||||||
|
|
||||||
assert.expect( ( Object.keys( whitelist ).length ) * 2 );
|
assert.expect( ( Object.keys( allowlist ).length ) * 2 );
|
||||||
|
|
||||||
for ( prop in whitelist ) {
|
for ( prop in allowlist ) {
|
||||||
var propToCheck = whitelist[ prop ] || prop,
|
var propToCheck = allowlist[ prop ] || prop,
|
||||||
kebabProp = prop.replace( /[A-Z]/g, function( match ) {
|
kebabProp = prop.replace( /[A-Z]/g, function( match ) {
|
||||||
return "-" + match.toLowerCase();
|
return "-" + match.toLowerCase();
|
||||||
} ),
|
} ),
|
||||||
|
Loading…
Reference in New Issue
Block a user