<html>
<head>
<script src="../../editing.js" language="JavaScript" type="text/JavaScript" ></script>
<script src="../../../resources/js-test-pre.js"></script>

<style>
body { margin: 0; padding: 0 }
</style>
</head>
<body>
<pre id="description"></pre>
<div id="test" contenteditable>thisisatest</div>
<p id="console"></p>
<script type="text/javascript">
    description("Ensure that a empty text alternative does not lead to a crash");

    
    if (window.testRunner) {
        
        try {

            document.getElementById("test").focus();

            moveSelectionForwardByCharacterCommand();
            moveSelectionForwardByCharacterCommand();

            var dictatedString = textInputController.makeDictatedString(" ", " ", 0, 1);
            textInputController.insertText(dictatedString);

            moveSelectionForwardByCharacterCommand();
            moveSelectionForwardByCharacterCommand();

            for ( var k = 0; k < 4; k++) {
                textInputController.doCommand("deleteBackward:");
            }

            document.write("TEST COMPLETE");

        } catch (ex) {
            document.write("Exception: " + ex.description);
        }
    } else {
        document.write("(cannot run interactively)");
    }
</script>
</body>
</html>
