blob: 4794d955ec2fe2e9e3d61c060a18fc9d70a6e0bb [file] [log] [blame]
<div id="description">This tests to make sure that copying and pasting a paragraph or less of content inside a header preserves the header element. To run it manually, Paste, then inspect the pasted content and verify that it's in an H1 element.</div>
<div id="copy"><h1>foo</h1></div>
<div id="paste" contentEditable="true"></div>
<script>
if (window.testRunner)
testRunner.dumpAsText();
// Test 2: Verify that a header at the end of inserted content is preserved.
copy = document.getElementById("copy");
window.getSelection().setBaseAndExtent(copy, 0, copy, copy.childNodes.length);
document.execCommand("Copy");
paste = document.getElementById("paste");
window.getSelection().collapse(paste, 0);
document.execCommand("Paste");
expected = "<h1>foo</h1>";
actual = paste.innerHTML;
if (window.testRunner && actual == expected)
document.body.innerText = "Success";
else
document.body.innerText = "Failure. Found: " + actual + ", but expected: " + expected;
</script>