| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| </head> |
| <body> |
| <div id="container"> |
| <div id="destination" contentEditable>mood.</div> |
| </div> |
| |
| <script> |
| description("The spellchecker shouldn't mark substrings of words after pasting. " |
| + "This test succeeds if only 'zz' is marked as misspelled."); |
| |
| jsTestIsAsync = true; |
| |
| if (window.internals) { |
| internals.settings.setUnifiedTextCheckerEnabled(true); |
| internals.settings.setAsynchronousSpellCheckingEnabled(true); |
| } |
| |
| var sel = window.getSelection(); |
| var destination = document.getElementById("destination"); |
| var destinationText = destination.firstChild; |
| sel.setBaseAndExtent(destinationText, 2, destinationText, 2); |
| |
| document.execCommand("InsertHTML", false, "<div>o zz</div><div>fo</div>"); |
| |
| var hasSpellingMarkerForNode = [ |
| true, // moo zz |
| false, // <br> |
| false // food. |
| ]; |
| |
| var hasSpellingMarker; |
| var currentNode; |
| |
| function verifySpellingMarkersFor(node) |
| { |
| hasSpellingMarker = hasSpellingMarkerForNode.shift(); |
| currentNode = node; |
| if (!currentNode) |
| return finishJSTest(); |
| |
| debug(currentNode); |
| if (currentNode instanceof Text) |
| debug(currentNode.nodeValue); |
| |
| shouldBecomeEqual("internals.markerCountForNode(currentNode, 'spelling')", hasSpellingMarker ? "1" : "0", function() { |
| if (hasSpellingMarker) |
| shouldBeEqualToString("internals.markerRangeForNode(currentNode, 'spelling', 0).toString()", "zz"); |
| |
| verifySpellingMarkersFor(node.nextSibling); |
| }); |
| } |
| |
| if (window.internals) |
| verifySpellingMarkersFor(destination.firstChild); |
| |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |