<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
<html>
<head>
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no">
    <script src="../../../resources/ui-helper.js"></script>
    <script>
        if (window.testRunner) {
            testRunner.dumpAsText();
            testRunner.waitUntilDone();
        }

        async function runTest()
        {
            if (!window.testRunner || !testRunner.runUIScript)
                return;

            const editable = document.getElementById("editable");
            await UIHelper.activateElementAndWaitForInputSession(editable);
            window.getSelection().setBaseAndExtent(editable, 0, editable, 1);
            await UIHelper.applyAutocorrection("To", "Ti");
            testRunner.notifyDone();
        }

        window.addEventListener('load', runTest, false);
    </script>
</head>

<body onload="runTest()">
    <div contenteditable id="editable">Ti</div>
    <p>To manually test, type 'Ti' into the contenteditable, select it, then tap the autocorrection in the keyboard. The 'Ti' should be autocorrected.</p>
    <code><div id="output"></div></code>
</body>

</html>
