🌐 AI搜索 & 代理 主页
Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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
  • Loading branch information
mgol authored and nikunj8866 committed Sep 9, 2025
commit ea2f0fa0d8c16e23369582da9c9d9f3debf86a4f
2 changes: 1 addition & 1 deletion tests/unit/checkboxradio/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand Down
21 changes: 19 additions & 2 deletions tests/unit/selectmenu/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -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" );
Expand Down