Move parseFontFaceDescriptor to CSSPropertyParser.cpp
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / forms / month / input-valueasdate-month.html
blob37a7fedccb8c20a281bc90c78a592a4340f87da1
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/js-test.js"></script>
5 </head>
6 <body>
7 <p id="description"></p>
8 <div id="console"></div>
9 <script>
10 description('Tests for .valueAsDate with &lt;input type=month>.');
12 var input = document.createElement('input');
13 input.type = 'month';
15 function valueAsDateFor(stringValue) {
16 input.value = stringValue;
17 return input.valueAsDate;
20 function setValueAsDateAndGetValue(year, month, day) {
21 var date = new Date();
22 date.setTime(Date.UTC(year, month, day));
23 if (year < 100)
24 date.setUTCFullYear(year);
25 input.valueAsDate = date;
26 return input.value;
29 shouldBe('valueAsDateFor("")', 'null');
30 shouldBe('valueAsDateFor("1969-12").getTime()', 'Date.UTC(1969, 11, 1, 0, 0, 0, 0)');
31 shouldBe('valueAsDateFor("1970-01").getTime()', 'Date.UTC(1970, 0, 1)');
32 shouldBe('valueAsDateFor("2009-12").getTime()', 'Date.UTC(2009, 11, 1)');
34 shouldBe('setValueAsDateAndGetValue(1969, 11, 1)', '"1969-12"');
35 shouldBe('setValueAsDateAndGetValue(1970, 0, 1)', '"1970-01"');
36 shouldBe('setValueAsDateAndGetValue(2009, 11, 31)', '"2009-12"');
37 shouldBe('setValueAsDateAndGetValue(10000, 0, 1)', '"10000-01"');
39 shouldBe('setValueAsDateAndGetValue(-1, 9, 22)', '""');
40 shouldBe('setValueAsDateAndGetValue(0, 11, 30)', '""');
41 shouldBe('setValueAsDateAndGetValue(0001, 0, 1)', '"0001-01"');
42 shouldBe('setValueAsDateAndGetValue(0001, 0, 31)', '"0001-01"');
43 shouldBe('setValueAsDateAndGetValue(275760, 8, 13)', '"275760-09"');
44 shouldBe('setValueAsDateAndGetValue(275760, 8, 14)', '""'); // Date of JavaScript can't represent this.
46 debug('Sets null to valueAsDate:');
47 input.value = '2009-12';
48 input.valueAsDate = null;
49 shouldBe('input.value', '""');
50 </script>
51 </body>
52 </html>