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

Unified Diff: third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-compositionupdate.html

Issue 2558643003: [InputEvent] Move 'beforeinput' logic into |CompositeEditCommand::willApplyEditing()| (3/3) (Closed)
Patch Set: Retain the order of firing 'beforeinput' before 'compositionupdate' Created 4 years 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: third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-compositionupdate.html
diff --git a/third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-compositionupdate.html b/third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-compositionupdate.html
new file mode 100644
index 0000000000000000000000000000000000000000..6db79337f91fa73c460cd3039fb49d49ec588bc7
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-compositionupdate.html
@@ -0,0 +1,36 @@
+<title>InputEvent order WRT 'compositionupdate'</title>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+<p id="editable" contenteditable></p>
+<script>
+test(function() {
+ assert_not_equals(textInputController, undefined, 'This test requires textInputController.');
+
+ var eventOrderRecorder = [];
+ const editable = document.getElementById('editable');
+ ['beforeinput', 'input', 'compositionstart', 'compositionupdate', 'compositionend'].forEach(
+ eventType => document.addEventListener(eventType, function(event) {
+ eventOrderRecorder.push(`${eventType}:${event.inputType}-${event.data}-${editable.innerHTML}`);
+ })
+ );
+
+ editable.focus();
+ textInputController.setComposition("w");
+ textInputController.setComposition("wo");
+ textInputController.insertText("work");
+ console.log(eventOrderRecorder);
+ assert_array_equals(eventOrderRecorder,
+ ['compositionstart:undefined--',
+ 'beforeinput:insertText-w-',
+ 'compositionupdate:undefined-w-',
+ 'input:insertText-w-w',
+ 'beforeinput:insertText-wo-w',
+ 'compositionupdate:undefined-wo-w',
+ 'input:insertText-wo-wo',
+ 'beforeinput:insertText-work-wo',
+ 'compositionupdate:undefined-work-wo',
+ 'input:insertText-work-work',
+ 'compositionend:undefined-work-work']
+ );
chongz 2016/12/20 04:48:59 Added this test to keep track of event order.
+}, '"compositionupdate" should fire before "input" and after "beforeinput".');
+</script>

Powered by Google App Engine
This is Rietveld 408576698