Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / editing / undo / replace-by-span-then-remove.html
blobae04cc0ffc1dcad94c962171433e6b0ce9329854
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <div id="test" contenteditable><b style="font-style: italic;">world</b></div>
5 <pre id="console">
6 </pre>
7 <script>
9 if (window.testRunner)
10 testRunner.dumpAsText();
12 var test = document.getElementById('test');
13 window.getSelection().selectAllChildren(test);
15 var console = document.getElementById('console');
16 var initialValue = test.innerHTML;
17 var failed = false;
18 console.appendChild(document.createTextNode('initial:' + test.innerHTML + '\n'));
19 document.execCommand('bold', false, null);
20 console.appendChild(document.createTextNode('after removing bold:' + test.innerHTML + '\n'));
21 document.execCommand('italic', false, null);
22 console.appendChild(document.createTextNode('after removing italic:' + test.innerHTML + '\n'));
23 var finalValue = test.innerHTML;
25 document.execCommand('undo', false, null);
26 document.execCommand('undo', false, null);
27 console.appendChild(document.createTextNode('after undo:' + test.innerHTML + '\n'));
28 if (test.innerHTML != initialValue) {
29 console.appendChild(document.createTextNode('but expected ' + initialValue + '\n'));
30 failed = true;
32 document.execCommand('redo', false, null);
33 document.execCommand('redo', false, null);
34 console.appendChild(document.createTextNode('after redo:' + test.innerHTML + '\n'));
35 if (test.innerHTML != finalValue) {
36 console.appendChild(document.createTextNode('but expected ' + finalValue + '\n'));
37 failed = true;
40 test.innerHTML = '';
42 console.appendChild(document.createTextNode(failed ? 'FAIL\n' : 'PASS\n'));
44 </script>
45 </body>
46 </html>