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: "" });
33 test("height()", function() {
36 var $div = jQuery("#nothiddendiv");
38 equals($div.height(), 30, "Test set to 30 correctly");
40 equals($div.height(), 30, "Test hidden div");
42 $div.height(-1); // handle negative numbers by ignoring #1599
43 equals($div.height(), 30, "Test negative height ignored");
44 $div.css("padding", "20px");
45 equals($div.height(), 30, "Test padding specified with pixels");
46 $div.css("border", "2px solid #fff");
47 equals($div.height(), 30, "Test border specified with pixels");
48 //$div.css("padding", "2em");
49 //equals($div.height(), 30, "Test padding specified with ems");
50 //$div.css("border", "1em solid #fff");
51 //DISABLED - Opera 9.6 fails this test, returns 8
52 //equals($div.height(), 30, "Test border specified with ems");
53 //$div.css("padding", "2%");
54 //equals($div.height(), 30, "Test padding specified with percent");
56 $div.css({ display: "", border: "", padding: "", height: "1px" });
59 test("innerWidth()", function() {
62 var $div = jQuery("#nothiddendiv");
66 border: "2px solid #fff",
70 equals($div.innerWidth(), 30, "Test with margin and border");
71 $div.css("padding", "20px");
72 equals($div.innerWidth(), 70, "Test with margin, border and padding");
74 equals($div.innerWidth(), 70, "Test hidden div");
77 $div.css({ display: "", border: "", padding: "", width: "", height: "" });
80 test("innerHeight()", function() {
83 var $div = jQuery("#nothiddendiv");
87 border: "2px solid #fff",
91 equals($div.innerHeight(), 30, "Test with margin and border");
92 $div.css("padding", "20px");
93 equals($div.innerHeight(), 70, "Test with margin, border and padding");
95 equals($div.innerHeight(), 70, "Test hidden div");
98 $div.css({ display: "", border: "", padding: "", width: "", height: "" });
101 test("outerWidth()", function() {
104 var $div = jQuery("#nothiddendiv");
105 $div.css("width", 30);
107 equals($div.outerWidth(), 30, "Test with only width set");
108 $div.css("padding", "20px");
109 equals($div.outerWidth(), 70, "Test with padding");
110 $div.css("border", "2px solid #fff");
111 equals($div.outerWidth(), 74, "Test with padding and border");
112 $div.css("margin", "10px");
113 equals($div.outerWidth(), 74, "Test with padding, border and margin without margin option");
114 $div.css("position", "absolute");
115 equals($div.outerWidth(true), 94, "Test with padding, border and margin with margin option");
117 equals($div.outerWidth(true), 94, "Test hidden div with padding, border and margin with margin option");
120 $div.css({ position: "", display: "", border: "", padding: "", width: "", height: "" });
123 test("outerHeight()", function() {
126 var $div = jQuery("#nothiddendiv");
127 $div.css("height", 30);
129 equals($div.outerHeight(), 30, "Test with only width set");
130 $div.css("padding", "20px");
131 equals($div.outerHeight(), 70, "Test with padding");
132 $div.css("border", "2px solid #fff");
133 equals($div.outerHeight(), 74, "Test with padding and border");
134 $div.css("margin", "10px");
135 equals($div.outerHeight(), 74, "Test with padding, border and margin without margin option");
136 equals($div.outerHeight(true), 94, "Test with padding, border and margin with margin option");
138 equals($div.outerHeight(true), 94, "Test hidden div with padding, border and margin with margin option");
141 $div.css({ display: "", border: "", padding: "", width: "", height: "" });