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

Side by Side Diff: LayoutTests/fast/forms/time/time-stepup-stepdown.html

Issue 136783006: Upgrade stepUp()/stepDown() implementation to match spec. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: applyStep(): add missing EventQueueScope Created 6 years, 10 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 <p id="description"></p> 7 <p id="description"></p>
8 <div id="console"></div> 8 <div id="console"></div>
9 <script> 9 <script>
10 description('Check stepUp() and stepDown() bahevior for type=time.'); 10 description('Check stepUp() and stepDown() behavior for type=time.');
11 11
12 var input = document.createElement('input'); 12 var input = document.createElement('input');
13 13
14 function setInputAttributes(min, max, step, value) { 14 function setInputAttributes(min, max, step, value) {
15 input.min = min; 15 input.min = min;
16 input.max = max; 16 input.max = max;
17 input.step = step; 17 input.step = step;
18 input.value = value; 18 input.value = value;
19 } 19 }
20 20
(...skipping 10 matching lines...) Expand all
31 setInputAttributes(min, null, step, value); 31 setInputAttributes(min, null, step, value);
32 if (typeof optionalStepCount != "undefined") 32 if (typeof optionalStepCount != "undefined")
33 input.stepDown(optionalStepCount); 33 input.stepDown(optionalStepCount);
34 else 34 else
35 input.stepDown(); 35 input.stepDown();
36 return input.value; 36 return input.value;
37 } 37 }
38 38
39 input.type = 'time'; 39 input.type = 'time';
40 debug('Invalid value'); 40 debug('Invalid value');
41 shouldThrow('stepUp("", null, null)'); 41 shouldBeEqualToString('stepUp("", null, null)', '00:01');
42 shouldThrow('stepDown("", null, null)'); 42 shouldBeEqualToString('stepDown("", null, null)', '00:00');
43 debug('Non-number arguments'); 43 debug('Non-number arguments');
44 shouldBe('stepUp("20:13", null, null, "0")', '"20:13"'); 44 shouldBeEqualToString('stepUp("20:13", null, null, "0")', '20:13');
45 shouldBe('stepDown("20:13", null, null, "0")', '"20:13"'); 45 shouldBeEqualToString('stepDown("20:13", null, null, "0")', '20:13');
46 shouldBe('stepUp("20:13", null, null, "foo")', '"20:13"'); 46 shouldBeEqualToString('stepUp("20:13", null, null, "foo")', '20:13');
47 shouldBe('stepDown("20:13", null, null, "foo")', '"20:13"'); 47 shouldBeEqualToString('stepDown("20:13", null, null, "foo")', '20:13');
48 shouldBe('stepUp("20:13", null, null, null)', '"20:13"'); 48 shouldBeEqualToString('stepUp("20:13", null, null, null)', '20:13');
49 shouldBe('stepDown("20:13", null, null, null)', '"20:13"'); 49 shouldBeEqualToString('stepDown("20:13", null, null, null)', '20:13');
50 debug('Normal cases'); 50 debug('Normal cases');
51 shouldBe('stepUp("20:13", null, null)', '"20:14"'); 51 shouldBeEqualToString('stepUp("20:13", null, null)', '20:14');
52 shouldBe('stepDown("20:13", null, null)', '"20:12"'); 52 shouldBeEqualToString('stepDown("20:13", null, null)', '20:12');
53 shouldBe('stepUp("20:13", null, null, 10)', '"20:23"'); 53 shouldBeEqualToString('stepUp("20:13", null, null, 10)', '20:23');
54 shouldBe('stepDown("20:13", null, null, 11)', '"20:02"'); 54 shouldBeEqualToString('stepDown("20:13", null, null, 11)', '20:02');
55 shouldBe('stepUp("20:13", "4", null, 2)', '"20:13:08"'); 55 shouldBeEqualToString('stepUp("20:13", "4", null, 2)', '20:13:08');
56 shouldBe('stepDown("20:13", "4", null, 3)', '"20:12:48"'); 56 shouldBeEqualToString('stepDown("20:13", "4", null, 3)', '20:12:48');
57 debug('Step=any'); 57 debug('Step=any');
58 shouldThrow('stepUp("20:13", "any", null)'); 58 shouldThrow('stepUp("20:13", "any", null)');
59 shouldThrow('stepDown("20:13", "any", null)'); 59 shouldThrow('stepDown("20:13", "any", null)');
60 debug('Overflow/underflow'); 60 debug('Overflow/underflow');
61 shouldThrow('stepUp("20:13", "3.40282346e+38", null)'); 61 shouldBeEqualToString('stepUp("20:13", "3.40282346e+38", null)', '23:59:59.999') ;
62 shouldThrow('stepDown("20:13", "3.40282346e+38", null)'); 62 shouldBeEqualToString('stepDown("20:13", "3.40282346e+38", null)', '00:00:00');
63 shouldThrow('stepUp("20:13", "1", "20:13")'); 63 shouldBeEqualToString('stepUp("20:13", "1", "20:13")', '20:13:00');
64 shouldThrow('stepDown("20:13", "1", "20:13")'); 64 shouldBeEqualToString('stepDown("20:13", "1", "20:13")', '20:13:00');
65 shouldThrow('stepUp("23:59", null, null)'); 65 shouldBeEqualToString('stepUp("23:59", null, null)', '23:59');
66 shouldThrow('stepDown("00:00", null, null)'); 66 shouldBeEqualToString('stepDown("00:00", null, null)', '00:00');
67 67
68 debug(''); 68 debug('');
69 </script> 69 </script>
70 </body> 70 </body>
71 </html> 71 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698