Skip to content

Commit

Permalink
Tests: Fix selectmenu width tests in Firefox with jQuery 3.0 & 3.1
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mgol committed May 10, 2023
1 parent 7adb13a commit 23655f0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/unit/selectmenu/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -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" );
Expand All @@ -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
Expand Down

0 comments on commit 23655f0

Please sign in to comment.