4 width:
200px; height:
120px;
7 border: calc(
13px +
12px) solid;
11 border-left: calc(
13px +
12px) solid;
14 border-right: calc(
13px +
12px) solid;
17 border-top: calc(
13px +
12px) solid;
20 border-bottom: calc(
13px +
12px) solid;
24 <p class=
"simple-all">This element should have an overall border of
25 pixels.
</p>
25 <p class=
"simple-left">This element should have a left border of
25 pixels.
</p>
26 <p class=
"simple-right">This element should have a right border of
25 pixels.
</p>
27 <p class=
"simple-top">This element should have a top border of
25 pixels.
</p>
28 <p class=
"simple-bottom">This element should have a bottom border of
25 pixels.
</p>
31 if (window
.testRunner
)
32 testRunner
.dumpAsText();
35 var innerHeight
= 120;
38 var tests
= document
.getElementsByTagName("p");
39 for (var i
= 0; i
< tests
.length
; ++i
) {
40 var element
= tests
[i
];
41 var width
= element
.offsetWidth
;
42 var height
= element
.offsetHeight
;
44 var expectedWidth
= innerWidth
;
45 var expectedHeight
= innerHeight
;
47 switch (element
.className
.split("-")[1]) {
49 expectedWidth
+= 2 * border
;
50 expectedHeight
+= 2 * border
;
54 expectedHeight
+= border
;
58 expectedWidth
+= border
;
63 if (width
!= expectedWidth
)
64 error
.push("wrong width");
65 if (height
!= expectedHeight
)
66 error
.push("wrong height");
68 results
= document
.getElementById("results");
70 element
.style
.backgroundColor
= "green";
71 element
.innerHTML
+= " => PASS";
73 element
.style
.backgroundColor
= "red";
74 element
.innerHTML
+= " => FAIL: " + error
.join(", ");