blob: d683013ab104fc048446f6c818abb85582693d70 [file] [log] [blame]
<!DOCTYPE html>
<html>
<body>
<p>Test that undoing autocorrection from "wellcome" to "welcome" and typing a space doesn't re-autocorrect "wellcome".<br>
To manually test, type "testt " and observe that it's auto-corrected to "test ". Then undo the auto-correction and type a space again. You should see "testt ".</p>
<div id="editor" contenteditable></div>
<div id="console"></div>
<script src="../../../resources/js-test.js"></script>
<script>
if (window.testRunner) {
jsTestIsAsync = true;
var editor = document.getElementById('editor');
editor.focus();
document.execCommand('insertText', false, 'wellcome');
getSelection().modify('move', 'backward', 'character');
getSelection().modify('move', 'forward', 'character');
setTimeout(function () {
document.execCommand('insertText', false, ' ');
document.execCommand('undo', false, null);
document.execCommand('insertText', false, ' ');
shouldBe("editor.innerText", "'wellcome\xa0'");
finishJSTest();
}, 100); // The delay is needed to separate the autocorrection from typing "wellcome" in NSUndoManager.
}
</script>
</body>
</html>