Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / execCommand / indent-pre-paragraphs.html
blobc9228e5406eec66fdaa81675a213aae158f0ff2d
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <script src="../../resources/dump-as-markup.js"></script>
5 <div id="test0" contenteditable>
6 <pre>hello</pre>
7 </div>
9 <div id="test1" contenteditable>
10 <pre>
11 hello
13 world
15 webkit
16 </pre>
17 </div>
19 <div id="test2" contenteditable>
20 <pre>
21 hello
22 world
23 webkit
24 </pre>
25 </div>
27 <div id="test3" contenteditable>
28 <pre>
29 hello
31 world
32 </pre>
33 </div>
35 <div id="test4" contenteditable>
36 <pre>
37 hello
39 world
40 </pre>
41 </div>
43 <div id="test5" contenteditable>
44 <pre>
45 hello
47 world
48 </pre>
49 </div>
50 <script>
52 function testIndentation(containerId, selector) {
53 var container = document.getElementById(containerId);
54 selector(container);
55 Markup.dump(container, 'Indenting');
56 document.execCommand('indent', false, null);
57 Markup.dump(container, 'yields');
60 function selectAll(container) {
61 window.getSelection().selectAllChildren(container);
64 function selectorForLineN(line) {
65 return function (container) {
66 window.getSelection().collapse(container, 0);
67 for (var i = 0; i < line - 1; i++)
68 window.getSelection().modify('move', 'forward', 'line');
69 window.getSelection().modify('extend', 'forward', 'line');
70 window.getSelection().modify('extend', 'backward', 'character');
74 testIndentation('test0', selectAll);
75 testIndentation('test1', selectAll);
76 testIndentation('test2', selectAll);
77 testIndentation('test3', selectorForLineN(1));
78 testIndentation('test4', selectorForLineN(2));
79 testIndentation('test5', selectorForLineN(3));
81 </script>
82 </body>
83 </html>