<html> 
<head>

<style>
.editing { 
    border: 2px solid red; 
    padding: 12px; 
    font-size: 24px; 
}
</style>
<script src=../editing.js language="JavaScript" type="text/JavaScript" ></script>

<script>
function hasExpectedSpellingOrGrammarMarkerInRange(from, length) {
    if (internals.sentenceRetroCorrectionEnabled)
        return internals.hasSpellingMarker(from, length);
    return internals.hasGrammarMarker(from, length);
}

function editingTest() {
    document.getElementById("root").focus();
    document.execCommand("InsertText", false, "I have a issue.");

    if (window.internals) {
        shouldBecomeEqual('hasExpectedSpellingOrGrammarMarkerInRange(7, 1)', 'true', function() {
            document.getElementById("root").style.display = "none";
            finishJSTest();
        });
    }
}

</script>

<title>Editing Test</title> 
</head> 
<body>
<script src="../../resources/js-test-pre.js"></script>
<div contenteditable id="root" class="editing"></div>
<script>
description("This tests whether the grammatically-incorrect phrase "
    + "'I have a issue' has grammar marker on 'a'.");

jsTestIsAsync = true;

if (window.internals) {
    internals.settings.setUnifiedTextCheckerEnabled(true);
    internals.settings.setAsynchronousSpellCheckingEnabled(true);
}

editingTest();
</script>

<script src="../../resources/js-test-post.js"></script>
</body>
</html>
