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

Side by Side Diff: LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-keyboard-events.html

Issue 12047073: Merge 140324 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1364/
Patch Set: Created 7 years, 11 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
« no previous file with comments | « no previous file | LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-keyboard-events-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="../../js/resources/js-test-pre.js"></script> 4 <script src="../../js/resources/js-test-pre.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <p id="description"></p> 7 <p id="description"></p>
8 <p> 8 <p>
9 Please run this with DumpRenderTree. 9 Please run this with DumpRenderTree.
10 </p> 10 </p>
(...skipping 23 matching lines...) Expand all
34 } 34 }
35 35
36 function beginTest(title, value) 36 function beginTest(title, value)
37 { 37 {
38 debug("== " + title + " =="); 38 debug("== " + title + " ==");
39 input.value = value; 39 input.value = value;
40 input.blur(); 40 input.blur();
41 input.focus(); 41 input.focus();
42 } 42 }
43 43
44 var eventsCounter = {};
45 function countEvents(event)
46 {
47 if (eventsCounter[event.type] === undefined)
48 eventsCounter[event.type] = 0;
49 eventsCounter[event.type]++;
50 }
51 input.addEventListener('input', countEvents, false);
52 input.addEventListener('change', countEvents, false);
53
44 beginTest('Digit keys'); 54 beginTest('Digit keys');
45 keyDown('7'); 55 keyDown('7'); // -> 07:[--] --
46 keyDown('5'); 56 keyDown('5'); // -> 07:[05] --
47 keyDown('6'); 57 keyDown('6'); // -> 07:56 [--]
48 keyDown('A'); 58 shouldBeUndefined('eventsCounter.input');
59 shouldBeUndefined('eventsCounter.change');
60 keyDown('A'); // -> 07:56 [AM]
49 shouldBeEqualToString('input.value', '07:56'); 61 shouldBeEqualToString('input.value', '07:56');
62 shouldBe('eventsCounter.input', '1');
63 shouldBe('eventsCounter.change', '1');
50 64
51 beginTest('Digit keys starting with zero'); 65 beginTest('Digit keys starting with zero');
52 keyDown('0'); // -> [00]:-- -- 66 keyDown('0'); // -> [00]:-- --
53 keyDown('2'); // -> 02:[--] -- 67 keyDown('2'); // -> 02:[--] --
54 keyDown('0'); // -> 02:[00] -- 68 keyDown('0'); // -> 02:[00] --
55 keyDown('3'); // -> 02:03 [--] 69 keyDown('3'); // -> 02:03 [--]
56 keyDown('P'); // -> 02:03 [PM] 70 keyDown('P'); // -> 02:03 [PM]
57 shouldBeEqualToString('input.value', '14:03'); 71 shouldBeEqualToString('input.value', '14:03');
58 72
59 beginTest('Digit keys and backspace key','01:01'); 73 beginTest('Digit keys and backspace key','01:01');
(...skipping 30 matching lines...) Expand all
90 shouldBeEqualToString('document.activeElement.id', 'input'); 104 shouldBeEqualToString('document.activeElement.id', 'input');
91 105
92 beginTest('Up/Down keys', '04:56'); 106 beginTest('Up/Down keys', '04:56');
93 keyDown('upArrow'); 107 keyDown('upArrow');
94 shouldBeEqualToString('input.value', '05:56'); 108 shouldBeEqualToString('input.value', '05:56');
95 keyDown('downArrow'); 109 keyDown('downArrow');
96 keyDown('downArrow'); 110 keyDown('downArrow');
97 shouldBeEqualToString('input.value', '03:56'); 111 shouldBeEqualToString('input.value', '03:56');
98 112
99 beginTest('Up/Down keys on empty value', ''); 113 beginTest('Up/Down keys on empty value', '');
100 keyDown('upArrow'); 114 eventsCounter = {};
101 keyDown('upArrow'); 115 keyDown('upArrow'); // -> [01]:-- --
102 keyDown('rightArrow'); 116 keyDown('upArrow'); // -> [02]:-- --
103 keyDown('downArrow'); 117 keyDown('rightArrow'); // -> 02:[--] --
104 keyDown('downArrow'); 118 keyDown('downArrow'); // -> 02:[59] --
105 keyDown('rightArrow'); 119 keyDown('downArrow'); // -> 02:[58] --
106 keyDown('downArrow'); 120 keyDown('rightArrow'); // -> 02:58 [--]
121 shouldBeUndefined('eventsCounter.input');
122 shouldBeUndefined('eventsCounter.change');
123 keyDown('downArrow'); // -> 02:58 [PM]
107 shouldBeEqualToString('input.value', '14:58'); 124 shouldBeEqualToString('input.value', '14:58');
125 shouldBe('eventsCounter.input', '1');
126 shouldBe('eventsCounter.change', '1');
108 127
109 beginTest('Tab key', '03:00'); 128 beginTest('Tab key', '03:00');
110 keyDown('\t'); 129 keyDown('\t');
111 keyDown('5'); 130 keyDown('5');
112 shouldBeEqualToString('input.value', '03:05'); 131 shouldBeEqualToString('input.value', '03:05');
113 keyDown('\t', ['shiftKey']); 132 keyDown('\t', ['shiftKey']);
114 keyDown('7'); 133 keyDown('7');
115 shouldBeEqualToString('input.value', '07:05'); 134 shouldBeEqualToString('input.value', '07:05');
116 keyDown('\t'); 135 keyDown('\t');
117 keyDown('\t'); 136 keyDown('\t');
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 keyDown('2'); // -> 01:[02] 209 keyDown('2'); // -> 01:[02]
191 shouldBeEqualToString('input.value', '01:02'); 210 shouldBeEqualToString('input.value', '01:02');
192 keyDown('\t', ['shiftKey']); // -> [01]:02 211 keyDown('\t', ['shiftKey']); // -> [01]:02
193 keyDown('3'); // -> [03]:02 212 keyDown('3'); // -> [03]:02
194 shouldBeEqualToString('input.value', '03:02'); 213 shouldBeEqualToString('input.value', '03:02');
195 input.removeAttribute("lang"); 214 input.removeAttribute("lang");
196 </script> 215 </script>
197 <script src="../../js/resources/js-test-post.js"></script> 216 <script src="../../js/resources/js-test-post.js"></script>
198 </body> 217 </body>
199 </html> 218 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/forms/time-multiple-fields/time-multiple-fields-keyboard-events-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698