chromium/third_party/blink/web_tests/editing/pasteboard/paste-list-003.html

<html>
<script src=../editing.js></script>
<script>
function escapeHTML(text)
{
    return text.replace(/&/g, "&amp;").replace(/</g, "&lt;");
}

function editingTest()
{
    // Select "one" and "two".
    for (i = 0; i < 2; i++)
        extendSelectionForwardByLineCommand();
    copyCommand();

    // Paste with the cursor right before "four" (insert between three and four)
    for (i = 0; i < 2; i++)
        moveSelectionForwardByLineCommand();
    pasteCommand();

    // Verify that the cursor is in the right place (still before four).
    var selection = window.getSelection();
    if (selection.baseNode.parentNode.parentNode.parentNode != document.getElementById("four") ||
        selection.baseOffset != 0 || !selection.isCollapsed)
        throw "Wrong selection position on before paste.";

    // Make sure the styles were preserved in the copy by updating the list items.
    var items = document.getElementsByTagName("li");
    for (var i = 0; i < items.length; ++i) {
        var li = items[i];
        li.innerHTML += ": " + escapeHTML(li.innerHTML);
    }

    document.getElementById("results").innerText = "PASS";
}

</script>
<body>
<div contentEditable="true">
<p>Copy/pasting list items in a list.  This test should be run with DRT for pasteboard access.</p>
<p id="results">FAIL</p>
<ul id="test">
    <li><b>one</b></li>
    <li><span style="background-color: green">two</span></li>
    <li>three</li>
    <li id="four"><span style="background-color: orange"><i>four</i></span></li>
    <li>i love counting, counting to the number four</li>
</ul>
</div>

<script>
if (window.testRunner)
    testRunner.dumpAsText();

var elem = document.getElementById("test");
var selection = window.getSelection();
selection.collapse(elem, 0);
editingTest();
</script>

</body>
</html>