-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
new test files from TestTWF #201
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,189 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>Input Time</title> | ||
<meta name=viewport content="width=device-width, maximum-scale=1.0, user-scalable=no" /> | ||
<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>Input Time</h1> | ||
<input id="chkDefaultValue" type="time" /> | ||
<input id="chkStep" type="time" /> | ||
<input id="chkSetValueTest" type="time" /> | ||
<input id="chkSupportAttribute" type="time" min="01:01:01.001" max="12:12:12.012" step="600" /> | ||
<div id="log"> | ||
</div> | ||
|
||
<script type="text/javascript"> | ||
|
||
/* check default value */ | ||
test(function(){ assert_equals(document.getElementById("chkDefaultValue").value, ""); | ||
}, "time element of default time value"); | ||
test(function(){assert_equals(document.getElementById('chkStep').step, ""); | ||
} , "step attribute on default value check"); | ||
test(function(){assert_equals(document.getElementById('chkDefaultValue').max, ""); | ||
} , "max attribute on default value check") | ||
test(function(){assert_equals(document.getElementById('chkDefaultValue').max, ""); | ||
} , "min attribute on default value check") | ||
|
||
/* simple attribute test*/ | ||
test(function(){assert_equals(document.getElementById("chkSupportAttribute").type,"time");} | ||
, "type attribute support on input element"); | ||
test(function(){assert_equals(document.getElementById('chkSupportAttribute').min, "01:01:01.001")} | ||
, "max attribute support on input element"); | ||
test(function(){assert_equals(document.getElementById('chkSupportAttribute').max, "12:12:12.012")} | ||
, "min attribute support on input element"); | ||
test(function(){assert_equals(document.getElementById("chkSupportAttribute").step, "600")} | ||
, "step attribute support on input element"); | ||
|
||
/* check step up and down */ | ||
var _StepTest = document.getElementById("chkStep"); | ||
test(function(){ assert_true(typeof(_StepTest.stepUp) ==="function" ) } , "stepUp function support on input Element"); | ||
test(function(){ assert_true(typeof(_StepTest.stepDown) ==="function" ) } , "stepDown function support on input Element"); | ||
|
||
test(function(){ | ||
_StepTest.value = "12:00"; | ||
_StepTest.step = ""; | ||
_StepTest.stepUp(); | ||
assert_equals(_StepTest.value,"12:01"); | ||
} , "stepUp step value empty on default step value "); | ||
|
||
test(function(){ | ||
_StepTest.value = "12:00"; | ||
_StepTest.step = ""; | ||
_StepTest.stepDown(); | ||
assert_equals(_StepTest.value,"11:59"); | ||
}, "stepDown step value empty default step value"); | ||
|
||
test(function(){ | ||
_StepTest.value = "12:00"; | ||
_StepTest.step = "-600"; | ||
_StepTest.stepUp(); | ||
assert_equals(_StepTest.value, "12:01"); | ||
},"stepUp on step value minus"); | ||
test(function(){ | ||
_StepTest.value = "12:00"; | ||
_StepTest.step = "-600"; | ||
_StepTest.stepDown(); | ||
assert_equals(_StepTest.value, "11:59"); | ||
},"stepDown on step value minus"); | ||
|
||
test(function(){ | ||
_StepTest.value = "12:00"; | ||
_StepTest.step = "0"; | ||
_StepTest.stepUp(); | ||
assert_equals(_StepTest.value, "12:01"); | ||
} , "stepUp on step value zero "); | ||
test(function(){ | ||
_StepTest.value = "12:00"; | ||
_StepTest.step = "0"; | ||
_StepTest.stepDown(); | ||
assert_equals(_StepTest.value, "11:59"); | ||
} , "stepDown on step value zero "); | ||
|
||
test(function(){ | ||
_StepTest.value = "00:00"; | ||
_StepTest.step = "86399"; | ||
_StepTest.stepUp(); | ||
assert_equals(_StepTest.value, "23:59:59"); | ||
} , "stepUp on step value 24 hour"); | ||
test(function(){ | ||
_StepTest.value = "23:59:59"; | ||
_StepTest.step = "86399"; | ||
_StepTest.stepDown(); | ||
assert_equals(_StepTest.value, "00:00:00"); | ||
} , "stepDown on step value 24 hour "); | ||
|
||
test(function(){ | ||
_StepTest.value = "12:00"; | ||
_StepTest.step = "3600"; | ||
_StepTest.stepUp(); | ||
assert_equals(_StepTest.value, "13:00"); | ||
} , "stepUp on step value hour "); | ||
test(function(){ | ||
_StepTest.value = "12:00"; | ||
_StepTest.step = "3600"; | ||
_StepTest.stepDown(); | ||
assert_equals(_StepTest.value, "11:00"); | ||
} , "stepDown on step value hour "); | ||
|
||
test(function(){ | ||
_StepTest.value = "12:00"; | ||
_StepTest.step = "1"; | ||
_StepTest.stepUp(); | ||
assert_equals(_StepTest.value, "12:00:01"); | ||
} , "stepUp on step value second "); | ||
test(function(){ | ||
_StepTest.value = "12:00"; | ||
_StepTest.step = "1"; | ||
_StepTest.stepDown(); | ||
assert_equals(_StepTest.value, "11:59:59"); | ||
} , "stepDown on step value second "); | ||
|
||
test(function(){ | ||
_StepTest.value = "12:00"; | ||
_StepTest.step = "0.001"; | ||
_StepTest.stepUp(); | ||
assert_equals(_StepTest.value, "12:00:00.001"); | ||
} , "stepUp on step value miri second "); | ||
test(function(){ | ||
_StepTest.value = "12:00"; | ||
_StepTest.step = "0.001"; | ||
_StepTest.stepDown(); | ||
assert_equals(_StepTest.value, "11:59:59.999"); | ||
} , "stepDown on step value miri second "); | ||
|
||
test(function(){ | ||
_StepTest.value = "13:00:00"; | ||
_StepTest.step = "1"; | ||
_StepTest.stepUp(2); | ||
assert_equals(_StepTest.value, "13:00:02"); | ||
}, "stepUp argment 2 times"); | ||
test(function(){ | ||
_StepTest.value = "13:00:00"; | ||
_StepTest.step = "1"; | ||
_StepTest.stepDown(2); | ||
assert_equals(_StepTest.value, "12:59:58"); | ||
}, "stepDown argment 2 times"); | ||
|
||
test(function(){ | ||
_StepTest.max = "15:00"; | ||
_StepTest.value = "15:00"; | ||
assert_true(typeof(_StepTest.stepUp) ==="function"); | ||
assert_throws("InvalidStateError", function(){ _StepTest.stepUp(); }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, nope, these tests seem wrong. They should only abort, and stay at the max when it can't go further as I read it. http://www.w3.org/html/wg/drafts/html/master/forms.html#dom-input-stepup |
||
_StepTest.max = ""; | ||
} , "InvalidStateError if step Up above the maximam value"); | ||
test(function(){ | ||
_StepTest.max = "13:00"; | ||
_StepTest.value = "13:00"; | ||
assert_true(typeof(_StepTest.stepDown) ==="function"); | ||
assert_throws("InvalidStateError", function(){ _StepTest.stepDown(); }); | ||
_StepTest.min=""; | ||
} , "InvalidStateError if step down below the minimum value"); | ||
test(function(){ | ||
_StepTest.value = ""; | ||
assert_equals(_StepTest.value, ""); | ||
_StepTest.step = "300"; | ||
assert_throws("InvalidStateError", function(){ _StepTest.stepUp(); }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would treat the value as 0 here.
http://www.w3.org/html/wg/drafts/html/master/forms.html#dom-input-stepup So it could possibly be value == "00:10" in the end here? Someone really familiar with this might want to take another look. That's how I read it on a saturday at least ;-) |
||
} , " empty value of step UP"); | ||
|
||
|
||
|
||
|
||
/* set value test */ | ||
test(function(){ | ||
var _time = document.getElementById("chkSetValueTest"); | ||
_time.value = "12:00:00.000"; | ||
assert_equals(_time.value, "12:00:00.000"); | ||
_time.value = "hh:mi:ss.sss"; | ||
assert_not_equals(_time.value, "hh:mi:ss.sss"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Better to check that value equals "", because that's what it should be set to in this case. |
||
}, "set value on not time format value"); | ||
|
||
|
||
</script> | ||
</body> | ||
</html> |
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.
Should maybe hide these? Putting them in a
<div style=display:none>
wrapper?