bug 654352 - follow up to make test for document.caretPositionFromPoint API more reliable r=me
authorBrad Lassey <blassey@mozilla.com>
Thu, 18 Aug 2011 19:05:49 -0400
changeset 75512 66dbf7e560ca9de619d9bfd7740329392ef64c05
parent 75511 9cc3a0162863e70bff1d5c9b358580c40c41ce9e
child 75513 c83fb1dd0e785e0b5f31fdeaa77a73cdda329603
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
reviewersme
bugs654352
milestone9.0a1
bug 654352 - follow up to make test for document.caretPositionFromPoint API more reliable r=me
content/base/test/test_bug654352.html
--- a/content/base/test/test_bug654352.html
+++ b/content/base/test/test_bug654352.html
@@ -18,26 +18,26 @@ https://bugzilla.mozilla.org/show_bug.cg
 <pre id="test">
 <script type="application/javascript">
 /** Test for Bug 654352 **/
 SimpleTest.waitForExplicitFinish();
 function afterLoad() {
   var testpre = document.getElementById("testpre");
   var rect1 = testpre.getBoundingClientRect();
   dump(rect1 + "\n");
-  var caret1 = document.caretPositionFromPoint(rect1.left + 30, rect1.top + 10);
+  var caret1 = document.caretPositionFromPoint(rect1.right - 5, rect1.top + 10);
   ok(caret1.offsetNode == testpre.firstChild, "node in CaretPosition not correct (" + caret1.offsetNode + " == " + testpre.firstChild + ")")
-  ok(caret1.offset == 5, "offset in CaretPosition not correct (" + caret1.offset + "== 5)")
+  ok(caret1.offset == 9, "offset in CaretPosition not correct (" + caret1.offset + "== 9)")
 
   var testinput = document.getElementById("testinput");
   var rect2 = testinput.getBoundingClientRect();
   dump(rect2.top +", " + rect2.left + "\n");
-  var caret2 = document.caretPositionFromPoint( rect2.left + 30, rect2.top + 10);
+  var caret2 = document.caretPositionFromPoint( rect2.right - 5, rect2.top + 10);
   ok(caret2.offsetNode == testinput, "node in CaretPosition not correct (" + caret2.offsetNode + " == " + testinput + ")")
-  ok(caret2.offset == 6, "offset in CaretPosition not correct (" + caret2.offset + "== 6)")
+  ok(caret2.offset == 9, "offset in CaretPosition not correct (" + caret2.offset + "== 9)")
   SimpleTest.finish();
 };
 addLoadEvent(afterLoad);
 </script>
 </pre>
 <span id="testdiv">
   <pre id="testpre">test text</pre>
 </span>