-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
form input month test file from TestTTF. merged with #155.
- Loading branch information
Showing
1 changed file
with
74 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,93 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>Inputs Month</title> | ||
<meta name=viewport content="width=device-width, maximum-scale=1.0, user-scalable=no" /> | ||
<link rel="author" title="Morishita Hiromitsu" href="mailto:hero@asterisk-works.jp"> | ||
<link rel="help" href="http://www.w3.org/TR/html5/the-input-element.html#the-input-element"> | ||
<link rel="author" title="Morishita Hiromitsu" href="mailto:hero@asterisk-works.jp"> | ||
<link rel="author" title="kaseijin" href="mailto:pcmkas@gmail.com"> | ||
<link rel="help" href="http://www.w3.org/html/wg/drafts/html/master/forms.html#month-state-(type=month)"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
</head> | ||
<body> | ||
<h1>Inputs Month</h1> | ||
<div style="display: none"> | ||
<input id="valid" type="month" value="2011-11" min="2011-01" max="2011-12" /> | ||
<input id="too_small_value" type="month" value="1999-01" min="2011-01" max="2011-12"/> | ||
<input id="too_large_value" type="month" value="2099-01" min="2011-01" max="2011-12"/> | ||
<input id="invalid_value" type="month" value="invalid-month" min="2011-01" max="2011-12"/> | ||
<input id="invalid_min" type="month" value="2011-01" min="invalid_min" max="2011-12"/> | ||
<input id="invalid_max" type="month" value="2011-01" min="2011-01" max="invalid_max"/> | ||
<input id="invalid_min_and_max" type="month" value="2011-01" min="2099-01" max="2011-12"/> | ||
|
||
<input id="value_can_be_empty_string" type="month" value="2013-06" /> | ||
<input id="invalid_value_with_two_digits_year" type="month" value="13-06" /> | ||
<input id="invalid_value_is_set" type="month" /> | ||
<input id="invalid_value_is_set_to_valid_value" type="month" value="2013-05" /> | ||
<input id="step_attribute_is_invalid_value" type="month" value="2013-06" step="invalid_step_value" /> | ||
</div> | ||
|
||
<h1>Inputs Month</h1> | ||
<div style="display: none"> | ||
<input id="valid" type="month" value="2011-01" min="2011-01" max="2011-12" /> | ||
<input id="too_small_value" type="month" value="1999-01" min="2011-01" max="2011-12"/> | ||
<input id="too_large_value" type="month" value="2099-01" min="2011-01" max="2011-12"/> | ||
<input id="invalid_value" type="month" value="invalid-month" min="2011-01" max="2011-12"/> | ||
<input id="invalid_min" type="month" value="2011-01" min="invalid_min" max="2011-12"/> | ||
<input id="invalid_max" type="month" value="2011-01" min="2011-01" max="invalid_max"/> | ||
<input id="min_larger_than_max" type="month" value="2011-01" min="2099-01" max="2011-12"/> | ||
</div> | ||
|
||
<div id="log"> | ||
</div> | ||
|
||
<script type="text/javascript"> | ||
|
||
test(function() {assert_equals(document.getElementById("valid").type, "month")}, | ||
"month type support on input element", { | ||
"help" : "http://www.w3.org/html/wg/drafts/html/master/forms.html#month-state-(type=month)" }); | ||
<script> | ||
|
||
test(function() { | ||
assert_equals(document.getElementById("valid").value, "2011-01"), | ||
assert_equals(document.getElementById("too_small_value").value, "2011-01"), | ||
assert_equals(document.getElementById("too_large_value").value, "2011-12")}, | ||
"The value attribute, if specified and not empty, must have a value that is a valid month string", { | ||
"help" : "http://www.w3.org/html/wg/drafts/html/master/forms.html#month-state-(type=month)" }); | ||
test(function() { | ||
assert_equals(document.getElementById("valid").type, "month") | ||
}, | ||
"month type support on input element", { | ||
"help" : "http://www.w3.org/html/wg/drafts/html/master/forms.html#month-state-(type=month)" }); | ||
|
||
test(function() { | ||
assert_equals(document.getElementById("valid").min, "2011-01"), | ||
assert_equals(document.getElementById("invalid_min").min, "") | ||
}, | ||
"The min attribute, if specified, must have a value that is a valid month string.", { | ||
"help" : "http://www.w3.org/html/wg/drafts/html/master/forms.html#month-state-(type=month)" }); | ||
test(function() { | ||
assert_equals(document.getElementById("valid").value, "2011-11"), | ||
assert_not_equals(document.getElementById("too_small_value").value, "1999-01"),//spec is not clear | ||
assert_not_equals(document.getElementById("too_large_value").value, "2099-01")},//spec is not clear | ||
"The value attribute, if specified and not empty, must have a value that is a valid month string", { | ||
"help" : "http://www.w3.org/html/wg/drafts/html/master/forms.html#month-state-(type=month)" }); | ||
|
||
test(function() { | ||
assert_equals(document.getElementById("valid").max, "2011-12"), | ||
assert_equals(document.getElementById("min_larger_than_max").max, "2099-01"), | ||
assert_equals(document.getElementById("invalid_max").max, "") | ||
test(function() { | ||
assert_equals(document.getElementById("valid").min, "2011-01"), | ||
assert_not_equals(document.getElementById("invalid_min").min, "invalid_min") | ||
}, | ||
"The max attribute, if specified, must have a value that is a valid month string", { | ||
"help" : "http://www.w3.org/html/wg/drafts/html/master/forms.html#month-state-(type=month)" }); | ||
"The min attribute, if specified, must have a value that is a valid month string.", { | ||
"help" : "http://www.w3.org/html/wg/drafts/html/master/forms.html#month-state-(type=month)" }); | ||
|
||
test(function() { | ||
assert_equals(document.getElementById("invalid_value").value, "") | ||
}, | ||
"User agents must not allow the user to set the value to a non-empty string that is not a valid month string.", { | ||
"help" : "http://www.w3.org/html/wg/drafts/html/master/forms.html#month-state-(type=month)" }); | ||
</script> | ||
|
||
test(function() { | ||
assert_equals(document.getElementById("valid").max, "2011-12"), | ||
assert_not_equals(document.getElementById("invalid_max").max, "invalid_max"), | ||
assert_not_equals(document.getElementById("invalid_min_and_max").max, "2011-12") | ||
}, | ||
"The max attribute, if specified, must have a value that is a valid month string", { | ||
"help" : "http://www.w3.org/html/wg/drafts/html/master/forms.html#month-state-(type=month)" }); | ||
|
||
test(function() { | ||
assert_not_equals(document.getElementById("invalid_value").value, "invalid-month") | ||
}, | ||
"User agents must not allow the user to set the value to a non-empty string that is not a valid month string.", { | ||
"help" : "http://www.w3.org/html/wg/drafts/html/master/forms.html#month-state-(type=month)" }); | ||
|
||
test(function() { | ||
document.getElementById("value_can_be_empty_string").value = ""; | ||
assert_equals(document.getElementById("value_can_be_empty_string").value, "") | ||
}, "Month value can be empty string."); | ||
|
||
test(function() { | ||
assert_equals(document.getElementById("invalid_value_with_two_digits_year").value, "") | ||
}, "When value attribute has two digits year value, the value,which is invalid, must return empty string."); | ||
|
||
test(function() { | ||
document.getElementById("invalid_value_is_set").value = "invalid value"; | ||
assert_equals(document.getElementById("invalid_value_is_set").value, "") | ||
}, "When value is set with invalid value, the value must return empty string."); | ||
|
||
test(function() { | ||
document.getElementById("invalid_value_is_set_to_valid_value").value = "invalid value"; | ||
assert_equals(document.getElementById("invalid_value_is_set_to_valid_value").value, "2013-05") | ||
}, "When value is given invalid value to non-empty valid string, the value must be same as before."); | ||
|
||
test(function() { | ||
document.getElementById("step_attribute_is_invalid_value").stepUp(); | ||
assert_equals(document.getElementById("step_attribute_is_invalid_value").value, "2013-07") | ||
}, "When step attribute is given invalid value, it must ignore the invalid value and use defaul value instead."); | ||
</script> | ||
</body> | ||
|
||
</html> |