aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/dimensions.js
diff options
context:
space:
mode:
authorRichard Gibson <richard.gibson@gmail.com>2017-07-10 12:35:03 -0400
committerGitHub <noreply@github.com>2017-07-10 12:35:03 -0400
commit3fcddd6e72e7e318c0b062e391d60867732318ae (patch)
tree964159e428d90159e9c44e2c825e1715b478b63a /test/unit/dimensions.js
parenta6a28d24c183d4252bd269d89b3ddc5f4ae88863 (diff)
downloadjquery-3fcddd6e72e7e318c0b062e391d60867732318ae.tar.gz
jquery-3fcddd6e72e7e318c0b062e391d60867732318ae.zip
Dimensions: Detect and account for content-box dimension mishandling
Fixes gh-3699 Closes gh-3700
Diffstat (limited to 'test/unit/dimensions.js')
-rw-r--r--test/unit/dimensions.js17
1 files changed, 12 insertions, 5 deletions
diff --git a/test/unit/dimensions.js b/test/unit/dimensions.js
index 2ec5f3683..5db465868 100644
--- a/test/unit/dimensions.js
+++ b/test/unit/dimensions.js
@@ -585,7 +585,14 @@ QUnit.test( "interaction with scrollbars (gh-3589)", function( assert ) {
.css( borderBox )
.css( { "box-sizing": "border-box" } )
.appendTo( parent ),
- $boxes = jQuery( [ plainContentBox[ 0 ], contentBox[ 0 ], borderBox[ 0 ] ] );
+ $boxes = jQuery( [ plainContentBox[ 0 ], contentBox[ 0 ], borderBox[ 0 ] ] ),
+
+ // Support: IE 9 only
+ // Computed width seems to report content width even with "box-sizing: border-box", and
+ // "overflow: scroll" actually _shrinks_ the element (gh-3699).
+ borderBoxLoss =
+ borderBox.clone().css( { overflow: "auto" } ).appendTo( parent )[ 0 ].offsetWidth -
+ borderBox[ 0 ].offsetWidth;
for ( i = 0; i < 3; i++ ) {
if ( i === 1 ) {
@@ -616,13 +623,13 @@ QUnit.test( "interaction with scrollbars (gh-3589)", function( assert ) {
assert.equal( contentBox.outerHeight(), size + 2 * padding + 2 * borderWidth,
"content-box outerHeight includes scroll gutter" + suffix );
- assert.equal( borderBox.innerWidth(), size - 2 * borderWidth,
+ assert.equal( borderBox.innerWidth(), size - borderBoxLoss - 2 * borderWidth,
"border-box innerWidth includes scroll gutter" + suffix );
- assert.equal( borderBox.innerHeight(), size - 2 * borderWidth,
+ assert.equal( borderBox.innerHeight(), size - borderBoxLoss - 2 * borderWidth,
"border-box innerHeight includes scroll gutter" + suffix );
- assert.equal( borderBox.outerWidth(), size,
+ assert.equal( borderBox.outerWidth(), size - borderBoxLoss,
"border-box outerWidth includes scroll gutter" + suffix );
- assert.equal( borderBox.outerHeight(), size,
+ assert.equal( borderBox.outerHeight(), size - borderBoxLoss,
"border-box outerHeight includes scroll gutter" + suffix );
}
} );