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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/forms/focus-change-on-keypress.html

Issue 2100243002: Remove non-standardize key code names from event_sender. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix inspector tests that were missed by sed 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
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <body> 3 <body>
4 <p>This tests changing the focus on keypress event. The character typed by user should be inserted into input. This test only runs in DRT.</p> 4 <p>This tests changing the focus on keypress event. The character typed by user should be inserted into input. This test only runs in DRT.</p>
5 <pre><script> 5 <pre><script>
6 6
7 function runTest(name, shouldChangeSelection) { 7 function runTest(name, shouldChangeSelection) {
8 var dummy = document.createElement('input'); 8 var dummy = document.createElement('input');
9 document.body.appendChild(dummy); 9 document.body.appendChild(dummy);
10 10
11 var element = document.createElement(name); 11 var element = document.createElement(name);
12 document.body.appendChild(element); 12 document.body.appendChild(element);
13 element.addEventListener('keypress', function() { 13 element.addEventListener('keypress', function() {
14 if (element.value.length >= 2) 14 if (element.value.length >= 2)
15 dummy.focus(); 15 dummy.focus();
16 }) 16 })
17 17
18 document.writeln(name + (shouldChangeSelection ? ' with selectionchange' : ' without selectionchange')); 18 document.writeln(name + (shouldChangeSelection ? ' with selectionchange' : ' without selectionchange'));
19 19
20 element.focus(); 20 element.focus();
21 eventSender.keyDown('a'); 21 eventSender.keyDown('a');
22 eventSender.leapForward(100); 22 eventSender.leapForward(100);
23 eventSender.keyDown(name == 'textarea' ? '\n' : 'b'); 23 eventSender.keyDown(name == 'textarea' ? 'Enter' : 'b');
24 eventSender.leapForward(100); 24 eventSender.leapForward(100);
25 if (shouldChangeSelection) { 25 if (shouldChangeSelection) {
26 element.selectionStart = 1; 26 element.selectionStart = 1;
27 element.selectionEnd = 1; 27 element.selectionEnd = 1;
28 } 28 }
29 eventSender.keyDown('c'); 29 eventSender.keyDown('c');
30 eventSender.leapForward(100); 30 eventSender.leapForward(100);
31 31
32 var expected = null; 32 var expected = null;
33 if (name == 'textarea') 33 if (name == 'textarea')
(...skipping 15 matching lines...) Expand all
49 runTest('input', true); 49 runTest('input', true);
50 runTest('textarea', false); 50 runTest('textarea', false);
51 runTest('textarea', true); 51 runTest('textarea', true);
52 52
53 document.writeln('DONE'); 53 document.writeln('DONE');
54 } 54 }
55 55
56 </script></pre> 56 </script></pre>
57 </body> 57 </body>
58 </html> 58 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698