aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit/selectmenu/options.js
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2023-05-10 10:56:02 +0200
committerGitHub <noreply@github.com>2023-05-10 10:56:02 +0200
commit23655f0dbdd0fff8498440ada710a32ad3ffc974 (patch)
tree777115e4c40f6f8bb61b99a335eb9ebf2d8bec21 /tests/unit/selectmenu/options.js
parent7adb13ac7c30a7ba33f1db256952be77b9e7a310 (diff)
downloadjquery-ui-23655f0dbdd0fff8498440ada710a32ad3ffc974.tar.gz
jquery-ui-23655f0dbdd0fff8498440ada710a32ad3ffc974.zip
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
Diffstat (limited to 'tests/unit/selectmenu/options.js')
-rw-r--r--tests/unit/selectmenu/options.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/tests/unit/selectmenu/options.js b/tests/unit/selectmenu/options.js
index 4a070f4eb..7e716394c 100644
--- a/tests/unit/selectmenu/options.js
+++ b/tests/unit/selectmenu/options.js
@@ -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