8000 Tests: Backport the `hidden="until-found"` attr tests from 3.x-stable by mgol · Pull Request #5619 · jquery/jquery · GitHub
[go: up one dir, main page]

Skip to content

Tests: Backport the hidden="until-found" attr tests from 3.x-stable #5619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 24, 2025
Merged
Changes from all commits
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
Tests: Backport the hidden="until-found" attr tests from 3.x-stable
The `hidden` attribute used to be a boolean one but it gained a new
`until-found` eventually. This led us to change the way we handle boolean
attributes in jQuery 4.0 in gh-5452 to avoid these issues in the future.

We haven't added an explicit test for the `"until-found"` value of the
`hidden` attribute which triggered this decision so far, though.
Backport the test from gh-5607 which landed on `3.x-stable` so that we
do test it.

Ref gh-5452
Ref gh-5607

(cherry picked from commit 85290c5)
  • Loading branch information
mgol committed Jan 27, 2025
commit 5e8c72b84d3f3f7f44c60703264a6864067b2718
18 changes: 18 additions & 0 deletions test/unit/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,24 @@ QUnit.test( "attr(String, Object)", function( assert ) {
assert.equal( jQuery( "#name" ).attr( "nonexisting", undefined ).attr( "nonexisting" ), undefined, ".attr('attribute', undefined) does not create attribute (trac-5571)" );
} );

QUnit.test( "attr( previously-boolean-attr, non-boolean-value)", function( assert ) {
assert.expect( 3 );

var div = jQuery( "<div></div>" ).appendTo( "#qunit-fixture" );

div.attr( "hidden", "foo" );
assert.strictEqual( div.attr( "hidden" ), "foo",
"Values not normalized for previously-boolean hidden attribute" );

div.attr( "hidden", "until-found" );
assert.strictEqual( div.attr( "hidden" ), "until-found",
"`until-found` value preserved for hidden attribute" );

div.attr( "hiDdeN", "uNtil-fOund" );
assert.strictEqual( div.attr( "hidden" ), "uNtil-fOund",
"`uNtil-fOund` different casing preserved" );
} );

QUnit.test( "attr(non-ASCII)", function( assert ) {
assert.expect( 2 );

Expand Down
Loading
0