blob: 60d02ae9462e9358e7d532bcf7d979759f5b8ffb [file] [log] [blame]
<html>
<head>
<script src="../../resources/ui-helper.js"></script>
<script src="../../resources/dump-as-markup.js"></script>
<script src="../editing.js"></script>
<script>
Markup.description("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, and place the selection on the line after 'You there?'");
Markup.waitUntilDone();
async function runTest()
{
if (window.internals) {
internals.settings.setUnifiedTextCheckerEnabled(true);
internals.settings.setAsynchronousSpellCheckingEnabled(false);
internals.setAutomaticTextReplacementEnabled(true);
internals.setAutomaticSpellingCorrectionEnabled(true);
await UIHelper.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 UIHelper.delayFor(0);
Markup.dump(editor, "Before pressing enter");
insertParagraphCommand();
await UIHelper.delayFor(0);
Markup.dump(editor, "After pressing enter");
Markup.notifyDone();
}
</script>
</head>
<body onload="runTest()">
<div id="description"></div>
<div contenteditable style="margin-bottom: 1em; border: 1px orange dashed;" id="editor">
<div><br></div>
<div><br></div>
</div>
</body>
</html>