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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/forms/number/number-stepup-stepdown-from-renderer.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 <head> 3 <head>
4 <script src="../../../resources/js-test.js"></script> 4 <script src="../../../resources/js-test.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <input id="test"></input> 7 <input id="test"></input>
8 <script> 8 <script>
9 description('Check stepping-up and -down for number input from renderer.'); 9 description('Check stepping-up and -down for number input from renderer.');
10 10
(...skipping 11 matching lines...) Expand all
22 input.max = max; 22 input.max = max;
23 input.step = step; 23 input.step = step;
24 input.value = value; 24 input.value = value;
25 } 25 }
26 26
27 function stepUp(value, step, max, optionalStepCount) { 27 function stepUp(value, step, max, optionalStepCount) {
28 setInputAttributes(null, max, step, value); 28 setInputAttributes(null, max, step, value);
29 if (typeof optionalStepCount != "undefined") 29 if (typeof optionalStepCount != "undefined")
30 if (optionalStepCount < 0) 30 if (optionalStepCount < 0)
31 for (var i = 0; i < -optionalStepCount; i++) 31 for (var i = 0; i < -optionalStepCount; i++)
32 sendKey('downArrow'); 32 sendKey('ArrowDown');
33 else 33 else
34 for (var i = 0; i < optionalStepCount; i++) 34 for (var i = 0; i < optionalStepCount; i++)
35 sendKey('upArrow'); 35 sendKey('ArrowUp');
36 else 36 else
37 sendKey('upArrow'); 37 sendKey('ArrowUp');
38 return input.value; 38 return input.value;
39 } 39 }
40 40
41 function stepDown(value, step, min, optionalStepCount) { 41 function stepDown(value, step, min, optionalStepCount) {
42 setInputAttributes(min, null, step, value); 42 setInputAttributes(min, null, step, value);
43 if (typeof optionalStepCount != "undefined") 43 if (typeof optionalStepCount != "undefined")
44 if (optionalStepCount < 0) 44 if (optionalStepCount < 0)
45 for (var i = 0; i < -optionalStepCount; i++) 45 for (var i = 0; i < -optionalStepCount; i++)
46 sendKey('upArrow'); 46 sendKey('ArrowUp');
47 else 47 else
48 for (var i = 0; i < optionalStepCount; i++) 48 for (var i = 0; i < optionalStepCount; i++)
49 sendKey('downArrow'); 49 sendKey('ArrowDown');
50 else 50 else
51 sendKey('downArrow'); 51 sendKey('ArrowDown');
52 return input.value; 52 return input.value;
53 } 53 }
54 54
55 // Range value gets automatically shifted based on bounds, 55 // Range value gets automatically shifted based on bounds,
56 // So always set the min and max first to get expected behavior 56 // So always set the min and max first to get expected behavior
57 57
58 function stepUpExplicitBounds(min, max, step, value, stepCount) { 58 function stepUpExplicitBounds(min, max, step, value, stepCount) {
59 setInputAttributes(min, max, step, value); 59 setInputAttributes(min, max, step, value);
60 if (typeof stepCount !== 'undefined') 60 if (typeof stepCount !== 'undefined')
61 if (stepCount < 0) { 61 if (stepCount < 0) {
62 for (var i = 0; i < -stepCount; i++) 62 for (var i = 0; i < -stepCount; i++)
63 sendKey('downArrow'); 63 sendKey('ArrowDown');
64 } else { 64 } else {
65 for (var i = 0; i < stepCount; i++) 65 for (var i = 0; i < stepCount; i++)
66 sendKey('upArrow'); 66 sendKey('ArrowUp');
67 } 67 }
68 else 68 else
69 sendKey('upArrow'); 69 sendKey('ArrowUp');
70 return input.value; 70 return input.value;
71 } 71 }
72 72
73 function stepDownExplicitBounds(min, max, step, value, stepCount) { 73 function stepDownExplicitBounds(min, max, step, value, stepCount) {
74 setInputAttributes(min, max, step, value); 74 setInputAttributes(min, max, step, value);
75 if (typeof stepCount !== 'undefined') 75 if (typeof stepCount !== 'undefined')
76 if (stepCount < 0) { 76 if (stepCount < 0) {
77 for (var i = 0; i < -stepCount; i++) 77 for (var i = 0; i < -stepCount; i++)
78 sendKey('upArrow'); 78 sendKey('ArrowUp');
79 } else { 79 } else {
80 for (var i = 0; i < stepCount; i++) 80 for (var i = 0; i < stepCount; i++)
81 sendKey('downArrow'); 81 sendKey('ArrowDown');
82 } 82 }
83 else 83 else
84 sendKey('downArrow'); 84 sendKey('ArrowDown');
85 return input.value; 85 return input.value;
86 } 86 }
87 87
88 debug('Number type'); 88 debug('Number type');
89 input.type = 'number'; 89 input.type = 'number';
90 debug('Function arguments are (value, step, {min or max}, [stepCount]).'); 90 debug('Function arguments are (value, step, {min or max}, [stepCount]).');
91 debug('Invalid value'); 91 debug('Invalid value');
92 shouldBe('stepUp("", null, null)', '"1"'); 92 shouldBe('stepUp("", null, null)', '"1"');
93 shouldBe('stepDown("", null, null)', '"-1"'); 93 shouldBe('stepDown("", null, null)', '"-1"');
94 shouldBe('stepUp("", "any", null)', '"1"'); 94 shouldBe('stepUp("", "any", null)', '"1"');
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 shouldBe('stepDownExplicitBounds(1, 4, 1, 0)', '"0"'); 166 shouldBe('stepDownExplicitBounds(1, 4, 1, 0)', '"0"');
167 shouldBe('stepDownExplicitBounds(-4, -1, 1, 0)', '"-1"'); 167 shouldBe('stepDownExplicitBounds(-4, -1, 1, 0)', '"-1"');
168 shouldBe('stepUpExplicitBounds(-4, -1, 1, 0)', '"0"'); 168 shouldBe('stepUpExplicitBounds(-4, -1, 1, 0)', '"0"');
169 shouldBe('stepUpExplicitBounds(-100, null, 3, 3)', '"5"'); 169 shouldBe('stepUpExplicitBounds(-100, null, 3, 3)', '"5"');
170 shouldBe('stepDownExplicitBounds(-100, null, 3, 3)', '"2"'); 170 shouldBe('stepDownExplicitBounds(-100, null, 3, 3)', '"2"');
171 171
172 debug(''); 172 debug('');
173 </script> 173 </script>
174 </body> 174 </body>
175 </html> 175 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698