mirror of
https://github.com/jquery/jquery.git
synced 2024-11-23 02:54:22 +00:00
CSS:Tests: Fix tests & support tests under CSS Zoom
Firefox 126+ implements CSS zoom in a way it affects width computed style very slightly (`100.008px` instead of `100px`); accept that difference. Add a test for support tests resolving the same under CSS zoom & without one. That test uncovered Chrome failing the `reliableTrDimensions` support test under zoom; the test has been fixed. Fixes gh-5489 Closes gh-5495 Ref gh-5496
This commit is contained in:
parent
f2d9fde5f3
commit
071f6dba6b
@ -54,9 +54,9 @@ support.reliableTrDimensions = function() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
trStyle = window.getComputedStyle( tr );
|
trStyle = window.getComputedStyle( tr );
|
||||||
reliableTrDimensionsVal = ( parseInt( trStyle.height, 10 ) +
|
reliableTrDimensionsVal = ( Math.round( parseFloat( trStyle.height ) ) +
|
||||||
parseInt( trStyle.borderTopWidth, 10 ) +
|
Math.round( parseFloat( trStyle.borderTopWidth ) ) +
|
||||||
parseInt( trStyle.borderBottomWidth, 10 ) ) === tr.offsetHeight;
|
Math.round( parseFloat( trStyle.borderBottomWidth ) ) ) === tr.offsetHeight;
|
||||||
|
|
||||||
documentElement.removeChild( table );
|
documentElement.removeChild( table );
|
||||||
}
|
}
|
||||||
|
24
test/data/support/zoom.html
Normal file
24
test/data/support/zoom.html
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<style>
|
||||||
|
html {
|
||||||
|
zoom: 2.1;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div>
|
||||||
|
<script src="../../jquery.js"></script>
|
||||||
|
<script src="../iframeTest.js"></script>
|
||||||
|
<script src="getComputedSupport.js"></script>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
startIframeTest(
|
||||||
|
getComputedStyle( document.documentElement ),
|
||||||
|
getComputedSupport( jQuery.support )
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -1381,8 +1381,12 @@ testIframe(
|
|||||||
"css/cssWidthBrowserZoom.html",
|
"css/cssWidthBrowserZoom.html",
|
||||||
function( assert, jQuery, window, document, widthBeforeSet, widthAfterSet ) {
|
function( assert, jQuery, window, document, widthBeforeSet, widthAfterSet ) {
|
||||||
assert.expect( 2 );
|
assert.expect( 2 );
|
||||||
assert.strictEqual( widthBeforeSet, "100px", "elem.css('width') works correctly with browser zoom" );
|
|
||||||
assert.strictEqual( widthAfterSet, "100px", "elem.css('width', val) works correctly with browser zoom" );
|
// Support: Firefox 126+
|
||||||
|
// Newer Firefox implements CSS zoom in a way it affects
|
||||||
|
// those values slightly.
|
||||||
|
assert.ok( /^100(?:|\.0\d*)px$/.test( widthBeforeSet ), "elem.css('width') works correctly with browser zoom" );
|
||||||
|
assert.ok( /^100(?:|\.0\d*)px$/.test( widthAfterSet ), "elem.css('width', val) works correctly with browser zoom" );
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -66,6 +66,16 @@ testIframe(
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
testIframe(
|
||||||
|
"Verify correctness of support tests with CSS zoom on the root element",
|
||||||
|
"support/zoom.html",
|
||||||
|
function( assert, jQuery, window, document, htmlStyle, support ) {
|
||||||
|
assert.expect( 1 );
|
||||||
|
assert.deepEqual( jQuery.extend( {}, support ), computedSupport,
|
||||||
|
"Same support properties" );
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
( function() {
|
( function() {
|
||||||
var expected, browserKey,
|
var expected, browserKey,
|
||||||
userAgent = window.navigator.userAgent,
|
userAgent = window.navigator.userAgent,
|
||||||
|
Loading…
Reference in New Issue
Block a user