3 test("width()", function() {
6 var $div = jQuery("#nothiddendiv");
8 equals($div.width(), 30, "Test set to 30 correctly");
10 equals($div.width(), 30, "Test hidden div");
12 $div.width(-1); // handle negative numbers by ignoring #1599
13 equals($div.width(), 30, "Test negative width ignored");
14 $div.css("padding", "20px");
15 equals($div.width(), 30, "Test padding specified with pixels");
16 $div.css("border", "2px solid #fff");
17 equals($div.width(), 30, "Test border specified with pixels");
18 //$div.css("padding", "2em");
19 //equals($div.width(), 30, "Test padding specified with ems");
20 //$div.css("border", "1em solid #fff");
21 //DISABLED - Opera 9.6 fails this test, returns 8
22 //equals($div.width(), 30, "Test border specified with ems");
23 //$div.css("padding", "2%");
24 //equals($div.width(), 30, "Test padding specified with percent");
26 $div.css({ display: "", border: "", padding: "" });
28 jQuery("#nothiddendivchild").css({ padding: "3px", border: "2px solid #fff" });
29 equals(jQuery("#nothiddendivchild").width(), 20, "Test child width with border and padding");
30 jQuery("#nothiddendiv, #nothiddendivchild").css({ border: "", padding: "", width: "" });
32 var blah = jQuery("blah");
33 equals( blah.width(10), blah, "Make sure that setting a width on an empty set returns the set." );
36 test("height()", function() {
39 var $div = jQuery("#nothiddendiv");
41 equals($div.height(), 30, "Test set to 30 correctly");
43 equals($div.height(), 30, "Test hidden div");
45 $div.height(-1); // handle negative numbers by ignoring #1599
46 equals($div.height(), 30, "Test negative height ignored");
47 $div.css("padding", "20px");
48 equals($div.height(), 30, "Test padding specified with pixels");
49 $div.css("border", "2px solid #fff");
50 equals($div.height(), 30, "Test border specified with pixels");
51 //$div.css("padding", "2em");
52 //equals($div.height(), 30, "Test padding specified with ems");
53 //$div.css("border", "1em solid #fff");
54 //DISABLED - Opera 9.6 fails this test, returns 8
55 //equals($div.height(), 30, "Test border specified with ems");
56 //$div.css("padding", "2%");
57 //equals($div.height(), 30, "Test padding specified with percent");
59 $div.css({ display: "", border: "", padding: "", height: "1px" });
61 var blah = jQuery("blah");
62 equals( blah.height(10), blah, "Make sure that setting a height on an empty set returns the set." );
65 test("innerWidth()", function() {
68 var $div = jQuery("#nothiddendiv");
72 border: "2px solid #fff",
76 equals($div.innerWidth(), 30, "Test with margin and border");
77 $div.css("padding", "20px");
78 equals($div.innerWidth(), 70, "Test with margin, border and padding");
80 equals($div.innerWidth(), 70, "Test hidden div");
83 $div.css({ display: "", border: "", padding: "", width: "", height: "" });
86 test("innerHeight()", function() {
89 var $div = jQuery("#nothiddendiv");
93 border: "2px solid #fff",
97 equals($div.innerHeight(), 30, "Test with margin and border");
98 $div.css("padding", "20px");
99 equals($div.innerHeight(), 70, "Test with margin, border and padding");
101 equals($div.innerHeight(), 70, "Test hidden div");
104 $div.css({ display: "", border: "", padding: "", width: "", height: "" });
107 test("outerWidth()", function() {
110 var $div = jQuery("#nothiddendiv");
111 $div.css("width", 30);
113 equals($div.outerWidth(), 30, "Test with only width set");
114 $div.css("padding", "20px");
115 equals($div.outerWidth(), 70, "Test with padding");
116 $div.css("border", "2px solid #fff");
117 equals($div.outerWidth(), 74, "Test with padding and border");
118 $div.css("margin", "10px");
119 equals($div.outerWidth(), 74, "Test with padding, border and margin without margin option");
120 $div.css("position", "absolute");
121 equals($div.outerWidth(true), 94, "Test with padding, border and margin with margin option");
123 equals($div.outerWidth(true), 94, "Test hidden div with padding, border and margin with margin option");
126 $div.css({ position: "", display: "", border: "", padding: "", width: "", height: "" });
129 test("outerHeight()", function() {
132 var $div = jQuery("#nothiddendiv");
133 $div.css("height", 30);
135 equals($div.outerHeight(), 30, "Test with only width set");
136 $div.css("padding", "20px");
137 equals($div.outerHeight(), 70, "Test with padding");
138 $div.css("border", "2px solid #fff");
139 equals($div.outerHeight(), 74, "Test with padding and border");
140 $div.css("margin", "10px");
141 equals($div.outerHeight(), 74, "Test with padding, border and margin without margin option");
142 equals($div.outerHeight(true), 94, "Test with padding, border and margin with margin option");
144 equals($div.outerHeight(true), 94, "Test hidden div with padding, border and margin with margin option");
147 $div.css({ display: "", border: "", padding: "", width: "", height: "" });