chromium/third_party/blink/web_tests/editing/pasteboard/4242293.html

<!DOCTYPE html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<p>This tests for a bug in createMarkup (markup for ancestors of the start of the selection wasn't being added to the pasteboard).  You should see the same thing in both regions below.</p>
<p><b>This demonstrates a bug: 'foo' is pulled out of its bordered block.</b></p>
<div id="copy" contenteditable="true"><div style="margin: 5px; border: 1px solid red;">foo<div style="margin: 5px; border: 1px solid blue;">bar</div></div>baz</div>

<div id="sample" contenteditable="true"></div>
<div id="log"></div>
<script>
test(function() {
    var selection = window.getSelection();
    selection.collapse(document.getElementById('copy'));
    document.execCommand('SelectAll');
    document.execCommand('Copy');
    var sample = document.getElementById('sample');
    selection.collapse(sample);
    document.execCommand('Paste');

    assert_equals(sample.innerHTML, '<div style="margin: 5px; border: 1px solid red;">foo<div style="margin: 5px; border: 1px solid blue;">bar</div></div>baz');
    assert_true(selection.isCollapsed);
    assert_equals(selection.anchorNode, sample.lastChild);
    assert_equals(selection.anchorOffset, 3);
});
</script>