<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
<html>
<head>
    <meta charset="utf8">
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
    <script src="../../../resources/js-test.js"></script>
    <script src="../../../resources/ui-helper.js"></script>
    <style>
        textarea {
            font-size: 18px;
        }
    </style>
    <script>
        jsTestIsAsync = true;

        addEventListener("load", async () => {
            description(`This test verifies that "I'" can be autocorrected to "I’m". To manually run the test, focus the text area, place the caret at the end of the apostrophe, and select the "I’m" text candidate above the keyboard. Check that the text candidate is inserted as expected.`);

            addEventListener("input", event => testPassed(`Observed input event of inputType ${event.inputType}`));

            if (!window.testRunner || !testRunner.runUIScript)
                return;

            editor = document.getElementById("editor");
            await UIHelper.activateElementAndWaitForInputSession(editor);
            await UIHelper.applyAutocorrection("I’m", "I'");
            shouldBe("document.activeElement", "editor");
            shouldBeEqualToString("editor.value", "I’m");
            editor.blur();
            await UIHelper.waitForKeyboardToHide();
            finishJSTest();
        });
    </script>
</head>
<body>
    <textarea contenteditable id="editor">I’</textarea>
    <div id="description"></div>
    <div id="console"></div>
</body>

</html>
