blob: 886f5a600016399c4fce35024cdd74d199bea2e2 [file] [log] [blame]
<html>
<head>
<script src=../../editing.js language="javascript" type="text/javascript"></script>
<script src="../../../resources/js-test-pre.js"></script>
<script>
function editingTest() {
edit = document.getElementById('edit');
edit.focus();
typeCharacterCommand('i');
typeCharacterCommand('t');
typeCharacterCommand('\'');
typeCharacterCommand('s');
typeCharacterCommand(' ');
typeCharacterCommand('a');
typeCharacterCommand(' ');
typeCharacterCommand('m');
typeCharacterCommand('e');
typeCharacterCommand('s');
typeCharacterCommand('a');
typeCharacterCommand('g');
typeCharacterCommand('e');
typeCharacterCommand(' ');
execMoveSelectionBackwardByCharacterCommand();
if (window.testRunner) {
testRunner.dumpAsText(true);
textNode = edit.firstChild;
shouldBe("markerRange = internals.markerRangeForNode(textNode, 'replacement', 0); markerRange.startContainer", "textNode");
shouldBe("markerRange.toString()", "'message'");
shouldBe("markerRange.endContainer", "textNode");
shouldBe("markerRange.startOffset", "textNode.textContent.indexOf(markerRange.toString())");
shouldBe("markerRange.endOffset", "markerRange.startOffset + markerRange.toString().length");
shouldBeNull("internals.markerRangeForNode(textNode, 'replacement', 1)");
shouldBeNull("internals.markerRangeForNode(textNode, 'spelling', 0)");
shouldBe("markerRange = internals.markerRangeForNode(textNode, 'autocorrected', 0); markerRange.startContainer", "textNode");
shouldBe("markerRange.toString()", "'message'");
shouldBe("markerRange.endContainer", "textNode");
shouldBe("markerRange.startOffset", "textNode.textContent.indexOf(markerRange.toString())");
shouldBe("markerRange.endOffset", "markerRange.startOffset + markerRange.toString().length");
shouldBeNull("internals.markerRangeForNode(textNode, 'autocorrected', 1)");
}
}
</script>
<title>Testing moving cursor to the end of autocorrected word</title>
</head>
<body>
<p>The test verified that if user used arrow key to move cursor into a word that is marked as autocorrected,
the autocorrection underline will remain. You should see phrase "it's a message", in which the word
'message' has blue underline.</p>
<p style="color:green">Note, this test can fail due to user specific spell checking data.
If the user has previously dismissed 'message' as the correct spelling of 'mesage' several times,
the spell checker will not provide 'message' as a suggestion anymore. To fix this,
remove all files in ~/Library/Spelling.</p>
<div contenteditable="true" id="edit"/>
<script language="javascript" type="text/javascript">
runEditingTest();
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>