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

Side by Side 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: dtapuska's review, also add layout tests Created 4 years, 9 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 unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <title>InputEvent: beforeinput data</title>
5 <script src="../../../resources/testharness.js"></script>
6 <script src="../../../resources/testharnessreport.js"></script>
7 </head>
8 <body>
9 <div id="log"></div>
10 <input type="text" id="txt">
11
yosin_UTC9 2016/03/15 08:32:32 nit: please remove an extra blank line.
12 <script>
13 test(function() {
14 var lastData = "";
15 var txt = document.getElementById('txt');
16 txt.addEventListener('beforeinput', function(e) {
17 lastData = e.data;
18 });
19 if (!window.eventSender) {
20 document.write('This test requires eventSender');
21 } else {
22 function testKeyDownData(key, modifiers, data) {
23 eventSender.keyDown(key, modifiers);
24 assert_equals(lastData, data, modifiers.toString() + "+" + key + " s hould produce data:" + data);
yosin_UTC9 2016/03/15 08:32:32 nit: It is better to use template string to improv
25 }
26
27 txt.focus();
28 // Typing
29 testKeyDownData('a', [], 'a');
30 testKeyDownData('4', [], '4');
31 testKeyDownData('backspace', [], '');
32 // Shift+foo doesn't work with eventSender, but actually |data| is corre ct according to manual tests.
33 // testKeyDownData('l', ['shiftKey'], 'L');
34 // testKeyDownData('6', ['shiftKey'], '^');
35 testKeyDownData(' ', [], ' ');
36 }
37 }, "Testing beforeinput data");
38 </script>
39
yosin_UTC9 2016/03/15 08:32:32 nit: please remove an extra blank line.
40 </body>
41 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698