blob: ba068675e4a06595e0fc249709eeded84babb4f5 [file] [log] [blame]
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
<script src="../editing.js"></script>
<script>
jsTestIsAsync = true;
function zeroDelayTimer()
{
return new Promise(resolve => setTimeout(resolve, 0));
}
async function runTest()
{
if (window.internals) {
internals.settings.setUnifiedTextCheckerEnabled(true);
internals.settings.setAsynchronousSpellCheckingEnabled(false);
internals.setAutomaticTextReplacementEnabled(true);
internals.setAutomaticSpellingCorrectionEnabled(true);
testRunner.setSpellCheckerResults({
"YT?": [
{
"replacement": "You there?",
"type": "replacement",
"from": 0,
"to": 3
}
],
"YT?\n": [
{
"replacement": "You there?",
"type": "replacement",
"from": 0,
"to": 3
}
]
});
}
const editor = document.getElementById("editor");
editor.focus();
for (const character of "YT?")
typeCharacterCommand(character);
await zeroDelayTimer();
if (!window.testRunner) {
description.innerHTML = `To manually test, add an automatic text replacement mapping from the string "YT?" to
"You there?", and then type the string "YT?". It should not be immediately corrected to "You there?".
However, entering a newline should subsequently trigger autocorrection.`;
return;
}
debug("Before pressing enter:");
shouldBe("editor.textContent", "'YT?'");
insertParagraphCommand();
await zeroDelayTimer();
finishJSTest();
}
</script>
</head>
<body onload="runTest()">
<div id="description"></div>
<div contenteditable style="margin-bottom: 1em; border: 1px orange dashed;" id="editor"></div>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>