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

Unified Diff: third_party/WebKit/LayoutTests/fast/events/inputevents/before-input-data.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: Rebase on WebEditingCommandType & Yosin's review 2 Created 4 years, 8 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-data.html
diff --git a/third_party/WebKit/LayoutTests/fast/events/inputevents/before-input-data.html b/third_party/WebKit/LayoutTests/fast/events/inputevents/before-input-data.html
new file mode 100644
index 0000000000000000000000000000000000000000..b86a2b86bf86bfc5f70837da44cf8b25d7ece00c
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/events/inputevents/before-input-data.html
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>InputEvent: beforeinput data</title>
+<script src="../../../resources/testharness.js"></script>
+<script src="../../../resources/testharnessreport.js"></script>
+</head>
+<body>
+<input type="text" id="txt">
+<script>
+test(function() {
+ var lastData = "";
yosin_UTC9 2016/04/13 06:13:08 Please use single-quote in script fragment since o
chongz 2016/04/13 23:53:08 Done.
+ var txt = document.getElementById('txt');
+ txt.addEventListener('beforeinput', function(e) {
yosin_UTC9 2016/04/13 06:13:08 nit: Please avoid to use single-letter variable na
chongz 2016/04/13 23:53:08 Done.
+ lastData = e.data;
+ });
+ if (!window.eventSender) {
+ document.write('This test requires eventSender');
+ } else {
+ function testKeyDownData(key, modifiers, data) {
+ eventSender.keyDown(key, modifiers);
+ assert_equals(lastData, data, "${modifiers.toString()}+${key} should produce data: ${data}");
yosin_UTC9 2016/04/13 06:13:08 I think you mean `${modifiers.toString()}....`. Te
chongz 2016/04/13 23:53:08 Done.
+ }
+
+ txt.focus();
+ // Typing
+ testKeyDownData('a', [], 'a');
+ testKeyDownData('4', [], '4');
+ testKeyDownData('backspace', [], '');
+ // Shift+foo doesn't work with eventSender, but actually |data| is correct according to manual tests.
+ // testKeyDownData('l', ['shiftKey'], 'L');
+ // testKeyDownData('6', ['shiftKey'], '^');
+ testKeyDownData(' ', [], ' ');
+ }
+}, "Testing beforeinput data");
yosin_UTC9 2016/04/13 06:13:08 Please use single-quote in script fragment since o
chongz 2016/04/13 23:53:08 Done.
+</script>
+</body>
+</html>

Powered by Google App Engine
This is Rietveld 408576698