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

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 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/events/inputevents/before-input-inputtype.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..aad057d6617b58af6e10b3c38ccab079feda332a
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/fast/events/inputevents/before-input-data.html
@@ -0,0 +1,39 @@
+<!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 = '';
+ var txt = document.getElementById('txt');
+ txt.addEventListener('beforeinput', function(event) {
+ lastData = event.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}`);
+ }
+
+ txt.focus();
+ // Typing
+ testKeyDownData('a', [], 'a');
+ testKeyDownData('4', [], '4');
+ testKeyDownData('backspace', [], '');
+ // TODO(chongz): eventSender.keyDown('a', ['shiftKey']) should produce shifted character.
+ // https://crbug.com/604488
+ // testKeyDownData('l', ['shiftKey'], 'L');
+ // testKeyDownData('6', ['shiftKey'], '^');
+ testKeyDownData(' ', [], ' ');
+ }
+}, 'Testing beforeinput data');
+</script>
+</body>
+</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/fast/events/inputevents/before-input-inputtype.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698