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
This commit is contained in:
Michał Gołębiowski-Owczarek 2023-11-13 18:12:23 +01:00 committed by GitHub
parent 4e98980523
commit b5b43adace
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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,