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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/editing/undo/undo-insert-delete.html
diff --git a/LayoutTests/editing/undo/undo-insert-delete.html b/LayoutTests/editing/undo/undo-insert-delete.html
new file mode 100644
index 0000000000000000000000000000000000000000..a3515ff56572c79646753692ebbba14e91e23454
--- /dev/null
+++ b/LayoutTests/editing/undo/undo-insert-delete.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<body>
+<div id="container">
+<p id="description"></p>
+<p>To test manually:<br>1. Place the cursor at the end of 'abc'. Delete 'c'. Type in 'x'. Delete 'x'. Do ctrl+z. You should now see 'abx'.<br>2. Make sure you have the cursor at the end of 'abx'. Type in 'y'. Delete 'y'. Do ctrl+z. You should now see 'abxy'.</p>
+<div id="test" style="border: 2px solid red;" contenteditable>abc</div>
+</div>
+<div id="console"></div>
+<script src="../../resources/js-test.js"></script>
+<script>
+description('Verifies undo functionality that follows text insertion.');
+
+var selection = window.getSelection();
+selection.collapse(document.getElementById('test').firstChild, 3);
+
+// Use case 1: Place the cursor at the end of 'abc'. Delete 'c'. Type in 'x'. Delete 'x'. Do ctrl+z. You should now see 'abx'.
+document.execCommand('delete');
+document.execCommand('insertText', false, 'x');
+document.execCommand('delete');
+document.execCommand('undo');
+shouldBeEqualToString('selection.focusNode.data', 'abx');
+
+// Use case 2: Type in 'y'. Delete 'y'. Do ctrl+z. You should now see 'abxy'.
+selection.collapseToEnd(); // This is needed for this test to work on mac platform
+document.execCommand('insertText', false, 'y');
+document.execCommand('delete');
+document.execCommand('undo');
+shouldBeEqualToString('selection.focusNode.data', 'abxy');
+
+if (window.testRunner)
+ document.getElementById('container').outerHTML = '';
+</script>
+</body>
+</html>
« 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