mirror of
https://github.com/jquery/jquery-ui.git
synced 2026-01-09 17:38:16 -05:00
Tests: Make tests not trigger Migrate 4.0.0-beta.1 warnings
Changes: * Checkboxradio: Change `.attr( "checked", true )` to `.attr( "checked", "checked" ) * Selectmenu: Disable the `boolean-attributes` patch for one assertion where it's impossible to avoid Closes gh-2364
This commit is contained in:
committed by
GitHub
parent
73d063677a
commit
a7ac081009
@@ -97,7 +97,7 @@ QUnit.test( "icon - default unchecked", function( assert ) {
|
||||
} );
|
||||
|
||||
QUnit.test( "icon - default checked", function( assert ) {
|
||||
var checkbox = $( "#checkbox-option-icon" ).attr( "checked", true );
|
||||
var checkbox = $( "#checkbox-option-icon" ).attr( "checked", "checked" );
|
||||
|
||||
assert.expect( 2 );
|
||||
|
||||
|
||||
@@ -41,8 +41,25 @@ QUnit.test( "enable / disable", function( assert ) {
|
||||
|
||||
element.selectmenu( "disable" );
|
||||
assert.ok( element.selectmenu( "option", "disabled" ), "disable: widget option" );
|
||||
assert.ok( [ "disabled", "" ].indexOf( element.attr( "disabled" ) ) !== -1,
|
||||
"disable: native select disabled" );
|
||||
|
||||
// Migrate 4.x warns about reading boolean attributes when their
|
||||
// value is not their lowercase name - but that's what happens
|
||||
// when setting the `disabled` property to `true` first; the attribute
|
||||
// is then set to an empty string. Avoid the warning by temporarily
|
||||
// disabling the patch.
|
||||
// In real apps it's discouraged to mix `.prop()` & `.attr()` usage
|
||||
// for reflected property-attribute pairs.
|
||||
if ( $.migrateDisablePatches ) {
|
||||
$.migrateDisablePatches( "boolean-attributes" );
|
||||
}
|
||||
assert.ok(
|
||||
[ "disabled", "" ].indexOf( element.attr( "disabled" ) ) !== -1,
|
||||
"disable: native select disabled"
|
||||
);
|
||||
if ( $.migrateEnablePatches ) {
|
||||
$.migrateEnablePatches( "boolean-attributes" );
|
||||
}
|
||||
|
||||
assert.equal( button.attr( "aria-disabled" ), "true", "disable: button ARIA" );
|
||||
assert.equal( button.attr( "tabindex" ), -1, "disable: button tabindex" );
|
||||
assert.equal( menu.attr( "aria-disabled" ), "true", "disable: menu ARIA" );
|
||||
|
||||
Reference in New Issue
Block a user