OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE HTML> | |
2 <script src="../../resources/js-test.js"></script> | |
3 <style> | |
4 html { | |
5 overflow-y: scroll; | |
6 overflow-x: scroll; | |
7 } | |
8 html, body { | |
9 margin: 0; | |
10 padding: 0; | |
11 } | |
12 body { | |
13 width: 100%; | |
14 height: 100%; | |
15 } | |
16 #simpleDiv { | |
17 width: 200px; | |
18 height: 200px; | |
19 background-color: rgba(0,255,0,0.5); | |
20 } | |
21 #beyondTopLeft { | |
22 position: absolute; | |
23 transform: translate3d(-100px, -100px, 10px); | |
24 left: 0; | |
25 top: 0; | |
26 width: 100px; | |
27 height: 100px; | |
28 background-color: rgba(0,0,0,0.1); | |
29 } | |
30 </style> | |
31 <body> | |
32 <div id="beyondTopLeft"></div> | |
Rick Byers
2015/02/20 20:02:24
did you intend to use this div somewhere? Seems l
pdr.
2015/02/22 23:28:13
It's used in the last testcase where we try to hit
| |
33 <div id="simpleDiv"></div> | |
34 <div id="console"></div> | |
35 <script> | |
36 if (window.testRunner) | |
37 testRunner.dumpAsText(); | |
38 | |
39 // Verify the document root element is the last element returned for empty queri es. | |
40 shouldBe('document.elementsFromPoint(300, 300)[0]', 'document.body.parentElement '); | |
41 | |
42 // Verify the document root element is the last element returned for valid queri es. | |
43 var simpleDiv = document.getElementById('simpleDiv'); | |
44 var simpleRect = simpleDiv.getBoundingClientRect(); | |
45 var simpleCoords = (simpleRect.right - 1) + ', ' + (simpleRect.bottom - 1); | |
46 shouldBe('document.elementsFromPoint(' + simpleCoords + ')[0]', 'simpleDiv'); | |
47 shouldBe('document.elementsFromPoint(' + simpleCoords + ')[1]', 'document.body') ; | |
48 shouldBe('document.elementsFromPoint(' + simpleCoords + ')[2]', 'document.body.p arentElement'); | |
49 | |
50 // Verify an empty sequence is returned for queries outside the viewport. | |
51 var bodyRect = document.body.getBoundingClientRect(); | |
52 var bodyScrollBar = (bodyRect.right + 1) + ', ' + (bodyRect.top + 1); | |
53 shouldBeEqualToNumber('document.elementsFromPoint(' + bodyScrollBar + ').length' , 0); | |
54 var outsideBodyLeft = (bodyRect.left - 1) + ', ' + (bodyRect.top + 1); | |
55 shouldBeEqualToNumber('document.elementsFromPoint(' + outsideBodyLeft + ').lengt h', 0); | |
56 var outsideBodyTopLeft = (bodyRect.left - 10) + ', ' + (bodyRect.top - 10); | |
57 shouldBeEqualToNumber('document.elementsFromPoint(' + outsideBodyTopLeft + ').le ngth', 0); | |
58 </script> | |
59 </body> | |
OLD | NEW |