8 return function(){ return val; };
11 function testWidth( val ) {
14 var $div = jQuery("#nothiddendiv");
15 $div.width( val(30) );
16 equals($div.width(), 30, "Test set to 30 correctly");
18 equals($div.width(), 30, "Test hidden div");
20 $div.width( val(-1) ); // handle negative numbers by ignoring #1599
21 equals($div.width(), 30, "Test negative width ignored");
22 $div.css("padding", "20px");
23 equals($div.width(), 30, "Test padding specified with pixels");
24 $div.css("border", "2px solid #fff");
25 equals($div.width(), 30, "Test border specified with pixels");
27 $div.css({ display: "", border: "", padding: "" });
29 jQuery("#nothiddendivchild").css({ width: 20, padding: "3px", border: "2px solid #fff" });
30 equals(jQuery("#nothiddendivchild").width(), 20, "Test child width with border and padding");
31 jQuery("#nothiddendiv, #nothiddendivchild").css({ border: "", padding: "", width: "" });
33 var blah = jQuery("blah");
34 equals( blah.width( val(10) ), blah, "Make sure that setting a width on an empty set returns the set." );
35 equals( blah.width(), null, "Make sure 'null' is returned on an empty set");
38 test("width()", function() {
42 test("width() with function", function() {
46 test("width() with function args", function() {
49 var $div = jQuery("#nothiddendiv");
50 $div.width( 30 ).width(function(i, width) {
51 equals( width, 30, "Make sure previous value is corrrect." );
55 equals( $div.width(), 31, "Make sure value was modified correctly." );
58 function testHeight( val ) {
61 var $div = jQuery("#nothiddendiv");
62 $div.height( val(30) );
63 equals($div.height(), 30, "Test set to 30 correctly");
65 equals($div.height(), 30, "Test hidden div");
67 $div.height( val(-1) ); // handle negative numbers by ignoring #1599
68 equals($div.height(), 30, "Test negative height ignored");
69 $div.css("padding", "20px");
70 equals($div.height(), 30, "Test padding specified with pixels");
71 $div.css("border", "2px solid #fff");
72 equals($div.height(), 30, "Test border specified with pixels");
74 $div.css({ display: "", border: "", padding: "", height: "1px" });
76 jQuery("#nothiddendivchild").css({ height: 20, padding: "3px", border: "2px solid #fff" });
77 equals(jQuery("#nothiddendivchild").height(), 20, "Test child height with border and padding");
78 jQuery("#nothiddendiv, #nothiddendivchild").css({ border: "", padding: "", height: "" });
80 var blah = jQuery("blah");
81 equals( blah.height( val(10) ), blah, "Make sure that setting a height on an empty set returns the set." );
82 equals( blah.height(), null, "Make sure 'null' is returned on an empty set");
85 test("height()", function() {
89 test("height() with function", function() {
93 test("height() with function args", function() {
96 var $div = jQuery("#nothiddendiv");
97 $div.height( 30 ).height(function(i, height) {
98 equals( height, 30, "Make sure previous value is corrrect." );
102 equals( $div.height(), 31, "Make sure value was modified correctly." );
105 test("innerWidth()", function() {
108 var $div = jQuery("#nothiddendiv");
112 border: "2px solid #fff",
116 equals($div.innerWidth(), 30, "Test with margin and border");
117 $div.css("padding", "20px");
118 equals($div.innerWidth(), 70, "Test with margin, border and padding");
120 equals($div.innerWidth(), 70, "Test hidden div");
123 $div.css({ display: "", border: "", padding: "", width: "", height: "" });
125 var div = jQuery( "<div>" );
127 // Temporarily require 0 for backwards compat - should be auto
128 equals( div.innerWidth(), 0, "Make sure that disconnected nodes are handled." );
131 test("innerHeight()", function() {
134 var $div = jQuery("#nothiddendiv");
138 border: "2px solid #fff",
142 equals($div.innerHeight(), 30, "Test with margin and border");
143 $div.css("padding", "20px");
144 equals($div.innerHeight(), 70, "Test with margin, border and padding");
146 equals($div.innerHeight(), 70, "Test hidden div");
149 $div.css({ display: "", border: "", padding: "", width: "", height: "" });
151 var div = jQuery( "<div>" );
153 // Temporarily require 0 for backwards compat - should be auto
154 equals( div.innerHeight(), 0, "Make sure that disconnected nodes are handled." );
157 test("outerWidth()", function() {
160 var $div = jQuery("#nothiddendiv");
161 $div.css("width", 30);
163 equals($div.outerWidth(), 30, "Test with only width set");
164 $div.css("padding", "20px");
165 equals($div.outerWidth(), 70, "Test with padding");
166 $div.css("border", "2px solid #fff");
167 equals($div.outerWidth(), 74, "Test with padding and border");
168 $div.css("margin", "10px");
169 equals($div.outerWidth(), 74, "Test with padding, border and margin without margin option");
170 $div.css("position", "absolute");
171 equals($div.outerWidth(true), 94, "Test with padding, border and margin with margin option");
173 equals($div.outerWidth(true), 94, "Test hidden div with padding, border and margin with margin option");
176 $div.css({ position: "", display: "", border: "", padding: "", width: "", height: "" });
178 var div = jQuery( "<div>" );
180 // Temporarily require 0 for backwards compat - should be auto
181 equals( div.outerWidth(), 0, "Make sure that disconnected nodes are handled." );
184 test("outerHeight()", function() {
187 var $div = jQuery("#nothiddendiv");
188 $div.css("height", 30);
190 equals($div.outerHeight(), 30, "Test with only width set");
191 $div.css("padding", "20px");
192 equals($div.outerHeight(), 70, "Test with padding");
193 $div.css("border", "2px solid #fff");
194 equals($div.outerHeight(), 74, "Test with padding and border");
195 $div.css("margin", "10px");
196 equals($div.outerHeight(), 74, "Test with padding, border and margin without margin option");
197 equals($div.outerHeight(true), 94, "Test with padding, border and margin with margin option");
199 equals($div.outerHeight(true), 94, "Test hidden div with padding, border and margin with margin option");
202 $div.css({ display: "", border: "", padding: "", width: "", height: "" });
204 var div = jQuery( "<div>" );
206 // Temporarily require 0 for backwards compat - should be auto
207 equals( div.outerHeight(), 0, "Make sure that disconnected nodes are handled." );