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

Unified Diff: third_party/WebKit/LayoutTests/editing/undo/redo_correct_selection.html

Issue 2532393002: Make redo command to correct selection in undo stack (Closed)
Patch Set: 2016-11-30T11:28:33 Created 4 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/Editor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/editing/undo/redo_correct_selection.html
diff --git a/third_party/WebKit/LayoutTests/editing/undo/redo_correct_selection.html b/third_party/WebKit/LayoutTests/editing/undo/redo_correct_selection.html
new file mode 100644
index 0000000000000000000000000000000000000000..0e1a391622b7875085667c3d70ab7d5d6f3b1aa5
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/editing/undo/redo_correct_selection.html
@@ -0,0 +1,31 @@
+<!doctype html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../assert_selection.js"></script>
+<script>
+test(() => assert_selection(
+ '<div contenteditable>^012<select></select>|</div><option></option>',
+ selection => {
+ const div = selection.document.querySelector('div');
+ let currentCommand = '';
+ function execCommand(name) {
+ currentCommand = name;
+ selection.document.execCommand(name);
+ }
+ // Move SELECT into OPTION before calling |FrameSelection::setSelection()|
+ // in |Editor::reappliedEditing()|.
+ div.addEventListener('webkitEditableContentChanged', () => {
+ if (currentCommand !== 'redo')
+ return;
+ const div = selection.document.querySelector('div');
+ const select = selection.document.querySelector('select');
+ const option = selection.document.querySelector('option');
+ option.appendChild(select);
+ });
+ execCommand('bold');
+ execCommand('undo');
+ execCommand('redo');
+ },
+ '<div contenteditable><b>^012|</b></div><option><select></select></option>'),
+ 'Redo command should update selection');
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/Editor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698