Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / execCommand / 4128080-2.html
blobd02c992d5aa22e2578cf0a9a78819bc2526bc1f0
1 <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>
2 <div id="copy"><h1>foo</h1></div>
3 <div id="paste" contentEditable="true"></div>
5 <script>
7 if (window.testRunner)
8 window.testRunner.dumpAsText();
10 // Test 2: Verify that a header at the end of inserted content is preserved.
11 copy = document.getElementById("copy");
12 window.getSelection().setBaseAndExtent(copy, 0, copy, copy.childNodes.length);
13 document.execCommand("Copy");
15 paste = document.getElementById("paste");
16 window.getSelection().collapse(paste, 0);
17 document.execCommand("Paste");
19 expected = "<h1>foo</h1>";
20 actual = paste.innerHTML;
22 if (window.testRunner && actual == expected)
23 document.body.innerText = "Success";
24 else
25 document.body.innerText = "Failure. Found: " + actual + ", but expected: " + expected;
27 </script>