From 4deb824699b025d74d6849a73ec47c182df93fa0 Mon Sep 17 00:00:00 2001 From: Scott González Date: Wed, 21 Jul 2010 22:17:52 -0400 Subject: Core: Added .outerWidth(), .outerHeight(), .innerWidth(), .innerHeight(). Fixes #5850 - .outerWidth(), .outerHeight(), .innerWidth(), .innerHeight() setters. --- tests/unit/core/core.js | 108 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) (limited to 'tests/unit/core/core.js') diff --git a/tests/unit/core/core.js b/tests/unit/core/core.js index 6c550ce0e..cb2a14570 100644 --- a/tests/unit/core/core.js +++ b/tests/unit/core/core.js @@ -46,4 +46,112 @@ test('zIndex', function() { equals($('#zIndexAutoNoParent').zIndex(), 0, 'zIndex never explicitly set in hierarchy'); }); +test( "innerWidth - getter", function() { + var el = $( "#dimensions" ); + + equals( el.innerWidth(), 122, "getter passthru" ); + el.hide(); + equals( el.innerWidth(), 122, "getter passthru when hidden" ); +}); + +test( "innerWidth - setter", function() { + var el = $( "#dimensions" ); + + el.innerWidth( 120 ); + equals( el.width(), 98, "width set properly" ); + el.hide(); + el.innerWidth( 100 ); + equals( el.width(), 78, "width set properly when hidden" ); +}); + +test( "innerHeight - getter", function() { + var el = $( "#dimensions" ); + + equals( el.innerHeight(), 70, "getter passthru" ); + el.hide(); + equals( el.innerHeight(), 70, "getter passthru when hidden" ); +}); + +test( "innerHeight - setter", function() { + var el = $( "#dimensions" ); + + el.innerHeight( 60 ); + equals( el.height(), 40, "height set properly" ); + el.hide(); + el.innerHeight( 50 ); + equals( el.height(), 30, "height set properly when hidden" ); +}); + +test( "outerWidth - getter", function() { + var el = $( "#dimensions" ); + + equals( el.outerWidth(), 140, "getter passthru" ); + el.hide(); + equals( el.outerWidth(), 140, "getter passthru when hidden" ); +}); + +test( "outerWidth - setter", function() { + var el = $( "#dimensions" ); + + el.outerWidth( 130 ); + equals( el.width(), 90, "width set properly" ); + el.hide(); + el.outerWidth( 120 ); + equals( el.width(), 80, "width set properly when hidden" ); +}); + +test( "outerWidth(true) - getter", function() { + var el = $( "#dimensions" ); + + equals( el.outerWidth(true), 154, "getter passthru w/ margin" ); + el.hide(); + equals( el.outerWidth(true), 154, "getter passthru w/ margin when hidden" ); +}); + +test( "outerWidth(true) - setter", function() { + var el = $( "#dimensions" ); + + el.outerWidth( 130, true ); + equals( el.width(), 76, "width set properly" ); + el.hide(); + el.outerWidth( 120, true ); + equals( el.width(), 66, "width set properly when hidden" ); +}); + +test( "outerHeight - getter", function() { + var el = $( "#dimensions" ); + + equals( el.outerHeight(), 86, "getter passthru" ); + el.hide(); + equals( el.outerHeight(), 86, "getter passthru when hidden" ); +}); + +test( "outerHeight - setter", function() { + var el = $( "#dimensions" ); + + el.outerHeight( 80 ); + equals( el.height(), 44, "height set properly" ); + el.hide(); + el.outerHeight( 70 ); + equals( el.height(), 34, "height set properly when hidden" ); +}); + +test( "outerHeight(true) - getter", function() { + var el = $( "#dimensions" ); + + equals( el.outerHeight(true), 98, "getter passthru w/ margin" ); + el.hide(); + equals( el.outerHeight(true), 98, "getter passthru w/ margin when hidden" ); +}); + +test( "outerHeight(true) - setter", function() { + var el = $( "#dimensions" ); + + el.outerHeight( 90, true ); + equals( el.height(), 42, "height set properly" ); + el.hide(); + el.outerHeight( 80, true ); + equals( el.height(), 32, "height set properly when hidden" ); +}); + })(jQuery); -- cgit v1.2.3