4 <script src="../../resources/dump-as-markup.js"></script>
5 <div id="test0" contenteditable>
9 <div id="test1" contenteditable>
19 <div id="test2" contenteditable>
27 <div id="test3" contenteditable>
35 <div id="test4" contenteditable>
43 <div id="test5" contenteditable>
52 function testIndentation(containerId, selector) {
53 var container = document.getElementById(containerId);
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));