mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-03 22:38:41 +09:00
Bug 1310079 - Implement the min and max attribute for <input type=datetime-local>
This commit is contained in:
parent
344ea39e20
commit
c140ca5b67
9 changed files with 88 additions and 112 deletions
|
|
@ -31,8 +31,7 @@ var data = [
|
|||
{ type: 'month', apply: true },
|
||||
{ type: 'week', apply: true },
|
||||
{ type: 'time', apply: true },
|
||||
// TODO: temporary set to false until bug 888331 is fixed.
|
||||
{ type: 'datetime-local', apply: false },
|
||||
{ type: 'datetime-local', apply: true },
|
||||
{ type: 'number', apply: true },
|
||||
{ type: 'range', apply: true },
|
||||
{ type: 'color', apply: false },
|
||||
|
|
@ -71,7 +70,8 @@ function checkValidity(aElement, aValidity, aApply, aRangeApply)
|
|||
"element overflow status should be " + !aValidity);
|
||||
var overflowMsg =
|
||||
(aElement.type == "date" || aElement.type == "time" ||
|
||||
aElement.type == "month" || aElement.type == "week") ?
|
||||
aElement.type == "month" || aElement.type == "week" ||
|
||||
aElement.type == "datetime-local") ?
|
||||
("Please select a value that is no later than " + aElement.max + ".") :
|
||||
("Please select a value that is no more than " + aElement.max + ".");
|
||||
is(aElement.validationMessage,
|
||||
|
|
@ -148,7 +148,7 @@ for (var test of data) {
|
|||
input.max = '2016-W39';
|
||||
break;
|
||||
case 'datetime-local':
|
||||
// TODO: this is temporary until bug 888331 is fixed.
|
||||
input.max = '2016-12-31T23:59:59';
|
||||
break;
|
||||
default:
|
||||
ok(false, 'please, add a case for this new type (' + input.type + ')');
|
||||
|
|
@ -421,7 +421,44 @@ for (var test of data) {
|
|||
|
||||
break;
|
||||
case 'datetime-local':
|
||||
// TODO: this is temporary until bug 888331 is fixed.
|
||||
input.value = '2016-01-01T12:00';
|
||||
checkValidity(input, true, apply, apply);
|
||||
|
||||
input.value = '2016-12-31T23:59:59';
|
||||
checkValidity(input, true, apply, apply);
|
||||
|
||||
input.value = 'foo';
|
||||
checkValidity(input, true, apply, apply);
|
||||
|
||||
input.value = '2016-12-31T23:59:59.123';
|
||||
checkValidity(input, false, apply, apply);
|
||||
|
||||
input.value = '2017-01-01T10:00';
|
||||
checkValidity(input, false, apply, apply);
|
||||
|
||||
input.max = '2017-01-01T10:00';
|
||||
checkValidity(input, true, apply, apply);
|
||||
|
||||
input.value = '2017-01-01T10:00:30';
|
||||
checkValidity(input, false, apply, apply);
|
||||
|
||||
input.value = '1000-01-01T12:00';
|
||||
checkValidity(input, true, apply, apply);
|
||||
|
||||
input.value = '2100-01-01T12:00';
|
||||
checkValidity(input, false, apply, apply);
|
||||
|
||||
input.max = '0050-12-31T23:59:59.999';
|
||||
checkValidity(input, false, apply, apply);
|
||||
|
||||
input.value = '0050-12-31T23:59:59';
|
||||
checkValidity(input, true, apply, apply);
|
||||
|
||||
input.max = '';
|
||||
checkValidity(input, true, apply, false);
|
||||
|
||||
input.max = 'foo';
|
||||
checkValidity(input, true, apply, false);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue