| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!doctype html> |
| 2 <html> | 2 <script src="../../resources/testharness.js"></script> |
| 3 <head> | 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <script src="../../resources/js-test.js"></script> | 4 <script src="../assert_selection.js"></script> |
| 5 <script src="resources/util.js"></script> | 5 <script src="spellcheck_test.js"></script> |
| 6 </head> | 6 |
| 7 <body> | |
| 8 <div id="container"> | |
| 9 <div id="destination" contentEditable></div> | |
| 10 </div> | |
| 11 <script> | 7 <script> |
| 12 | 8 spellcheck_test( |
| 13 description("Spelling should work when the user inserts a newline between a mult
i word misspelling. " + | 9 '<div contenteditable>It should be upper |case.</div>', |
| 14 "To test manually, enable 'Ask Google for Suggestions' in Chrome, ty
pe 'It should be upper \ncase.'." + | 10 '', |
| 15 "The test succeeds if there are no spelling markers under 'upper \nc
ase'."); | 11 '<div contenteditable>It should be #upper case#.</div>', |
| 16 | 12 { |
| 17 function waitForMarkersToDisappear(firstNode, secondNode, numberOfTries) | 13 title: 'Has marker on initial multi-word misspelling.', |
| 18 { | 14 callback: sample => spellcheck_test( |
| 19 firstMarkerRange = internals.markerRangeForNode(firstNode, "spelling", 0); | 15 sample, |
| 20 secondMarkerRange = internals.markerRangeForNode(secondNode, "spelling", 0); | 16 document => document.execCommand('insertText', false, '\n'), |
| 21 | 17 '<div contenteditable>It should be upper <div>case.</div></div>', |
| 22 if ((firstMarkerRange || secondMarkerRange) && numberOfTries > 0) { | 18 'Marker disappears after inserting newline in multi-word misspelling.'
) |
| 23 | 19 }); |
| 24 window.setTimeout(function() { | |
| 25 waitForMarkersToDisappear(firstNode, secondNode, numberOfTries - 1); | |
| 26 }, 0); | |
| 27 | |
| 28 return; | |
| 29 } | |
| 30 | |
| 31 shouldBeNull("firstMarkerRange"); | |
| 32 shouldBeNull("secondMarkerRange"); | |
| 33 | |
| 34 finishJSTest(); | |
| 35 }; | |
| 36 | |
| 37 initSpellTest("destination", "It should be upper case.", function(textNode) { | |
| 38 | |
| 39 spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); | |
| 40 shouldBeEqualToString("spellingMarkerRange.toString()", "upper case"); | |
| 41 | |
| 42 for(var i = 0; i < 5; ++i) | |
| 43 eventSender.keyDown("ArrowLeft"); | |
| 44 | |
| 45 document.execCommand("InsertText", false, "\n"); | |
| 46 | |
| 47 var destinationChildNodes = | |
| 48 document.getElementById("destination").childNodes; | |
| 49 | |
| 50 var firstLine = destinationChildNodes[0]; | |
| 51 var secondLine = destinationChildNodes[1].firstChild; | |
| 52 | |
| 53 waitForMarkersToDisappear(firstLine, secondLine, 10); | |
| 54 | |
| 55 }, true); | |
| 56 </script> | 20 </script> |
| 57 </body> | |
| 58 </html> | |
| OLD | NEW |