| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Inputs Month</title> | 4 <title>Inputs Month</title> |
| 5 <link rel="author" title="Morishita Hiromitsu" href="mailto:hero@asterisk-wo
rks.jp"> | 5 <link rel="author" title="Morishita Hiromitsu" href="mailto:hero@asterisk-wo
rks.jp"> |
| 6 <link rel="author" title="kaseijin" href="mailto:pcmkas@gmail.com"> | 6 <link rel="author" title="kaseijin" href="mailto:pcmkas@gmail.com"> |
| 7 <link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org"> | 7 <link rel="author" title="Denis Ah-Kang" href="mailto:denis@w3.org"> |
| 8 <link rel="help" href="https://html.spec.whatwg.org/multipage/#months"> | 8 <link rel="help" href="https://html.spec.whatwg.org/multipage/#months"> |
| 9 <link rel="help" href="https://html.spec.whatwg.org/multipage/#month-state-(
type=month)"> | 9 <link rel="help" href="https://html.spec.whatwg.org/multipage/#month-state-(
type=month)"> |
| 10 <script src="/resources/testharness.js"></script> | 10 <script src="/resources/testharness.js"></script> |
| 11 <script src="/resources/testharnessreport.js"></script> | 11 <script src="/resources/testharnessreport.js"></script> |
| 12 </head> | 12 </head> |
| 13 <body> | 13 <body> |
| 14 <h1>Inputs Month</h1> | 14 <h1>Inputs Month</h1> |
| 15 <div style="display: none"> | 15 <div style="display: none"> |
| 16 <input id="valid" type="month" value="2011-11" min="2011-01" max="2011-12"
/> | 16 <input id="valid" type="month" value="2011-11" min="2011-01" max="2011-12"
/> |
| 17 <input id="too_small_value" type="month" value="1999-01" min="2011-01" max
="2011-12"/> | |
| 18 <input id="too_large_value" type="month" value="2099-01" min="2011-01" max
="2011-12"/> | |
| 19 <input id="invalid_value" type="month" value="invalid-month" min="2011-01"
max="2011-12"/> | 17 <input id="invalid_value" type="month" value="invalid-month" min="2011-01"
max="2011-12"/> |
| 20 <input id="invalid_min" type="month" value="2011-01" min="invalid_min" max
="2011-12"/> | |
| 21 <input id="invalid_max" type="month" value="2011-01" min="2011-01" max="in
valid_max"/> | |
| 22 <input id="min_larger_than_max" type="month" value="2011-01" min="2099-01"
max="2011-12"/> | |
| 23 <input id="value_can_be_empty_string" type="month" value="2013-06" /> | 18 <input id="value_can_be_empty_string" type="month" value="2013-06" /> |
| 24 <input id="invalid_value_with_two_digits_year" type="month" value="13-06"
/> | 19 <input id="invalid_value_with_two_digits_year" type="month" value="13-06"
/> |
| 25 <input id="invalid_value_is_set" type="month" /> | 20 <input id="invalid_value_is_set" type="month" /> |
| 26 <input id="invalid_value_is_set_to_valid_value" type="month" value="2013-0
5" /> | |
| 27 <input id="step_attribute_is_invalid_value" type="month" value="2013-06" s
tep="invalid_step_value" /> | 21 <input id="step_attribute_is_invalid_value" type="month" value="2013-06" s
tep="invalid_step_value" /> |
| 28 <input id="invalid_month_too_high" type="month" value="2013-13" /> | 22 <input id="invalid_month_too_high" type="month" value="2013-13" /> |
| 29 <input id="invalid_month_too_low" type="month" value="2013-00" /> | 23 <input id="invalid_month_too_low" type="month" value="2013-00" /> |
| 30 </div> | 24 </div> |
| 31 | 25 |
| 32 <div id="log"></div> | 26 <div id="log"></div> |
| 33 | 27 |
| 34 <script> | 28 <script> |
| 35 test(function() { | 29 test(function() { |
| 36 assert_equals(document.getElementById("valid").type, "month") | 30 assert_equals(document.getElementById("valid").type, "month") |
| 37 }, "month type support on input element"); | 31 }, "month type support on input element"); |
| 38 | 32 |
| 39 test(function() { | 33 test(function() { |
| 40 assert_equals(document.getElementById("valid").value, "2011-11"), | |
| 41 assert_equals(document.getElementById("too_small_value").value, "2011-01
"), | |
| 42 assert_equals(document.getElementById("too_large_value").value, "2011-12
") | |
| 43 }, "The value attribute, if specified and not empty, must have a value tha
t is a valid month string"); | |
| 44 | |
| 45 test(function() { | |
| 46 assert_equals(document.getElementById("valid").min, "2011-01"), | |
| 47 assert_equals(document.getElementById("invalid_min").min, "") | |
| 48 }, "The min attribute, if specified, must have a value that is a valid mon
th string."); | |
| 49 | |
| 50 test(function() { | |
| 51 assert_equals(document.getElementById("valid").max, "2011-12"), | |
| 52 assert_equals(document.getElementById("min_larger_than_max").max, "2099-
01"), | |
| 53 assert_equals(document.getElementById("invalid_max").max, "") | |
| 54 }, "The max attribute, if specified, must have a value that is a valid mon
th string"); | |
| 55 | |
| 56 test(function() { | |
| 57 assert_equals(document.getElementById("invalid_value").value, "") | 34 assert_equals(document.getElementById("invalid_value").value, "") |
| 58 }, "User agents must not allow the user to set the value to a non-empty st
ring that is not a valid month string."); | 35 }, "User agents must not allow the user to set the value to a non-empty st
ring that is not a valid month string."); |
| 59 | 36 |
| 60 test(function() { | 37 test(function() { |
| 61 document.getElementById("value_can_be_empty_string").value = ""; | 38 document.getElementById("value_can_be_empty_string").value = ""; |
| 62 assert_equals(document.getElementById("value_can_be_empty_string").value
, "") | 39 assert_equals(document.getElementById("value_can_be_empty_string").value
, "") |
| 63 }, "Month value can be empty string."); | 40 }, "Month value can be empty string."); |
| 64 | 41 |
| 65 test(function() { | 42 test(function() { |
| 66 assert_equals(document.getElementById("invalid_value_with_two_digits_yea
r").value, "") | 43 assert_equals(document.getElementById("invalid_value_with_two_digits_yea
r").value, "") |
| 67 }, "When value attribute has two digits year value, the value,which is inv
alid, must return empty string."); | 44 }, "When value attribute has two digits year value, the value,which is inv
alid, must return empty string."); |
| 68 | 45 |
| 69 test(function() { | 46 test(function() { |
| 70 document.getElementById("invalid_value_is_set").value = "invalid value"; | 47 document.getElementById("invalid_value_is_set").value = "invalid value"; |
| 71 assert_equals(document.getElementById("invalid_value_is_set").value, "") | 48 assert_equals(document.getElementById("invalid_value_is_set").value, "") |
| 72 }, "When value is set with invalid value, the value must return empty stri
ng."); | 49 }, "When value is set with invalid value, the value must return empty stri
ng."); |
| 73 | 50 |
| 74 test(function() { | 51 test(function() { |
| 75 document.getElementById("invalid_value_is_set_to_valid_value").value = "
invalid value"; | |
| 76 assert_equals(document.getElementById("invalid_value_is_set_to_valid_val
ue").value, "2013-05") | |
| 77 }, "When value is given invalid value to non-empty valid string, the value
must be same as before."); | |
| 78 | |
| 79 test(function() { | |
| 80 document.getElementById("step_attribute_is_invalid_value").stepUp(); | 52 document.getElementById("step_attribute_is_invalid_value").stepUp(); |
| 81 assert_equals(document.getElementById("step_attribute_is_invalid_value")
.value, "2013-07") | 53 assert_equals(document.getElementById("step_attribute_is_invalid_value")
.value, "2013-07") |
| 82 }, "When step attribute is given invalid value, it must ignore the invalid
value and use defaul value instead."); | 54 }, "When step attribute is given invalid value, it must ignore the invalid
value and use defaul value instead."); |
| 83 | 55 |
| 84 test(function() { | 56 test(function() { |
| 85 assert_equals(document.getElementById("invalid_month_too_high").value, "
"); | 57 assert_equals(document.getElementById("invalid_month_too_high").value, "
"); |
| 86 }, "Month should be <= 13: If the value of the element is not a valid mont
h string, then set it to the empty string instead."); | 58 }, "Month should be <= 13: If the value of the element is not a valid mont
h string, then set it to the empty string instead."); |
| 87 | 59 |
| 88 test(function() { | 60 test(function() { |
| 89 assert_equals(document.getElementById("invalid_month_too_low").value, ""
); | 61 assert_equals(document.getElementById("invalid_month_too_low").value, ""
); |
| 90 }, "Month should be > 0: If the value of the element is not a valid month
string, then set it to the empty string instead.>"); | 62 }, "Month should be > 0: If the value of the element is not a valid month
string, then set it to the empty string instead.>"); |
| 91 </script> | 63 </script> |
| 92 </body> | 64 </body> |
| 93 </html> | 65 </html> |
| OLD | NEW |