-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
the test of input type=month #155
Merged
odinho
merged 3 commits into
web-platform-tests:master
from
Asterisk-works:submissions/hero
Jun 8, 2013
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<!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"> | ||
<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"/> | ||
</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)" }); | ||
|
||
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").min, "2011-01"), | ||
assert_not_equals(document.getElementById("invalid_min").min, "invalid_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").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)" }); | ||
</script> | ||
|
||
</body> | ||
|
||
</html> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should rather test for what it should be in these. Reading the spec, since this is a DOMString (wo ?) and it doesn't seem to define a default min, it should probably be "". Were you seeing different browser behaviour? Maybe the spec needs to be changed?