Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / spelling / spelling-insert-newline-between-multi-word-misspelling.html
blob3e3a9b2ab138777eeb61dbd1293b6f7ebee9c65b
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>
11 <script>
13 description("Spelling should work when the user inserts a newline between a multi word misspelling. " +
14 "To test manually, enable 'Ask Google for Suggestions' in Chrome, type 'It should be upper \ncase.'." +
15 "The test succeeds if there are no spelling markers under 'upper \ncase'.");
17 function waitForMarkersToDisappear(firstNode, secondNode, numberOfTries)
19 firstMarkerRange = internals.markerRangeForNode(firstNode, "spelling", 0);
20 secondMarkerRange = internals.markerRangeForNode(secondNode, "spelling", 0);
22 if ((firstMarkerRange || secondMarkerRange) && numberOfTries > 0) {
24 window.setTimeout(function() {
25 waitForMarkersToDisappear(firstNode, secondNode, numberOfTries - 1);
26 }, 0);
28 return;
31 shouldBeNull("firstMarkerRange");
32 shouldBeNull("secondMarkerRange");
34 finishJSTest();
37 initSpellTest("destination", "It should be upper case.", function(textNode) {
39 spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0);
40 shouldBeEqualToString("spellingMarkerRange.toString()", "upper case");
42 for(var i = 0; i < 5; ++i)
43 eventSender.keyDown("leftArrow");
45 document.execCommand("InsertText", false, "\n");
47 var destinationChildNodes =
48 document.getElementById("destination").childNodes;
50 var firstLine = destinationChildNodes[0];
51 var secondLine = destinationChildNodes[1].firstChild;
53 waitForMarkersToDisappear(firstLine, secondLine, 10);
55 }, true);
56 </script>
57 </body>
58 </html>