upload tizen1.0 source
[framework/web/webkit-efl.git] / LayoutTests / editing / execCommand / indent-pre-expected.txt
1 CONSOLE MESSAGE: line 44: Wrong node selected.
2 CONSOLE MESSAGE: line 46: Wrong anchor offset: 8 instead of 0
3 CONSOLE MESSAGE: line 41: Wrong end node type: [object HTMLBRElement]
4 CONSOLE MESSAGE: line 44: Wrong node selected.
5 | <html>
6 |   <head>
7 |   <body>
8 |     <p>
9 |       "This test tries to indent lines within pre tags.  This test passes if it
10 does not crash."
11 |     "
12 "
13 |     <div>
14 |       contenteditable=""
15 |       "
16 "
17 |       <blockquote>
18 |         style="margin: 0 0 0 40px; border: none; padding: 0px;"
19 |         <pre>
20 |           id="pre-basic"
21 |           "line one"
22 |       <pre>
23 |         id="pre-basic"
24 |         "line two
25 "
26 |       <blockquote>
27 |         style="margin: 0 0 0 40px; border: none; padding: 0px;"
28 |         <pre>
29 |           "line three"
30 |         <pre>
31 |           "line four"
32 |       "
33
34 "
35 |       <ul>
36 |         <li>
37 |           <pre>
38 |             id="pre-list"
39 |             "list one
40 "
41 |             <blockquote>
42 |               style="margin: 0 0 0 40px; border: none; padding: 0px;"
43 |               "list two"
44 |               <br>
45 |               "list three"
46 |             "list four
47 "
48 |       "
49
50 "
51 |       <table>
52 |         "
53 "
54 |         <tbody>
55 |           <tr>
56 |             <td>
57 |               <pre>
58 |                 id="pre-table"
59 |                 "table one<#selection-anchor>
60 "
61 |               <blockquote>
62 |                 style="margin: 0 0 0 40px; border: none; padding: 0px;"
63 |                 <pre>
64 |                   "table two"
65 |                 <pre>
66 |                   "table three<#selection-focus>"
67 |             <td>
68 |               "right cell"
69 |       "
70
71 "
72 |       <div>
73 |         id="results"
74 |         "PASSED (did not crash)"
75 |       "
76 "
77 |     "
78
79 "
80 |     <a>
81 |       href="javascript:document.execCommand('indent')"
82 |       "indent"
83 |     "
84 "
85 |     <a>
86 |       href="javascript:document.execCommand('outdent')"
87 |       "outdent"
88 |     "
89 "
90 |     <script>
91 |       src="../../resources/dump-as-markup.js"
92 |     "
93 "
94 |     <script>
95 |       src="../editing.js"
96 |     "
97 "
98 |     <script>
99 |       "
100 function setSelection(node)
101 {
102     var textNode = node.firstChild;
103     if (textNode.nodeType != Node.TEXT_NODE)
104         throw "Wrong node type: " + textNode;
105     execSetSelectionCommand(textNode, 0, 0);
106 }
107
108 function verifyTextSelection(startNode, startOffset, endNode, endOffset)
109 {
110     if (startNode.nodeType != Node.TEXT_NODE)
111         console.log("Wrong start node type: " + startNode);
112     if (endNode.nodeType != Node.TEXT_NODE)
113         console.log("Wrong end node type: " + endNode);
114     var sel = window.getSelection();
115     if (sel.anchorNode != startNode || sel.focusNode != endNode)
116         console.log("Wrong node selected.");
117     if (sel.anchorOffset != startOffset)
118         console.log("Wrong anchor offset: " + sel.anchorOffset + " instead of " + startOffset);
119     if (sel.focusOffset != endOffset)
120         console.log("Wrong focus offset: " + sel.focusOffset + " instead of " + endOffset);
121 }
122
123 // Indent a single line in a pre and make sure the selection is correctly preserved.
124 var pre = document.getElementById("pre-basic");
125 setSelection(pre);
126 execMoveSelectionForwardByCharacterCommand();
127 execExtendSelectionForwardByWordCommand();
128 document.execCommand("indent");
129 verifyTextSelection(document.getElementsByTagName("pre")[0].firstChild, 1,
130                     document.getElementsByTagName("pre")[0].firstChild, 4);
131
132 // Indent 2 lines.
133 setSelection(pre);
134 execMoveSelectionForwardByLineCommand();
135 execExtendSelectionForwardByLineCommand();
136 execExtendSelectionForwardByWordCommand();
137 document.execCommand("indent");
138 if (document.getElementsByTagName("pre").length > 3) {
139     // FIXME: The selection for the anchorNode is wrong.  It should stay at
140     // the beginning of "line three", but it moves to the end of "line 2".
141     verifyTextSelection(document.getElementsByTagName("pre")[2].firstChild, 0,
142                         document.getElementsByTagName("pre")[3].firstChild, 4);
143 } else {
144     console.log("Wrong number of pre nodes.");
145 }
146
147 // Indent <pre> lines in a list.
148 pre = document.getElementById("pre-list");
149 setSelection(pre);
150 execMoveSelectionForwardByLineCommand();
151 execExtendSelectionForwardByLineCommand();
152 execExtendSelectionForwardByLineCommand();
153 document.execCommand("indent");
154 verifyTextSelection(document.getElementsByTagName("blockquote")[2].firstChild, 0,
155                     document.getElementsByTagName("blockquote")[2].firstChild.nextSibling, 10);
156 // Indenting <pre> lines in a table.
157 pre = document.getElementById("pre-table");
158 setSelection(pre);
159 execMoveSelectionForwardByLineCommand();
160 execExtendSelectionForwardByLineCommand();
161 execExtendSelectionForwardByLineCommand();
162 // FIXME: This is wrong.  The pre tags get copied when they shouldn't be. 
163 // See https://bugs.webkit.org/show_bug.cgi?id=42009
164 document.execCommand("indent");
165 document.getElementById("results").innerText = "PASSED (did not crash)";
166 "
167 |     "
168 "