<!DOCTYPE html>
<html>
<head>
<script src="../../../resources/dump-as-markup.js"></script>
</head>
<body>
    <div id="editor" contenteditable>
        <p id="p1">Apple banana orange.</p>
        <p id="p2">Kiwi banana pear.</p>
    </div>
</body>
<script>
Markup.description("Verifies that find and replace will insert the replacement text at the selection, if no matches are specified. This test requires WebKitTestRunner.");

getSelection().setBaseAndExtent(p1.childNodes[0], 6, p1.childNodes[0], 12);
testRunner.replaceFindMatchesAtIndices([], "pear", false);
Markup.dump("editor", "After replacing 'banana' with 'pear'");

getSelection().setPosition(p2.childNodes[0], 4);
testRunner.replaceFindMatchesAtIndices([], "watermelon", false);
Markup.dump("editor", "After inserting 'watermelon' after 'Kiwi'");
</script>
</html>
