2 <script src=
"../../resources/js-test.js"></script>
5 testRunner
.dumpAsText();
7 <body style=
"margin-left:10px; margin-top:15px;">
8 <div style=
"-webkit-columns:3; columns:3;" id=
"mc">
9 <div id=
"elm1" class=
"rodent">elm1
</div>
12 <div id=
"elm2" class=
"rodent">elm2
</div>
13 <div id=
"elm3" class=
"rodent">elm3
</div>
15 <div id=
"elm4" class=
"rodent">elm4
</div>
16 <div id=
"elm5" class=
"rodent">elm5
</div>
20 var mc
= document
.getElementById('mc');
21 var elm1
= document
.getElementById('elm1');
22 var elm2
= document
.getElementById('elm2');
23 var elm3
= document
.getElementById('elm3');
24 var elm4
= document
.getElementById('elm4');
25 var elm5
= document
.getElementById('elm5');
26 shouldBe("mc.offsetLeft", "10");
27 shouldBe("mc.offsetTop", "15");
29 shouldBe("elm1.offsetLeft", "mc.offsetLeft");
30 shouldBe("elm1.offsetTop", "mc.offsetTop");
31 shouldBeGreaterThan("elm2.offsetLeft", "elm1.offsetLeft");
32 shouldBe("elm2.offsetTop", "elm1.offsetTop");
33 shouldBe("elm3.offsetLeft", "elm2.offsetLeft");
34 shouldBeGreaterThan("elm3.offsetTop", "elm2.offsetTop");
35 shouldBeGreaterThan("elm4.offsetLeft", "elm3.offsetLeft");
36 shouldBe("elm4.offsetTop", "elm1.offsetTop");
37 shouldBe("elm5.offsetLeft", "elm4.offsetLeft");
38 shouldBe("elm5.offsetTop", "elm3.offsetTop");
40 var elements
= document
.getElementsByClassName('rodent');
41 for (var i
= 0; i
< elements
.length
; i
++) {
42 var rects
= elements
[i
].getClientRects();
43 shouldBe("rects.length", "1");
44 shouldBe("rects[0].left", "elements[i].offsetLeft");
45 shouldBe("rects[0].top", "elements[i].offsetTop");