| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| <script src="resources/util.js"></script> |
| </head> |
| <body> |
| <div id="container"> |
| <div id="destination" contentEditable></div> |
| </div> |
| |
| <script> |
| |
| description("Spelling markers should remain for double-clicked misspellings. " |
| + "To test manually, type 'wellcome home.', double-click on 'wellcome'. " |
| + "The test succeeds when 'wellcome' remains spelling marker."); |
| |
| initSpellTest("destination", "wellcome home.", function(textNode) { |
| spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); |
| shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome"); |
| shouldBeEqualToString("window.getSelection().toString()", ""); |
| |
| // Double-click the misspelled word without trailing whitespace. |
| verifySpellingMarkersAfterDoubleClick(textNode, false, function() { |
| window.getSelection().removeAllRanges(); |
| shouldBeEqualToString("window.getSelection().toString()", ""); |
| |
| // Double-click the misspelled word with trailing whitespace. |
| verifySpellingMarkersAfterDoubleClick(textNode, true, finishJSTest); |
| }); |
| |
| }); |
| |
| function verifySpellingMarkersAfterDoubleClick(textNode, isSelectTrailingWhitespaceEnabled, completionCallback) { |
| internals.settings.setSelectTrailingWhitespaceEnabled(isSelectTrailingWhitespaceEnabled); |
| internals.settings.setSmartInsertDeleteEnabled(!isSelectTrailingWhitespaceEnabled); |
| |
| var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 40; |
| var y = destination.offsetParent.offsetTop + destination.offsetTop + destination.offsetHeight / 2; |
| eventSender.mouseMoveTo(x, y); |
| eventSender.mouseDown(); |
| eventSender.mouseUp(); |
| eventSender.mouseDown(); |
| eventSender.mouseUp(); |
| |
| shouldBeEqualToString("window.getSelection().toString()", isSelectTrailingWhitespaceEnabled ? "wellcome " : "wellcome"); |
| var spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0); |
| shouldBecomeEqualToString("spellingMarkerRange.toString()", "wellcome", completionCallback); |
| } |
| |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |