OLD | NEW |
---|---|
(Empty) | |
1 <!DOCTYPE html> | |
2 <html> | |
3 <body> | |
4 <div id="container"> | |
5 <p id="description"></p> | |
6 <p>To test manually:<br>1. Place the cursor at the end of 'abc'. Delete 'c'. Typ e in 'x'. Delete 'x'. Do ctrl+z. You should now see 'abx'.<br>2. Make sure you h ave the cursor at the end of 'abx'. Type in 'y'. Delete 'y'. Do ctrl+z. You shou ld now see 'abxy'.</p> | |
7 <div id="test" style="border: 2px solid red;" contenteditable>abc</div> | |
8 </div> | |
9 <div id="console"></div> | |
10 <script src="../../resources/js-test.js"></script> | |
11 <script> | |
12 description('Verifies undo functionality that follows text insertion.'); | |
13 | |
14 var selection = window.getSelection(); | |
15 selection.collapse(document.getElementById('test').firstChild, 3); | |
16 | |
17 //Use case 1: Place the cursor at the end of 'abc'. Delete 'c'. Type in 'x'. De lete 'x'. Do ctrl+z. You should now see 'abx'. | |
18 document.execCommand('delete'); | |
19 document.execCommand('insertText', false, 'x'); | |
20 document.execCommand('delete'); | |
21 document.execCommand('undo'); | |
22 shouldBeEqualToString('selection.focusNode.data', 'abx'); | |
23 | |
24 // Use case 2: Type in 'y'. Delete 'y'. Do ctrl+z. You should now see 'abxy'. | |
25 selection.collapseToEnd(); //This is needed for this test to work on mac platfor m | |
yosin_UTC9
2013/11/15 10:22:22
nit: Should have one space after "//".
| |
26 document.execCommand('insertText', false, 'y'); | |
27 document.execCommand('delete'); | |
28 document.execCommand('undo'); | |
29 shouldBeEqualToString('selection.focusNode.data', 'abxy'); | |
30 | |
31 if (window.testRunner) | |
32 document.getElementById('container').outerHTML = ''; | |
33 </script> | |
34 </body> | |
35 </html> | |
OLD | NEW |