aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit/dimensions.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/dimensions.js')
-rw-r--r--test/unit/dimensions.js24
1 files changed, 16 insertions, 8 deletions
diff --git a/test/unit/dimensions.js b/test/unit/dimensions.js
index c9585f5ea..ef93aa7a3 100644
--- a/test/unit/dimensions.js
+++ b/test/unit/dimensions.js
@@ -35,9 +35,9 @@ function testWidth( val, assert ) {
$div = jQuery( "#nothiddendiv" );
$div.width( val( 30 ) );
assert.equal( $div.width(), 30, "Test set to 30 correctly" );
- $div.css( "display", "none" );
+ $div.hide();
assert.equal( $div.width(), 30, "Test hidden div" );
- $div.css( "display", "" );
+ $div.show();
$div.width( val( -1 ) ); // handle negative numbers by setting to 0 #11604
assert.equal( $div.width(), 0, "Test negative width normalized to 0" );
$div.css( "padding", "20px" );
@@ -56,6 +56,8 @@ function testWidth( val, assert ) {
assert.equal( blah.width(), null, "Make sure 'null' is returned on an empty set" );
assert.equal( jQuery( window ).width(), document.documentElement.clientWidth, "Window width is equal to width reported by window/document." );
+
+ assert.expectJqData( this, $div[ 0 ], "display" );
}
QUnit.test( "width()", function( assert ) {
@@ -86,9 +88,9 @@ function testHeight( val, assert ) {
$div = jQuery( "#nothiddendiv" );
$div.height( val( 30 ) );
assert.equal( $div.height(), 30, "Test set to 30 correctly" );
- $div.css( "display", "none" );
+ $div.hide();
assert.equal( $div.height(), 30, "Test hidden div" );
- $div.css( "display", "" );
+ $div.show();
$div.height( val( -1 ) ); // handle negative numbers by setting to 0 #11604
assert.equal( $div.height(), 0, "Test negative height normalized to 0" );
$div.css( "padding", "20px" );
@@ -107,6 +109,8 @@ function testHeight( val, assert ) {
assert.equal( blah.height(), null, "Make sure 'null' is returned on an empty set" );
assert.equal( jQuery( window ).height(), document.documentElement.clientHeight, "Window width is equal to width reported by window/document." );
+
+ assert.expectJqData( this, $div[ 0 ], "display" );
}
QUnit.test( "height()", function( assert ) {
@@ -149,7 +153,7 @@ QUnit.test( "innerWidth()", function( assert ) {
assert.equal( $div.innerWidth(), 30, "Test with margin and border" );
$div.css( "padding", "20px" );
assert.equal( $div.innerWidth(), 70, "Test with margin, border and padding" );
- $div.css( "display", "none" );
+ $div.hide();
assert.equal( $div.innerWidth(), 70, "Test hidden div" );
// reset styles
@@ -161,6 +165,7 @@ QUnit.test( "innerWidth()", function( assert ) {
assert.equal( div.innerWidth(), 0, "Make sure that disconnected nodes are handled." );
div.remove();
+ assert.expectJqData( this, $div[ 0 ], "display" );
} );
QUnit.test( "innerHeight()", function( assert ) {
@@ -183,7 +188,7 @@ QUnit.test( "innerHeight()", function( assert ) {
assert.equal( $div.innerHeight(), 30, "Test with margin and border" );
$div.css( "padding", "20px" );
assert.equal( $div.innerHeight(), 70, "Test with margin, border and padding" );
- $div.css( "display", "none" );
+ $div.hide();
assert.equal( $div.innerHeight(), 70, "Test hidden div" );
// reset styles
@@ -195,6 +200,7 @@ QUnit.test( "innerHeight()", function( assert ) {
assert.equal( div.innerHeight(), 0, "Make sure that disconnected nodes are handled." );
div.remove();
+ assert.expectJqData( this, $div[ 0 ], "display" );
} );
QUnit.test( "outerWidth()", function( assert ) {
@@ -221,7 +227,7 @@ QUnit.test( "outerWidth()", function( assert ) {
assert.equal( $div.outerWidth(), 74, "Test with padding, border and margin without margin option" );
$div.css( "position", "absolute" );
assert.equal( $div.outerWidth( true ), 94, "Test with padding, border and margin with margin option" );
- $div.css( "display", "none" );
+ $div.hide();
assert.equal( $div.outerWidth( true ), 94, "Test hidden div with padding, border and margin with margin option" );
// reset styles
@@ -233,6 +239,7 @@ QUnit.test( "outerWidth()", function( assert ) {
assert.equal( div.outerWidth(), 0, "Make sure that disconnected nodes are handled." );
div.remove();
+ assert.expectJqData( this, $div[ 0 ], "display" );
} );
QUnit.test( "child of a hidden elem (or unconnected node) has accurate inner/outer/Width()/Height() see #9441 #9300", function( assert ) {
@@ -376,7 +383,7 @@ QUnit.test( "outerHeight()", function( assert ) {
$div.css( "margin", "10px" );
assert.equal( $div.outerHeight(), 74, "Test with padding, border and margin without margin option" );
assert.equal( $div.outerHeight( true ), 94, "Test with padding, border and margin with margin option" );
- $div.css( "display", "none" );
+ $div.hide();
assert.equal( $div.outerHeight( true ), 94, "Test hidden div with padding, border and margin with margin option" );
// reset styles
@@ -388,6 +395,7 @@ QUnit.test( "outerHeight()", function( assert ) {
assert.equal( div.outerHeight(), 0, "Make sure that disconnected nodes are handled." );
div.remove();
+ assert.expectJqData( this, $div[ 0 ], "display" );
} );
QUnit.test( "passing undefined is a setter #5571", function( assert ) {