<!DOCTYPE html>
<html>

<body>
<p>This test ensures inserting empty string does not move the caret.</p>
<p>The caret is placed at 5th pos and the empty html is added. The test passes if the caret is positioned at the same position after the execution insertion command.</p>

<div id="content" contenteditable="true">abcdefghijklmnopqrstuvwxyz</div>
<div id="console"></div>

<script src="../../resources/js-test-pre.js"></script>
<script>

if (window.testRunner) {
    testRunner.dumpAsText();

    var selection = window.getSelection();
    var div = document.getElementById("content");
    var text = div.firstChild;

    selection.setPosition(text, 5);
    document.execCommand('InsertHTML', false, "");

    shouldBe("window.getSelection().baseOffset", "5");
}

</script>

</body>
</html>
