Change log level: info -> debug
[framework/web/webkit-efl.git] / LayoutTests / editing / pasteboard / paste-list-004.html
1 <body contentEditable="true">
2 <p>Pasting a list item into the middle of another list item should split the target list
3 item into two with the pasted content in between.</p>
4 <ul>
5     <li id="test">one two</li>
6     <li>three four</li>
7     <li><span style="background-color:green"><b>monsters walking cross the floor</b></span></li>
8 </ul>
9
10 <p id="results">FAIL</p>
11 </body>
12 <script src="../editing.js"></script>
13 <script>
14 function escapeHTML(text)
15 {
16     return text.replace(/&/g, "&amp;").replace(/</g, "&lt;");
17 }
18
19 function editingTest()
20 {
21     // Select the first list item.
22     extendSelectionForwardByLineCommand();
23     copyCommand();
24
25     // Place the cursor between "three" and "four".
26     moveSelectionForwardByLineCommand();
27     moveSelectionForwardByWordCommand();
28
29     pasteCommand();
30
31     // Place the cursor between "walking" and "cross"
32     for (var i = 0; i < 2; ++i)
33         moveSelectionForwardByLineCommand();
34     for (var i = 0; i < 2; ++i)
35         moveSelectionForwardByWordCommand();
36
37     pasteCommand();
38
39     // Verify that the list is as expected.
40     var listItems = document.getElementsByTagName("li");
41     var results = [
42         "one two",
43         "three",
44         "one two",
45         "",
46         "four",
47         "monsters walking",
48         "one two",
49         "",
50         "cross the floor"
51         ];
52     if (listItems.length != 9)
53         throw "Expected 8 list items, found " + listItems.length;
54     for (var i = 0; i < results.length; ++i) {
55         var actual = listItems[i].innerText.replace(/^\s+/g, "");
56         if (results[i] != actual)
57             throw "Unexpected list item: " + i + "," + results[i] + "," + listItems[i].innerText;
58     }
59
60     // Verify that the cursor is in the right place (on the blank line).
61     var selection = window.getSelection();
62     if (selection.baseNode != listItems[7] || selection.baseOffset != 0 || !selection.isCollapsed)
63         throw "Wrong selection position";
64
65     for (var i = 0; i < listItems.length; ++i) {
66       listItems[i].innerHTML = listItems[i].innerHTML.replace(/&nbsp;/g, "");
67       listItems[i].innerHTML += ": " + escapeHTML(listItems[i].innerHTML);
68     }
69 }
70
71 runDumpAsTextEditingTest(false);
72 document.getElementById("results").innerText = "PASS";
73 </script>