Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / editing / execCommand / 4128080-2.html
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>
4
5 <script>
6
7 if (window.testRunner)
8     window.testRunner.dumpAsText();
9
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");
14
15 paste = document.getElementById("paste");
16 window.getSelection().collapse(paste, 0);
17 document.execCommand("Paste");
18
19 expected = "<h1>foo</h1>";
20 actual = paste.innerHTML;
21
22 if (window.testRunner && actual == expected)
23     document.body.innerText = "Success";
24 else
25     document.body.innerText = "Failure.  Found: " + actual + ", but expected: " + expected;
26
27 </script>