Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: LayoutTests/editing/undo/undo-insert-delete.html

Issue 65043014: Fix for broken undo functionality (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review comments incorporated Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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'. D elete '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 platfo rm
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>
OLDNEW
« no previous file with comments | « LayoutTests/editing/undo/5378473-expected.txt ('k') | LayoutTests/editing/undo/undo-insert-delete-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698