blob: 63621b7485ae578d42aa8030fee7a680bf4ab838 [file] [log] [blame]
<!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 marker should remain when the user selects the misspelled word exactly. "
+ "To test manually, type 'wellcome home.', select 'wellcome'. "
+ "The test succeeds when 'wellcome' has spelling marker.");
initSpellTest("destination", "wellcome home.", function(textNode) {
spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0);
shouldBeEqualToString("spellingMarkerRange.toString()", "wellcome");
shouldBeEqualToString("window.getSelection().toString()", "");
// Select the misspelled word without surrounding whitespace or punctuation.
var wordRange = document.createRange();
wordRange.setStart(textNode, 0);
wordRange.setEnd(textNode, 8);
window.getSelection().removeAllRanges();
window.getSelection().addRange(wordRange);
shouldBeEqualToString("window.getSelection().toString()", "wellcome");
spellingMarkerRange = internals.markerRangeForNode(textNode, "spelling", 0);
shouldBecomeEqualToString("spellingMarkerRange.toString()", "wellcome", finishJSTest);
});
</script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>