Bug 781572 - Implement min and max attributes behaviour for <input type='time'>. r=smaug

This commit is contained in:
Mounir Lamouri 2013-01-31 23:00:08 +00:00
parent 93099ed3d1
commit 063e2996ad
5 changed files with 415 additions and 235 deletions

View File

@ -1282,7 +1282,7 @@ nsHTMLInputElement::ConvertNumberToString(double aValue,
aResultString.AppendPrintf("%04.0f-%02.0f-%02.0f", year.toNumber(),
month.toNumber() + 1, day.toNumber());
return true;
return true;
}
case NS_FORM_INPUT_TIME:
{
@ -1311,7 +1311,7 @@ nsHTMLInputElement::ConvertNumberToString(double aValue,
} else {
aResultString.AppendPrintf("%02d:%02d", hours, minutes);
}
return true;
}
default:
@ -1445,8 +1445,8 @@ nsHTMLInputElement::SetValueAsNumber(double aValueAsNumber)
double
nsHTMLInputElement::GetMinimum() const
{
// Should only be used for <input type='number'/'date'> for the moment.
MOZ_ASSERT(mType == NS_FORM_INPUT_NUMBER || mType == NS_FORM_INPUT_DATE);
MOZ_ASSERT(DoesValueAsNumberApply(),
"GetMinAsDouble() should only be used for types that allow .valueAsNumber");
// Once we add support for types that have a default minimum/maximum, take
// account of the default minimum here.
@ -1465,8 +1465,8 @@ nsHTMLInputElement::GetMinimum() const
double
nsHTMLInputElement::GetMaximum() const
{
// Should only be used for <input type='number'/'date'> for the moment.
MOZ_ASSERT(mType == NS_FORM_INPUT_NUMBER || mType == NS_FORM_INPUT_DATE);
MOZ_ASSERT(DoesValueAsNumberApply(),
"GetMaxAsDouble() should only be used for types that allow .valueAsNumber");
// Once we add support for types that have a default minimum/maximum, take
// account of the default maximum here.
@ -4460,6 +4460,7 @@ nsHTMLInputElement::DoesMinMaxApply() const
{
case NS_FORM_INPUT_NUMBER:
case NS_FORM_INPUT_DATE:
case NS_FORM_INPUT_TIME:
// TODO:
// case NS_FORM_INPUT_RANGE:
// All date/time types.
@ -4479,8 +4480,6 @@ nsHTMLInputElement::DoesMinMaxApply() const
case NS_FORM_INPUT_TEL:
case NS_FORM_INPUT_EMAIL:
case NS_FORM_INPUT_URL:
// TODO: temp until bug 781572 is fixed.
case NS_FORM_INPUT_TIME:
return false;
default:
NS_NOTYETIMPLEMENTED("Unexpected input type in DoesRequiredApply()");
@ -4495,8 +4494,7 @@ nsHTMLInputElement::DoesMinMaxApply() const
double
nsHTMLInputElement::GetStep() const
{
MOZ_ASSERT(mType == NS_FORM_INPUT_NUMBER || mType == NS_FORM_INPUT_DATE,
"We can't be there if type!=number or date!");
MOZ_ASSERT(DoesStepApply(), "GetStep() can only be called if @step applies");
// NOTE: should be defaultStep, which is 1 for type=number and date.
double step = 1;
@ -4656,8 +4654,7 @@ nsHTMLInputElement::HasPatternMismatch() const
bool
nsHTMLInputElement::IsRangeOverflow() const
{
// Ignore type=time until bug 781572 is fixed.
if (!DoesMinMaxApply() || mType == NS_FORM_INPUT_TIME) {
if (!DoesMinMaxApply()) {
return false;
}
@ -4950,7 +4947,7 @@ nsHTMLInputElement::GetValidationMessage(nsAString& aValidationMessage,
MOZ_ASSERT(!MOZ_DOUBLE_IS_NaN(maximum));
maxStr.AppendFloat(maximum);
} else if (mType == NS_FORM_INPUT_DATE) {
} else if (mType == NS_FORM_INPUT_DATE || mType == NS_FORM_INPUT_TIME) {
GetAttr(kNameSpaceID_None, nsGkAtoms::max, maxStr);
} else {
NS_NOTREACHED("Unexpected input type");
@ -4973,7 +4970,7 @@ nsHTMLInputElement::GetValidationMessage(nsAString& aValidationMessage,
MOZ_ASSERT(!MOZ_DOUBLE_IS_NaN(minimum));
minStr.AppendFloat(minimum);
} else if (mType == NS_FORM_INPUT_DATE) {
} else if (mType == NS_FORM_INPUT_DATE || mType == NS_FORM_INPUT_TIME) {
GetAttr(kNameSpaceID_None, nsGkAtoms::min, minStr);
} else {
NS_NOTREACHED("Unexpected input type");
@ -5477,14 +5474,17 @@ nsHTMLInputElement::UpdateValidityUIBits(bool aIsFocused)
void
nsHTMLInputElement::UpdateHasRange()
{
/*
* There is a range if min/max applies for the type and if the element
* currently have a valid min or max.
*/
mHasRange = false;
if (mType != NS_FORM_INPUT_NUMBER && mType != NS_FORM_INPUT_DATE) {
if (!DoesMinMaxApply()) {
return;
}
// <input type=number> has a range if min or max is a valid double.
double minimum = GetMinimum();
if (!MOZ_DOUBLE_IS_NaN(minimum)) {
mHasRange = true;

View File

@ -486,7 +486,7 @@ protected:
/**
* Returns if the step attribute apply for the current type.
*/
bool DoesStepApply() const { return DoesMinMaxApply(); }
bool DoesStepApply() const { return DoesMinMaxApply() && mType != NS_FORM_INPUT_TIME; }
/**
* Returns if stepDown and stepUp methods apply for the current type.
@ -496,7 +496,7 @@ protected:
/**
* Returns if valueAsNumber attribute applies for the current type.
*/
bool DoesValueAsNumberApply() const { return DoesMinMaxApply() || mType == NS_FORM_INPUT_TIME; }
bool DoesValueAsNumberApply() const { return DoesMinMaxApply(); }
/**
* Returns if the maxlength attribute applies for the current type.

View File

@ -19,30 +19,30 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=635499
/** Test for Bug 635499 **/
var types = [
[ 'hidden', false ],
[ 'text', false ],
[ 'search', false ],
[ 'tel', false ],
[ 'url', false ],
[ 'email', false ],
[ 'password', false ],
[ 'datetime', true, true ],
[ 'date', true ],
[ 'month', true, true ],
[ 'week', true, true ],
[ 'time', true ],
[ 'datetime-local', true, true ],
[ 'number', true ],
[ 'range', true, true ],
[ 'color', false, true ],
[ 'checkbox', false ],
[ 'radio', false ],
[ 'file', false ],
[ 'submit', false ],
[ 'image', false ],
[ 'reset', false ],
[ 'button', false ],
var data = [
{ type: 'hidden', apply: false },
{ type: 'text', apply: false },
{ type: 'search', apply: false },
{ type: 'tel', apply: false },
{ type: 'url', apply: false },
{ type: 'email', apply: false },
{ type: 'password', apply: false },
{ type: 'datetime', apply: true, todo: true },
{ type: 'date', apply: true },
{ type: 'month', apply: true, todo: true },
{ type: 'week', apply: true, todo: true },
{ type: 'time', apply: true },
{ type: 'datetime-local', apply: true, todo: true },
{ type: 'number', apply: true },
{ type: 'range', apply: true, todo: true },
{ type: 'color', apply: false, todo: true },
{ type: 'checkbox', apply: false },
{ type: 'radio', apply: false },
{ type: 'file', apply: false },
{ type: 'submit', apply: false },
{ type: 'image', apply: false },
{ type: 'reset', apply: false },
{ type: 'button', apply: false },
];
var input = document.createElement("input");
@ -79,117 +79,205 @@ function checkValidity(aElement, aValidity, aApply, aRangeApply)
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({'set': [["dom.experimental_forms", true]]}, function() {
for (var data of types) {
input.type = data[0];
var apply = data[1];
for (var test of data) {
input.type = test.type;
var apply = test.apply;
if (data[2]) {
todo_is(input.type, data[0], data[0] + " isn't implemented yet");
continue;
}
if (input.type == 'time') {
if (test.todo) {
todo_is(input.type, test.type, test.type + " isn't implemented yet");
continue;
}
checkValidity(input, true, apply, false);
if (input.type == 'date') {
input.max = '2012-06-27';
} else {
input.max = '2';
switch (input.type) {
case 'hidden':
case 'text':
case 'search':
case 'password':
case 'url':
case 'tel':
case 'email':
case 'number':
case 'checkbox':
case 'radio':
case 'file':
case 'submit':
case 'reset':
case 'button':
case 'image':
input.max = '-1';
break;
case 'date':
input.max = '2012-06-27';
break;
case 'time':
input.max = '02:20';
break;
default:
ok(false, 'please, add a case for this new type (' + input.type + ')');
}
checkValidity(input, true, apply, apply);
if (input.type == 'url') {
input.value = 'http://mozilla.org';
checkValidity(input, true, apply, apply);
} else if (input.type == 'email') {
input.value = 'foo@bar.com';
checkValidity(input, true, apply, apply);
} else if (input.type == 'file') {
// Need privileges to set a filename with .value.
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
switch (input.type) {
case 'text':
case 'hidden':
case 'search':
case 'password':
case 'tel':
case 'radio':
case 'checkbox':
case 'reset':
case 'button':
case 'submit':
case 'image':
input.value = '0';
checkValidity(input, true, apply, apply);
break;
case 'url':
input.value = 'http://mozilla.org';
checkValidity(input, true, apply, apply);
break;
case 'email':
input.value = 'foo@bar.com';
checkValidity(input, true, apply, apply);
break;
case 'file':
// Need privileges to set a filename with .value.
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties);
var file = dirSvc.get("ProfD", Components.interfaces.nsIFile);
file.append('635499_file');
var outStream = Components.classes["@mozilla.org/network/file-output-stream;1"].
createInstance(Components.interfaces.nsIFileOutputStream);
outStream.init(file, 0x02 | 0x08 | 0x20, // write, create, truncate
0666, 0);
outStream.write("foo", 3);
outStream.close();
var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties);
var file = dirSvc.get("ProfD", Components.interfaces.nsIFile);
file.append('635499_file');
var outStream = Components.classes["@mozilla.org/network/file-output-stream;1"].
createInstance(Components.interfaces.nsIFileOutputStream);
outStream.init(file, 0x02 | 0x08 | 0x20, // write, create, truncate
0666, 0);
outStream.write("foo", 3);
outStream.close();
input.value = file.path;
checkValidity(input, true, apply, apply);
input.value = file.path;
checkValidity(input, true, apply, apply);
file.remove(false);
} else if (input.type == 'date') {
input.value = '2012-06-26';
checkValidity(input, true, apply, apply);
file.remove(false);
break;
case 'date':
input.max = '2012-06-27';
input.value = '2012-06-26';
checkValidity(input, true, apply, apply);
input.value = '2012-06-27';
checkValidity(input, true, apply, apply);
input.value = '2012-06-27';
checkValidity(input, true, apply, apply);
input.value = 'foo';
checkValidity(input, true, apply, apply);
input.value = 'foo';
checkValidity(input, true, apply, apply);
input.value = '2012-06-28';
checkValidity(input, false, apply, apply);
input.value = '2012-06-28';
checkValidity(input, false, apply, apply);
input.max = '2012-06-30';
checkValidity(input, true, apply, apply);
input.max = '2012-06-30';
checkValidity(input, true, apply, apply);
input.value = '2012-07-05';
checkValidity(input, false, apply, apply);
input.value = '2012-07-05';
checkValidity(input, false, apply, apply);
input.value = '1000-01-01';
checkValidity(input, true, apply, apply);
input.value = '1000-01-01';
checkValidity(input, true, apply, apply);
input.value = '20120-01-01';
checkValidity(input, false, apply, apply);
input.value = '20120-01-01';
checkValidity(input, false, apply, apply);
input.max = '0050-01-01';
checkValidity(input, false, apply, apply);
input.max = '0050-01-01';
checkValidity(input, false, apply, apply);
input.value = '0049-01-01';
checkValidity(input, true, apply, apply);
} else {
input.value = '1';
checkValidity(input, true, apply, apply);
input.value = '0049-01-01';
checkValidity(input, true, apply, apply);
input.value = '2';
checkValidity(input, true, apply, apply);
input.max = '';
checkValidity(input, true, apply, false);
input.value = 'foo';
checkValidity(input, true, apply, apply);
input.max = 'foo';
checkValidity(input, true, apply, false);
input.value = '3';
checkValidity(input, false, apply, apply);
break;
case 'number':
input.max = '2';
input.value = '1';
checkValidity(input, true, apply, apply);
input.max = '5';
checkValidity(input, true, apply, apply);
input.value = '2';
checkValidity(input, true, apply, apply);
input.value = '42';
checkValidity(input, false, apply, apply);
}
input.value = 'foo';
checkValidity(input, true, apply, apply);
input.max = '';
checkValidity(input, true, apply, false);
input.value = '3';
checkValidity(input, false, apply, apply);
input.max = 'foo';
checkValidity(input, true, apply, false);
input.max = '5';
checkValidity(input, true, apply, apply);
// Check that we correctly convert input.max to a double in validationMessage.
if (input.type == 'number') {
input.max = "4.333333333333333333333333333333333331";
input.value = "5";
is(input.validationMessage,
"Please select a value that is lower than 4.33333333333333.",
"validation message");
input.value = '42';
checkValidity(input, false, apply, apply);
input.max = '';
checkValidity(input, true, apply, false);
input.max = 'foo';
checkValidity(input, true, apply, false);
// Check that we correctly convert input.max to a double in validationMessage.
if (input.type == 'number') {
input.max = "4.333333333333333333333333333333333331";
input.value = "5";
is(input.validationMessage,
"Please select a value that is lower than 4.33333333333333.",
"validation message");
}
break;
case 'time':
input.max = '10:10';
input.value = '10:09';
checkValidity(input, true, apply, apply);
input.value = '10:10';
checkValidity(input, true, apply, apply);
input.value = '10:10:00';
checkValidity(input, true, apply, apply);
input.value = '10:10:00.000';
checkValidity(input, true, apply, apply);
input.value = 'foo';
checkValidity(input, true, apply, apply);
input.value = '10:11';
checkValidity(input, false, apply, apply);
input.value = '10:10:00.001';
checkValidity(input, false, apply, apply);
input.max = '01:00:00.01';
input.value = '01:00:00.001';
checkValidity(input, true, apply, apply);
input.value = '01:00:00';
checkValidity(input, true, apply, apply);
input.value = '01:00:00.1';
checkValidity(input, false, apply, apply);
input.max = '';
checkValidity(input, true, apply, false);
input.max = 'foo';
checkValidity(input, true, apply, false);
break;
}
// Cleaning up,

View File

@ -19,30 +19,30 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=635553
/** Test for Bug 635553 **/
var types = [
[ 'hidden', false ],
[ 'text', false ],
[ 'search', false ],
[ 'tel', false ],
[ 'url', false ],
[ 'email', false ],
[ 'password', false ],
[ 'datetime', true, true ],
[ 'date', true ],
[ 'month', true, true ],
[ 'week', true, true ],
[ 'time', true ],
[ 'datetime-local', true, true ],
[ 'number', true ],
[ 'range', true, true ],
[ 'color', false, true ],
[ 'checkbox', false ],
[ 'radio', false ],
[ 'file', false ],
[ 'submit', false ],
[ 'image', false ],
[ 'reset', false ],
[ 'button', false ],
var data = [
{ type: 'hidden', apply: false },
{ type: 'text', apply: false },
{ type: 'search', apply: false },
{ type: 'tel', apply: false },
{ type: 'url', apply: false },
{ type: 'email', apply: false },
{ type: 'password', apply: false },
{ type: 'datetime', apply: true, todo: true },
{ type: 'date', apply: true },
{ type: 'month', apply: true, todo: true },
{ type: 'week', apply: true, todo: true },
{ type: 'time', apply: true },
{ type: 'datetime-local', apply: true, todo: true },
{ type: 'number', apply: true },
{ type: 'range', apply: true, todo: true },
{ type: 'color', apply: false, todo: true },
{ type: 'checkbox', apply: false },
{ type: 'radio', apply: false },
{ type: 'file', apply: false },
{ type: 'submit', apply: false },
{ type: 'image', apply: false },
{ type: 'reset', apply: false },
{ type: 'button', apply: false },
];
var input = document.createElement("input");
@ -79,117 +79,211 @@ function checkValidity(aElement, aValidity, aApply, aRangeApply)
SimpleTest.waitForExplicitFinish();
SpecialPowers.pushPrefEnv({'set': [["dom.experimental_forms", true]]}, function() {
for (var data of types) {
input.type = data[0];
var apply = data[1];
for (var test of data) {
input.type = test.type;
var apply = test.apply;
if (data[2]) {
todo_is(input.type, data[0], data[0] + " isn't implemented yet");
continue;
}
if (input.type == 'time') {
if (test.todo) {
todo_is(input.type, test.type, test.type + " isn't implemented yet");
continue;
}
// The element should be valid. Range should not apply.
checkValidity(input, true, apply, false);
if (input.type == 'date') {
input.min = '2012-06-27';
} else {
input.min = '0';
switch (input.type) {
case 'hidden':
case 'text':
case 'search':
case 'password':
case 'url':
case 'tel':
case 'email':
case 'number':
case 'checkbox':
case 'radio':
case 'file':
case 'submit':
case 'reset':
case 'button':
case 'image':
input.min = '999';
break;
case 'date':
input.min = '2012-06-27';
break;
case 'time':
input.min = '20:20';
break;
default:
ok(false, 'please, add a case for this new type (' + input.type + ')');
}
// The element should still be valid and range should apply if it can.
checkValidity(input, true, apply, apply);
if (input.type == 'url') {
input.value = 'http://mozilla.org';
checkValidity(input, true, apply, apply);
} else if (input.type == 'email') {
input.value = 'foo@bar.com';
checkValidity(input, true, apply, apply);
} else if (input.type == 'file') {
// Need privileges to set a filename with .value.
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
switch (input.type) {
case 'text':
case 'hidden':
case 'search':
case 'password':
case 'tel':
case 'radio':
case 'checkbox':
case 'reset':
case 'button':
case 'submit':
case 'image':
input.value = '0';
checkValidity(input, true, apply, apply);
break;
case 'url':
input.value = 'http://mozilla.org';
checkValidity(input, true, apply, apply);
break;
case 'email':
input.value = 'foo@bar.com';
checkValidity(input, true, apply, apply);
break;
case 'file':
// Need privileges to set a filename with .value.
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties);
var file = dirSvc.get("ProfD", Components.interfaces.nsIFile);
file.append('635499_file');
var outStream = Components.classes["@mozilla.org/network/file-output-stream;1"].
createInstance(Components.interfaces.nsIFileOutputStream);
outStream.init(file, 0x02 | 0x08 | 0x20, // write, create, truncate
0666, 0);
outStream.write("foo", 3);
outStream.close();
var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties);
var file = dirSvc.get("ProfD", Components.interfaces.nsIFile);
file.append('635499_file');
var outStream = Components.classes["@mozilla.org/network/file-output-stream;1"].
createInstance(Components.interfaces.nsIFileOutputStream);
outStream.init(file, 0x02 | 0x08 | 0x20, // write, create, truncate
0666, 0);
outStream.write("foo", 3);
outStream.close();
input.value = file.path;
checkValidity(input, true, apply, apply);
input.value = file.path;
checkValidity(input, true, apply, apply);
file.remove(false);
} else if (input.type == 'date') {
input.value = '2012-06-28';
checkValidity(input, true, apply, apply);
file.remove(false);
break;
case 'date':
input.value = '2012-06-28';
checkValidity(input, true, apply, apply);
input.value = '2012-06-27';
checkValidity(input, true, apply, apply);
input.value = '2012-06-27';
checkValidity(input, true, apply, apply);
input.value = 'foo';
checkValidity(input, true, apply, apply);
input.value = 'foo';
checkValidity(input, true, apply, apply);
input.value = '2012-06-26';
checkValidity(input, false, apply, apply);
input.value = '2012-06-26';
checkValidity(input, false, apply, apply);
input.min = '2012-02-29';
checkValidity(input, true, apply, apply);
input.min = '2012-02-29';
checkValidity(input, true, apply, apply);
input.value = '2012-02-28';
checkValidity(input, false, apply, apply);
input.value = '2012-02-28';
checkValidity(input, false, apply, apply);
input.value = '1000-01-01';
checkValidity(input, false, apply, apply);
input.value = '1000-01-01';
checkValidity(input, false, apply, apply);
input.value = '20120-01-01';
checkValidity(input, true, apply, apply);
input.value = '20120-01-01';
checkValidity(input, true, apply, apply);
input.min = '0050-01-01';
checkValidity(input, true, apply, apply);
input.min = '0050-01-01';
checkValidity(input, true, apply, apply);
input.value = '0049-01-01';
checkValidity(input, false, apply, apply);
} else {
input.value = '1';
checkValidity(input, true, apply, apply);
input.value = '0049-01-01';
checkValidity(input, false, apply, apply);
input.value = '0';
checkValidity(input, true, apply, apply);
input.min = '';
checkValidity(input, true, apply, false);
input.value = 'foo';
checkValidity(input, true, apply, apply);
input.min = 'foo';
checkValidity(input, true, apply, false);
break;
case 'number':
input.min = '0';
input.value = '1';
checkValidity(input, true, apply, apply);
input.value = '-1';
checkValidity(input, false, apply, apply);
input.value = '0';
checkValidity(input, true, apply, apply);
input.min = '-1';
checkValidity(input, true, apply, apply);
input.value = 'foo';
checkValidity(input, true, apply, apply);
input.value = '-42';
checkValidity(input, false, apply, apply);
}
input.value = '-1';
checkValidity(input, false, apply, apply);
input.min = '';
checkValidity(input, true, apply, false);
input.min = '-1';
checkValidity(input, true, apply, apply);
input.min = 'foo';
checkValidity(input, true, apply, false);
input.value = '-42';
checkValidity(input, false, apply, apply);
// Check that we correctly convert input.min to a double in validationMessage.
if (input.type == 'number') {
input.min = "4.333333333333333333333333333333333331";
input.value = "2";
is(input.validationMessage,
"Please select a value that is higher than 4.33333333333333.",
"validation message");
input.min = '';
checkValidity(input, true, apply, false);
input.min = 'foo';
checkValidity(input, true, apply, false);
// Check that we correctly convert input.min to a double in
// validationMessage.
input.min = "4.333333333333333333333333333333333331";
input.value = "2";
is(input.validationMessage,
"Please select a value that is higher than 4.33333333333333.",
"validation message");
break;
case 'time':
input.min = '20:20';
input.value = '20:20:01';
checkValidity(input, true, apply, apply);
input.value = '20:20:00';
checkValidity(input, true, apply, apply);
input.value = 'foo';
checkValidity(input, true, apply, apply);
input.value = '10:00';
checkValidity(input, false, apply, apply);
input.min = '20:20:00.001';
input.value = '20:20';
checkValidity(input, false, apply, apply);
input.value = '00:00';
checkValidity(input, false, apply, apply);
input.value = '23:59';
checkValidity(input, true, apply, apply);
input.value = '20:20:01';
checkValidity(input, true, apply, apply);
input.value = '20:20:00.01';
checkValidity(input, true, apply, apply);
input.value = '20:20:00.1';
checkValidity(input, true, apply, apply);
input.min = '00:00:00';
input.value = '01:00';
checkValidity(input, true, apply, apply);
input.value = '00:00:00.000';
checkValidity(input, true, apply, apply);
input.min = '';
checkValidity(input, true, apply, false);
input.min = 'foo';
checkValidity(input, true, apply, false);
break;
default:
ok(false, 'write tests for ' + input.type);
}
// Cleaning up,

View File

@ -49,10 +49,10 @@ var types = [
// These types can be too long.
[ "text", "email", "password", "url", "search", "tel" ],
// These types can't be too long.
[ "radio", "checkbox", "submit", "button", "reset", "image", "hidden", ],
[ "radio", "checkbox", "submit", "button", "reset", "image", "hidden",
'number', 'date', 'time' ],
// These types can't be too long but are not implemented yet.
[ "number", "range", "color", "datetime", "date", "month", "week", "time",
"datetime-local" ],
[ "range", "color", "datetime", "month", "week", 'datetime-local' ]
];
var input = document.createElement("input");
@ -88,9 +88,7 @@ for (type of types[1]) {
// Not too long types but TODO.
for (type of types[2]) {
input.type = type
ok(input.validity.valid, "the element should be valid [type=" + type + "]");
ok(!input.validity.tooLong,
"the element shouldn't suffer from being too long [type=" + type + "]");
todo_is(input.type, type, type + " should not be implemented");
}
testFileControl(input);