4 <script src="../../resources/dump-as-markup.js"></script>
5 <div id="test0" contenteditable>
7 <ul><li>hello</li></ul></pre>
10 <div id="test1" contenteditable>
16 <div id="test2" contenteditable>
24 <div id="test3" contenteditable>
32 <div id="test4" contenteditable>
40 <div id="test5" contenteditable>
50 function testIndentation(containerId, selector) {
51 var container = document.getElementById(containerId);
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));