blob: dfaa5fc73777c681e93f41b33be7d860b3b36ff9 [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.layoutTestController)
window.layoutTestController.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().setPosition(paste, 0);
document.execCommand("Paste");
expected = "<h1>foo</h1>";
actual = paste.innerHTML;
if (window.layoutTestController && actual == expected)
document.body.innerText = "Success";
else
document.body.innerText = "Failure. Found: " + actual + ", but expected: " + expected;
</script>