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

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

Issue 2700913002: Fix undo stack ordering with TypingCommand (Closed)
Patch Set: Also put insert...InQuotedContent in EventQueueScope Created 3 years, 10 months 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/commands/TypingCommand.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/type_with_mutation_event_undo_order.html
diff --git a/third_party/WebKit/LayoutTests/editing/undo/type_with_mutation_event_undo_order.html b/third_party/WebKit/LayoutTests/editing/undo/type_with_mutation_event_undo_order.html
new file mode 100644
index 0000000000000000000000000000000000000000..56a5aba08bdf8a9f188b04eba89b4611e3e82f96
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/editing/undo/type_with_mutation_event_undo_order.html
@@ -0,0 +1,121 @@
+<!doctype html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../assert_selection.js"></script>
+<script>
+// Regression test for crbug.com/685975
+
+test(() => {
+ assert_not_equals(window.eventSender, undefined,
+ 'This test requires eventSender');
+
+ assert_selection(
+ [
+ '<div contenteditable id="div1">foo|</div>',
+ '<div contenteditable id="div2">bar</div>'
+ ].join(''),
+ selection => {
+ const document = selection.document;
+ const div1 = document.getElementById('div1');
+ const div2 = document.getElementById('div2');
+ eventSender.keyDown('a');
+ div1.addEventListener('DOMSubtreeModified', () => {
+ div2.focus();
+ document.execCommand('selectAll');
+ document.execCommand('delete');
+ });
+ eventSender.keyDown('b');
+ document.execCommand('undo');
+ },
+ [
+ '<div contenteditable id="div1">fooab</div>',
+ '<div contenteditable id="div2">^bar|</div>'
+ ].join(''));
+}, 'Undo ordering maintained when inserting text to open typing triggers another command in event handler.');
+
+test(() => {
+ assert_not_equals(window.eventSender, undefined,
+ 'This test requires eventSender');
+
+ assert_selection(
+ [
+ '<div contenteditable id="div1">foo|</div>',
+ '<div contenteditable id="div2">bar</div>'
+ ].join(''),
+ selection => {
+ const document = selection.document;
+ const div1 = document.getElementById('div1');
+ const div2 = document.getElementById('div2');
+ eventSender.keyDown('a');
+ div1.addEventListener('DOMSubtreeModified', () => {
+ div2.focus();
+ document.execCommand('selectAll');
+ document.execCommand('delete');
+ });
+ eventSender.keyDown('Enter');
+ document.execCommand('undo');
+ },
+ [
+ '<div contenteditable id="div1">fooa',
+ '<div><br></div>',
+ '</div>',
+ '<div contenteditable id="div2">^bar|</div>'
+ ].join(''));
+}, 'Undo ordering maintained when inserting paragraph separator to open typing triggers another command in event handler.');
+
+test(() => {
+ assert_not_equals(window.eventSender, undefined,
+ 'This test requires eventSender');
+
+ assert_selection(
+ [
+ '<div contenteditable id="div1"><blockquote type="cite">foo|</blockquote></div>',
+ '<div contenteditable id="div2">bar</div>'
+ ].join(''),
+ selection => {
+ const document = selection.document;
+ const div1 = document.getElementById('div1');
+ const div2 = document.getElementById('div2');
+ eventSender.keyDown('a');
+ div1.addEventListener('DOMSubtreeModified', () => {
+ div2.focus();
+ document.execCommand('selectAll');
+ document.execCommand('delete');
+ });
+ testRunner.execCommand('insertNewLineInQuotedContent');
+ document.execCommand('undo');
+ },
+ [
+ '<div contenteditable id="div1"><blockquote type="cite">fooa</blockquote><br></div>',
+ '<div contenteditable id="div2">^bar|</div>'
+ ].join(''));
+}, 'Undo ordering maintained when inserting paragraph separator in quoted content to open typing triggers another command in event handler.');
+
+test(() => {
+ assert_not_equals(window.eventSender, undefined,
+ 'This test requires eventSender');
+
+ assert_selection(
+ [
+ '<div contenteditable id="div1">foo|</div>',
+ '<div contenteditable id="div2">bar</div>'
+ ].join(''),
+ selection => {
+ const document = selection.document;
+ const div1 = document.getElementById('div1');
+ const div2 = document.getElementById('div2');
+ eventSender.keyDown('a');
+ div1.addEventListener('DOMSubtreeModified', () => {
+ div2.focus();
+ document.execCommand('selectAll');
+ document.execCommand('delete');
+ });
+ eventSender.keyDown('Enter', ['shiftKey']);
+ document.execCommand('undo');
+ },
+ [
+ '<div contenteditable id="div1">fooa<br><br></div>',
+ '<div contenteditable id="div2">^bar|</div>'
+ ].join(''));
+}, 'Undo ordering maintained when inserting linebreak to open typing triggers another command in event handler.');
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/editing/commands/TypingCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698