Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / execCommand / indent-pre-list.html
blob1026c82e822b8b6131624040849f4049aca73a3f
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../../resources/dump-as-markup.js"></script>
5 <div id="test0" contenteditable>
6 <pre>
7 <ul><li>hello</li></ul></pre>
8 </div>
10 <div id="test1" contenteditable>
11 <pre><ul><li>hello
12 world</li>
13 </ul></pre>
14 </div>
16 <div id="test2" contenteditable>
17 <ul><li><pre>
18 hello
19 world
20 webkit
21 </pre></li></ul>
22 </div>
24 <div id="test3" contenteditable>
25 <ul><li><pre>
26 hello
27 world
28 webkit
29 </pre></li></ul>
30 </div>
32 <div id="test4" contenteditable>
33 <ul><li><pre>
34 hello
35 world
36 webkit
37 </pre></li></ul>
38 </div>
40 <div id="test5" contenteditable>
41 <ul><li><pre>
42 hello
43 world
44 webkit
45 </pre></li></ul>
46 </div>
48 <script>
50 function testIndentation(containerId, selector) {
51 var container = document.getElementById(containerId);
52 selector(container);
53 Markup.dump(container, 'Indenting');
54 document.execCommand('indent', false, null);
55 Markup.dump(container, 'yields');
58 function selectAll(container) {
59 window.getSelection().selectAllChildren(container);
62 function selectorForLineN(line) {
63 return function (container) {
64 window.getSelection().collapse(container, 0);
65 for (var i = 0; i < line - 1; i++)
66 window.getSelection().modify('move', 'forward', 'line');
67 window.getSelection().modify('extend', 'forward', 'line');
68 // Avoid including \n at the end of line.
69 window.getSelection().modify('extend', 'backward', 'character');
73 testIndentation('test0', selectAll);
74 testIndentation('test1', selectAll);
75 testIndentation('test2', selectAll);
76 testIndentation('test3', selectorForLineN(1));
77 testIndentation('test4', selectorForLineN(2));
78 testIndentation('test5', selectorForLineN(3));
80 </script>
81 </body>
82 </html>