Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / spelling / spelling-should-replace-second-word.html
blob09dbe331b988c8fe3024602fb0fdc427ac7b103e
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../resources/js-test.js"></script>
5 <script src="resources/util.js"></script>
6 </head>
7 <body>
8 <div id="container">
9 <div id="destination" contentEditable></div>
10 </div>
12 <script>
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) {
22 if (nretry) {
23 window.setTimeout(function() { waitAndTest(nretry - 1, textNode); }, 0);
24 return;
27 // See if there is still a marker on "wordl".
28 spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 1);
29 shouldBeEqualToString("spellingMarkerRange.toString()", "wordl");
31 finishJSTest()
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);
46 }, true);
48 </script>
49 </body>
50 </html>