blob: ef925b9b0894effac646fe252bdfee9602ea8bd7 [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();
var s = window.getSelection();
typeCharacterCommand('i');
typeCharacterCommand('t');
typeCharacterCommand('\'');
typeCharacterCommand('s');
typeCharacterCommand(' ');
typeCharacterCommand('a');
typeCharacterCommand(' ');
typeCharacterCommand('m');
typeCharacterCommand('e');
typeCharacterCommand('s');
typeCharacterCommand('a');
typeCharacterCommand('g');
typeCharacterCommand('e');
typeCharacterCommand(' ');
s.setBaseAndExtent(edit.firstChild, 10, edit.firstChild, 10);
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 clicking autocorrected word</title>
</head>
<body>
<p>The test verified that if user clicks 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>
runEditingTest();
</script>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>