diff options
author | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2023-11-13 18:12:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-13 18:12:23 +0100 |
commit | b5b43adaceea5d21601e9e168a7a620164c1ac79 (patch) | |
tree | a221529da51014b083cea261ec362652a1f248b3 | |
parent | 4e989805236ce6401bfc7a08913957960bd71887 (diff) | |
download | jquery-b5b43adaceea5d21601e9e168a7a620164c1ac79.tar.gz jquery-b5b43adaceea5d21601e9e168a7a620164c1ac79.zip |
Tests: Workaround a tr width test issue in old iOS
Old iOS (<10) always rounds widths down, account for this in tests.
Closes gh-5361
Ref gh-5317
Ref gh-5359
-rw-r--r-- | test/unit/css.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/test/unit/css.js b/test/unit/css.js index a1c5267d7..2603e73d9 100644 --- a/test/unit/css.js +++ b/test/unit/css.js @@ -1402,7 +1402,7 @@ testIframe( ); ( function() { - var supportsFractionalTrWidth, + var supportsFractionalTrWidth, trWidth, epsilon = 0.1, table = jQuery( "<table><tr></tr></table>" ), tr = table.find( "tr" ); @@ -1429,12 +1429,16 @@ testIframe( jQuery( "#test" ).width( 600 ); assert.strictEqual( jQuery( "#test" ).width(), 600, "width should be 600" ); + trWidth = jQuery( "#test-tr" ).width(); if ( supportsFractionalTrWidth ) { assert.ok( - Math.abs( jQuery( "#test-tr" ).width() - 100.7 ) < epsilon, + Math.abs( trWidth - 100.7 ) < epsilon, "tr width should be fractional" ); } else { - assert.strictEqual( jQuery( "#test-tr" ).width(), 101, "tr width as expected" ); + + // Support: iOS <10 + // Old iOS always rounds down. + assert.strictEqual( trWidth === 100 ? 101 : trWidth, 101, "tr width as expected" ); } }, undefined, |