Tests: Fix selectmenu width tests in Firefox with jQuery 3.0 & 3.1

jQuery 3.0 & 3.1 used `getBoundingClientRect()` in its `width`/`height`
calculations and that causes minor differences in fractional width computations.
Allow a tiny delta in tests to fix those tests breaking in Firefox.

Ref jquery/jquery#3561
Closes gh-2159
This commit is contained in:
Michał Gołębiowski-Owczarek 2023-05-10 10:56:02 +02:00 committed by GitHub
parent 7adb13ac7c
commit 23655f0dbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -101,7 +101,7 @@ QUnit.test( "width", function( assert ) {
assert.equal( button[ 0 ].style.width, "", "no inline style" );
element.selectmenu( "option", "width", null );
assert.equal( button.outerWidth(), element.outerWidth(), "button width auto" );
assert.close( button.outerWidth(), element.outerWidth(), 0.01, "button width auto" );
element.outerWidth( 100 );
element.selectmenu( "refresh" );
@ -117,7 +117,8 @@ QUnit.test( "width", function( assert ) {
.append( $( "<option>", { text: "Option with a little longer text" } ) )
.selectmenu( "option", "width", null )
.selectmenu( "refresh" );
assert.equal( button.outerWidth(), element.outerWidth(), "button width with long option" );
assert.close( button.outerWidth(), element.outerWidth(), 0.01,
"button width with long option" );
element.parent().outerWidth( 300 );
element