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

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: Removing old pixel test 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..08161df729c75deb27c930ac986d6c1c3af0b333
--- /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
yosin_UTC9 2013/11/15 10:22:22 nit: Should have one space after "//".
+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>

Powered by Google App Engine
This is Rietveld 408576698