aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2023-11-07 00:35:52 +0100
committerGitHub <noreply@github.com>2023-11-07 00:35:52 +0100
commitb1e66a5faaf46ffcbcc27c79a9a224aaf851a987 (patch)
treec9d7be35b296bb57aee398f099b3786350ae8389 /test/unit
parentf47c6a83370675af0eff227d0266b40f9f45514a (diff)
downloadjquery-b1e66a5faaf46ffcbcc27c79a9a224aaf851a987.tar.gz
jquery-b1e66a5faaf46ffcbcc27c79a9a224aaf851a987.zip
CSS: Fix reliableTrDimensions support test for initially hidden iframes
Closes gh-5358 Ref gh-5317 Ref gh-5359
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/css.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/unit/css.js b/test/unit/css.js
index 146dcd9da..5567b7437 100644
--- a/test/unit/css.js
+++ b/test/unit/css.js
@@ -1386,6 +1386,47 @@ testIframe(
}
);
+( function() {
+ var supportsFractionalTrWidth,
+ epsilon = 0.1,
+ table = jQuery( "<table><tr></tr></table>" ),
+ tr = table.find( "tr" );
+
+ table
+ .appendTo( "#qunit-fixture" )
+ .css( {
+ width: "100.7px",
+ borderSpacing: 0
+ } );
+
+ supportsFractionalTrWidth = Math.abs( tr.width() - 100.7 ) < epsilon;
+
+ testIframe(
+ "Test computeStyleTests for hidden iframe",
+ "css/cssComputeStyleTests.html",
+ function( assert, jQuery, window, document, initialHeight ) {
+ assert.expect( 3 );
+
+ assert.strictEqual( initialHeight === 0 ? 20 : initialHeight, 20,
+ "hidden-frame content sizes should be zero or accurate" );
+
+ window.parent.jQuery( "#qunit-fixture-iframe" ).css( { "display": "block" } );
+ jQuery( "#test" ).width( 600 );
+ assert.strictEqual( jQuery( "#test" ).width(), 600, "width should be 600" );
+
+ if ( supportsFractionalTrWidth ) {
+ assert.ok(
+ Math.abs( jQuery( "#test-tr" ).width() - 100.7 ) < epsilon,
+ "tr width should be fractional" );
+ } else {
+ assert.strictEqual( jQuery( "#test-tr" ).width(), 101, "tr width as expected" );
+ }
+ },
+ undefined,
+ { "display": "none" }
+ );
+} )();
+
QUnit.testUnlessIE( "css('width') and css('height') should return fractional values for nodes in the document", function( assert ) {
assert.expect( 2 );