upload tizen1.0 source
[framework/web/webkit-efl.git] / LayoutTests / editing / execCommand / 4128080-1.html
1 <div id="div1" contentEditable="true">foofoo</div>
2 <div id="div2" contentEditable="true">foofoo</div>
3
4 <script>
5 if (window.layoutTestController)
6     window.layoutTestController.dumpAsText();
7     
8 output = "";
9
10 // Test 1: Verify that a header at the beginning of inserted content is preserved.
11 div = document.getElementById("div1");
12 text = div.firstChild;
13 window.getSelection().setPosition(text, 3);
14 document.execCommand("InsertHTML", false, "<h1>bar</h1><div>baz</div>");
15 expected = "foo<h1>bar</h1>bazfoo";
16 actual = div.innerHTML;
17 if (actual == expected)
18     output += "Success\n";
19 else
20     output += "Failure. Result was: " + actual + ", should have been: " + expected + "\n";
21     
22 // Test 2: Verify that a header at the end of inserted content is preserved.
23 div = document.getElementById("div2");
24 text = div.firstChild;
25 window.getSelection().setPosition(text, 3);
26 document.execCommand("InsertHTML", false, "<div>bar</div><h1>baz</h1>");
27 expected = "foobar<h1>baz</h1>foo";
28 actual = div.innerHTML;
29 if (actual == expected)
30     output += "Success\n";
31 else
32     output += "Failure. Result was: " + actual + ", should have been: " + expected + "\n";
33
34 document.body.innerText = output;
35 </script>