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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/events/inputevents/inputevent-data-keyboard.html

Issue 2117543003: [InputEvent] Fill |data| field for 'input' event InsertText (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed |dataFromCommand()| helper function Created 4 years, 5 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: data field from keyboard</title>
5 <script src="../../../resources/testharness.js"></script>
6 <script src="../../../resources/testharnessreport.js"></script>
7 </head>
8 <body>
9 <p id="txt" contenteditable></p>
10 <script>
11 test(function() {
12 assert_not_equals(window.eventSender, undefined, 'This test requires eventSe nder.');
13
14 const NOT_FIRED = 'NOT_FIRED';
15 var beforeinputData = NOT_FIRED;
16 var inputData = NOT_FIRED;
17
18 var txt = document.getElementById('txt');
19 txt.addEventListener('beforeinput', event => beforeinputData = event.data);
20 txt.addEventListener('input', event => inputData = event.data);
21
22 function testKeyDownData(key, modifiers, data) {
23 beforeinputData = NOT_FIRED;
24 inputData = NOT_FIRED;
25 eventSender.keyDown(key, modifiers);
26 assert_equals(beforeinputData, data, `${modifiers.toString()}+${key} sho uld produce beforeinput data: ${data}`);
27 assert_equals(inputData, data, `${modifiers.toString()}+${key} should pr oduce input data: ${data}`);
28 }
29
30 txt.focus();
31 // Typing
32 testKeyDownData('a', [], 'a');
33 testKeyDownData('4', [], '4');
34 testKeyDownData('Backspace', [], '');
35 testKeyDownData('L', ['shiftKey'], 'L');
36 testKeyDownData('^', ['shiftKey'], '^');
37 testKeyDownData(' ', [], ' ');
38 }, 'Testing data field from keyboard');
39 </script>
40 </body>
41 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698