OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <style> |
| 3 body { |
| 4 margin:0; |
| 5 } |
| 6 |
| 7 #mc { |
| 8 -webkit-columns: 3; |
| 9 -webkit-column-gap: 20px; |
| 10 width: 280px; |
| 11 margin:20px 100px; |
| 12 font: 20px/1 Ahem; |
| 13 } |
| 14 |
| 15 #log { |
| 16 position: absolute; |
| 17 top: 101px; |
| 18 } |
| 19 </style> |
| 20 <div id="log"> |
| 21 <p id="description"></p> |
| 22 <div id="console"></div> |
| 23 </div> |
| 24 <div id="mc">xxx xxx xxx xxx xxx xxx xxx xxx xxx</div> |
| 25 <script src="../../resources/js-test.js"></script> |
| 26 <script> |
| 27 description("Test that hitting areas outside columns takes us to the right t
ext content inside columns."); |
| 28 |
| 29 debug("Above first column:"); |
| 30 shouldBe("document.caretRangeFromPoint(50,0).startOffset", "0"); |
| 31 shouldBe("document.caretRangeFromPoint(150,0).startOffset", "0"); |
| 32 shouldBe("document.caretRangeFromPoint(189,0).startOffset", "0"); |
| 33 |
| 34 debug("Above second column:"); |
| 35 shouldBe("document.caretRangeFromPoint(190,0).startOffset", "12"); |
| 36 shouldBe("document.caretRangeFromPoint(250,0).startOffset", "12"); |
| 37 shouldBe("document.caretRangeFromPoint(289,0).startOffset", "12"); |
| 38 |
| 39 debug("Above third column:"); |
| 40 shouldBe("document.caretRangeFromPoint(290,0).startOffset", "24"); |
| 41 shouldBe("document.caretRangeFromPoint(350,0).startOffset", "24"); |
| 42 shouldBe("document.caretRangeFromPoint(450,0).startOffset", "24"); |
| 43 |
| 44 debug("Below first column:"); |
| 45 shouldBe("document.caretRangeFromPoint(50,100).startOffset", "12"); |
| 46 shouldBe("document.caretRangeFromPoint(150,100).startOffset", "12"); |
| 47 shouldBe("document.caretRangeFromPoint(189,100).startOffset", "12"); |
| 48 |
| 49 debug("Below second column:"); |
| 50 shouldBe("document.caretRangeFromPoint(190,100).startOffset", "24"); |
| 51 shouldBe("document.caretRangeFromPoint(250,100).startOffset", "24"); |
| 52 shouldBe("document.caretRangeFromPoint(289,100).startOffset", "24"); |
| 53 |
| 54 debug("To the left of the first column:"); |
| 55 shouldBe("document.caretRangeFromPoint(0,10).startOffset", "0"); |
| 56 shouldBe("document.caretRangeFromPoint(0,30).startOffset", "0"); |
| 57 shouldBe("document.caretRangeFromPoint(0,50).startOffset", "4"); |
| 58 shouldBe("document.caretRangeFromPoint(0,70).startOffset", "8"); |
| 59 shouldBe("document.caretRangeFromPoint(0,90).startOffset", "12"); |
| 60 |
| 61 debug("To the right of the third column:"); |
| 62 shouldBe("document.caretRangeFromPoint(400,10).startOffset", "24"); |
| 63 shouldBe("document.caretRangeFromPoint(400,30).startOffset", "27"); |
| 64 shouldBe("document.caretRangeFromPoint(400,50).startOffset", "31"); |
| 65 shouldBe("document.caretRangeFromPoint(400,70).startOffset", "35"); |
| 66 |
| 67 debug("In the gap between the first and second columns:"); |
| 68 shouldBe("document.caretRangeFromPoint(180,20).startOffset", "3"); |
| 69 shouldBe("document.caretRangeFromPoint(180,40).startOffset", "7"); |
| 70 shouldBe("document.caretRangeFromPoint(180,60).startOffset", "11"); |
| 71 shouldBe("document.caretRangeFromPoint(180,69).startOffset", "11"); |
| 72 |
| 73 debug("In the gap between the second and third columns:"); |
| 74 shouldBe("document.caretRangeFromPoint(280,20).startOffset", "15"); |
| 75 shouldBe("document.caretRangeFromPoint(280,40).startOffset", "19"); |
| 76 shouldBe("document.caretRangeFromPoint(280,60).startOffset", "23"); |
| 77 shouldBe("document.caretRangeFromPoint(280,69).startOffset", "23"); |
| 78 </script> |
OLD | NEW |