4 <script src=
"../../resources/js-test.js"></script>
5 <script src=
"resources/util.js"></script>
9 <div id=
"destination" contentEditable
></div>
14 description("Spell check replaces the second misspelled of two when a selection is made. " +
15 "To test manually, type 'Helllo wordl.' and context-click on 'wordl'. " +
16 "The test succeeds if the marker doesn't disappear from 'wordl'.");
18 // Wait for async spellcheck to finish. If spellcheck is working correctly, the
19 // markers will *not* change on a word. So we can only know if the test has
20 // failed after 10 iterations, not when the test has succeeded.
21 function waitAndTest(nretry
, textNode
) {
23 window
.setTimeout(function() { waitAndTest(nretry
- 1, textNode
); }, 0);
27 // See if there is still a marker on "wordl".
28 spellingMarkerRange
= internals
.markerRangeForNode(textNode
, "spelling", 1);
29 shouldBeEqualToString("spellingMarkerRange.toString()", "wordl");
34 initSpellTest("destination", "Helllo wordl.", function (textNode
) {
35 window
.getSelection().removeAllRanges();
36 if (window
.testRunner
)
37 window
.testRunner
.dumpSpellCheckCallbacks();
39 // Context click on "wordl" to show the context menu.
40 var x
= destination
.offsetParent
.offsetLeft
+ destination
.offsetLeft
+ 60;
41 var y
= destination
.offsetParent
.offsetTop
+ destination
.offsetTop
+ destination
.offsetHeight
/ 2;
42 eventSender
.mouseMoveTo(x
, y
);
43 contextMenuElements
= eventSender
.contextClick();
45 window
.setTimeout(function () { waitAndTest(10, textNode
); }, 0);