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

Unified Diff: third_party/WebKit/LayoutTests/fast/events/inputevents/before-input-order-typing-command.html

Issue 1752933002: [InputEvent] Fire 'beforeinput' during typing, pressing hot keys and IME composition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dtapuska's review, also add layout tests Created 4 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
Index: third_party/WebKit/LayoutTests/fast/events/inputevents/before-input-order-typing-command.html
diff --git a/third_party/WebKit/LayoutTests/fast/events/inputevents/before-input-order-typing-command.html b/third_party/WebKit/LayoutTests/fast/events/inputevents/before-input-order-typing-command.html
new file mode 100644
index 0000000000000000000000000000000000000000..f8ee6f9e252202785286fe4299a5a83c3a3e94e0
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/events/inputevents/before-input-order-typing-command.html
@@ -0,0 +1,41 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>InputEvent: beforeinput order on typing and command</title>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+</head>
+<body>
+<div id="log"></div>
+<input type="text" id="txt">
+
+<script>
+test(function() {
+ var eventList = ['keydown', 'keypress', 'beforeinput', 'input', 'keyup'];
+ var expectedEventOrder = [
+ // Pressing 'a'.
+ 'keydown', 'keypress', 'beforeinput', 'input', 'keyup',
+ // Pressing Ctrl+z, eventSender.keyDown won't send 'keydown' and 'keyup' for Ctrl.
+ /*'keydown',*/ 'keydown', 'beforeinput', 'input', 'keyup', /*'keyup',*/
+ ];
+ var actualEventOrder = [];
+ var txt = document.getElementById('txt');
+ eventList.forEach(function(eventType) {
+ txt.addEventListener(eventType, function(e) {
+ actualEventOrder.push(e.type);
+ });
+ });
+ if (!window.eventSender) {
+ document.write('This test requires eventSender');
+ } else {
+ txt.focus();
+ eventSender.keyDown('a');
+ var isMacOSX = navigator.userAgent.indexOf('Mac OS X') != -1;
+ eventSender.keyDown('z', [isMacOSX ? 'metaKey' : 'ctrlKey']);
+ assert_array_equals(actualEventOrder, expectedEventOrder, actualEventOrder.toString());
+ }
+}, "Testing beforeinput order on typing and command");
+</script>
+
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698