blob: c946d64a014801ea7fc86a779634d7d8c73cb48d [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(' ');
var s = window.getSelection();
s.setBaseAndExtent(edit.firstChild, 6, edit.firstChild, 6);
execForwardDeleteCommand();
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)");
shouldBe("markerRange = internals.markerRangeForNode(textNode, 'spelling', 0); markerRange.startContainer", "textNode");
shouldBe("markerRange.toString()", "'amessage'");
shouldBe("markerRange.endContainer", "textNode");
shouldBe("markerRange.startOffset", "textNode.textContent.indexOf(markerRange.toString())");
shouldBe("markerRange.endOffset", "markerRange.startOffset + markerRange.toString().length");
shouldBeNull("internals.markerRangeForNode(textNode, 'spelling', 1)");
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 forward deleting into autocorrected word</title>
</head>
<body>
<p>You should see phrase "it's amessage", in which the word
'message' doesn't have 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>