<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../../fast/js/resources/js-test-pre.js"></script>
</head>
<body id="body">


<div tabindex="0" id="textbox1" contenteditable="true" role="textbox">Single line test</div>

<div tabindex="0" id="textbox2" contenteditable="true" role="textbox">
Multiple<br>
Line<br>
Textbox
</div>

<p id="description"></p>
<div id="console"></div>

<script>

    description("This tests that contenteditable nodes return the correct information for range and selection based attributes.");

    if (window.accessibilityController) {
        // Test the single line textbox.
        var textElement = document.getElementById("textbox1");
        textElement.focus();
        var axElement = accessibilityController.focusedElement;

        var s = window.getSelection();
        s.setPosition(textElement, 0);
        for (var k = 0; k < 3; k++) {
            s.modify("move", "forward", "character");
        }
        shouldBe("axElement.selectedTextRange", "'{3, 0}'");

        for (var k = 0; k < 3; k++) {
            s.modify("extend", "forward", "character");
        }
        shouldBe("axElement.selectedTextRange", "'{3, 3}'");
        shouldBe("axElement.stringAttributeValue('AXSelectedText')", "'gle'");

        s.modify("extend", "forward", "character");
        shouldBe("axElement.selectedTextRange", "'{3, 4}'");

        // Test the multi-line textbox.
        textElement = document.getElementById("textbox2");
        textElement.focus();
        axElement = accessibilityController.focusedElement;

        s = window.getSelection();
        s.setPosition(textElement, 0);
        for (var k = 0; k < 12; k++) {
            s.modify("move", "forward", "character");
        }
        shouldBe("axElement.selectedTextRange", "'{12, 0}'");

        for (var k = 0; k < 6; k++) {
            s.modify("extend", "forward", "character");
        }
        shouldBe("axElement.selectedTextRange", "'{12, 6}'");
        var matchedText = "e\nText";
        shouldBe("axElement.stringAttributeValue('AXSelectedText')", "matchedText");

        s.modify("extend", "forward", "character");
        shouldBe("axElement.selectedTextRange", "'{12, 7}'");
    }

</script>

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