From 3b6c1261539457f07dbfefc79f0d9a8c49f62d48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?= Date: Tue, 12 Aug 2025 00:08:58 +0200 Subject: [PATCH 1/2] 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 --- tests/unit/checkboxradio/options.js | 2 +- tests/unit/selectmenu/methods.js | 21 +++++++++++++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/tests/unit/checkboxradio/options.js b/tests/unit/checkboxradio/options.js index e2869ddbdc9..f573b472935 100644 --- a/tests/unit/checkboxradio/options.js +++ b/tests/unit/checkboxradio/options.js @@ -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 ); diff --git a/tests/unit/selectmenu/methods.js b/tests/unit/selectmenu/methods.js index f2506f2d300..c3860f5d6e9 100644 --- a/tests/unit/selectmenu/methods.js +++ b/tests/unit/selectmenu/methods.js @@ -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 + // wheh 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" ); From ac6bc89542b9b6dd941b2ad6f3ea995f4a95ea32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?= Date: Tue, 12 Aug 2025 22:01:40 +0200 Subject: [PATCH 2/2] fixup! Tests: Make tests not trigger Migrate 4.0.0-beta.1 warnings --- tests/unit/selectmenu/methods.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/unit/selectmenu/methods.js b/tests/unit/selectmenu/methods.js index c3860f5d6e9..52e31cbd4f7 100644 --- a/tests/unit/selectmenu/methods.js +++ b/tests/unit/selectmenu/methods.js @@ -44,7 +44,7 @@ QUnit.test( "enable / disable", function( assert ) { // Migrate 4.x warns about reading boolean attributes when their // value is not their lowercase name - but that's what happens - // wheh setting the `disabled` property to `true` first; the attribute + // 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