-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split week and month input types from forms WPTs
This was requested here: web-platform-tests/interop#88 Change-Id: Id8792317129552efb39d872c0e12a597cf269ece Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3721798 Reviewed-by: Philip Jägenstedt <[email protected]> Commit-Queue: Joey Arhar <[email protected]> Cr-Commit-Position: refs/heads/main@{#1019385}
- Loading branch information
1 parent
d8fdf37
commit b489bce
Showing
23 changed files
with
604 additions
and
174 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 |
---|---|---|
@@ -0,0 +1,42 @@ | ||
var formElements = { | ||
input: { | ||
// Conforming | ||
accept: "string", | ||
alt: "string", | ||
autocomplete: {type: "string", customGetter: true}, | ||
defaultChecked: {type: "boolean", domAttrName: "checked"}, | ||
dirName: "string", | ||
disabled: "boolean", | ||
// "formAction" has magic hard-coded in reflection.js | ||
formAction: "url", | ||
formEnctype: {type: "enum", keywords: ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"], invalidVal: "application/x-www-form-urlencoded"}, | ||
formMethod: {type: "enum", keywords: ["get", "post"], invalidVal: "get"}, | ||
formNoValidate: "boolean", | ||
formTarget: "string", | ||
height: {type: "unsigned long", customGetter: true}, | ||
max: "string", | ||
maxLength: "limited long", | ||
min: "string", | ||
minLength: "limited long", | ||
multiple: "boolean", | ||
name: "string", | ||
pattern: "string", | ||
placeholder: "string", | ||
readOnly: "boolean", | ||
required: "boolean", | ||
// https://html.spec.whatwg.org/#attr-input-size | ||
size: {type: "limited unsigned long", defaultVal: 20}, | ||
src: "url", | ||
step: "string", | ||
type: {type: "enum", keywords: ["month", "week"], | ||
defaultVal: "text"}, | ||
width: {type: "unsigned long", customGetter: true}, | ||
defaultValue: {type: "string", domAttrName: "value"}, | ||
|
||
// Obsolete | ||
align: "string", | ||
useMap: "string", | ||
}, | ||
}; | ||
|
||
mergeElements(formElements); |
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
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,17 @@ | ||
<!doctype html> | ||
<title>HTML5 reflection tests: week and month input types</title> | ||
<meta name=timeout content=long> | ||
<p>Implementers looking to fix bugs might want to use the <a | ||
href=reflection-original.html>original version</a> of this suite's test | ||
framework, which conveniently aggregates similar errors and only reports | ||
failures. This file is (part of) the authoritative conformance test suite, and | ||
is suitable for incorporation into automated test suites. | ||
|
||
<div id=log></div> | ||
|
||
<script src="/resources/testharness.js"></script> | ||
<script src=/resources/testharnessreport.js></script> | ||
<script src=original-harness.js></script> | ||
<script src=new-harness.js></script> | ||
<script src=elements-forms-weekmonth.js></script> | ||
<script src=reflection.js></script> |
47 changes: 47 additions & 0 deletions
47
html/semantics/forms/constraints/form-validation-validity-rangeOverflow-weekmonth.html
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,47 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>The constraint validation API Test: element.validity.rangeOverflow</title> | ||
<link rel="author" title="Intel" href="http://www.intel.com/"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-validitystate-rangeoverflow"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-constraint-validation-api"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="support/validator.js"></script> | ||
<div id="log"></div> | ||
<script> | ||
var testElements = [ | ||
{ | ||
tag: "input", | ||
types: ["month"], | ||
testData: [ | ||
{conditions: {max: "", value: "2000-01"}, expected: false, name: "[target] The max attribute is not set"}, | ||
{conditions: {max: "2000-01", value: ""}, expected: false, name: "[target] Value is empty string"}, | ||
{conditions: {max: "2000/01", value: "2001-02"}, expected: false, name: "[target] The max attribute is an invalid month string"}, | ||
{conditions: {max: "2000-01", value: "2000-1"}, expected: false, name: "[target] The value attribute is an invalid month string"}, | ||
{conditions: {max: "987-01", value: "988-01"}, expected: false, name: "[target] The value is an invalid month string(year is three digits)"}, | ||
{conditions: {max: "2000-01", value: "2000-13"}, expected: false, name: "[target] The value is an invalid month string(month is greater than 12)"}, | ||
{conditions: {max: "2000-12", value: "2000-01"}, expected: false, name: "[target] The max attribute is greater than value attribute"}, | ||
{conditions: {max: "2000-01", value: "2000-12"}, expected: true, name: "[target] The value attribute is greater than max attribute"}, | ||
{conditions: {max: "9999-01", value: "10000-01"}, expected: true, name: "[target] The value attribute is greater than max attribute(Year is 10000 should be valid)"} | ||
] | ||
}, | ||
{ | ||
tag: "input", | ||
types: ["week"], | ||
testData: [ | ||
{conditions: {max: "", value: "2000-W01"}, expected: false, name: "[target] The max attribute is not set"}, | ||
{conditions: {max: "2000-W01", value: ""}, expected: false, name: "[target] Value is empty string"}, | ||
{conditions: {max: "2000/W01", value: "2001-W02"}, expected: false, name: "[target] The max attribute is an invalid week string"}, | ||
{conditions: {max: "2000-W01", value: "2000-W2"}, expected: false, name: "[target] The value attribute is an invalid week string"}, | ||
{conditions: {max: "2000-W01", value: "2000-w02"}, expected: false, name: "[target] The value attribute is an invalid week string(w is in lowercase)"}, | ||
{conditions: {max: "987-W01", value: "988-W01"}, expected: false, name: "[target] The value is an invalid week string(year is three digits)"}, | ||
{conditions: {max: "2000-W01", value: "2000-W57"}, expected: false, name: "[target] The value is an invalid week string(week is too greater)"}, | ||
{conditions: {max: "2000-W12", value: "2000-W01"}, expected: false, name: "[target] The max attribute is greater than value attribute"}, | ||
{conditions: {max: "2000-W01", value: "2000-W12"}, expected: true, name: "[target] The value attribute is greater than max attribute"}, | ||
{conditions: {max: "9999-W01", value: "10000-W01"}, expected: true, name: "[target] The value attribute is greater than max attribute(Year is 10000 should be valid)"} | ||
] | ||
} | ||
]; | ||
|
||
validator.run_test(testElements, "rangeOverflow"); | ||
</script> |
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
47 changes: 47 additions & 0 deletions
47
html/semantics/forms/constraints/form-validation-validity-rangeUnderflow-weekmonth.html
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,47 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>The constraint validation API Test: element.validity.rangeUnderflow</title> | ||
<link rel="author" title="Intel" href="http://www.intel.com/"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-validitystate-rangeunderflow"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-constraint-validation-api"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="support/validator.js"></script> | ||
<div id="log"></div> | ||
<script> | ||
var testElements = [ | ||
{ | ||
tag: "input", | ||
types: ["month"], | ||
testData: [ | ||
{conditions: {min: "", value: "2000-01"}, expected: false, name: "[target] The min attribute is not set"}, | ||
{conditions: {min: "2000-01", value: ""}, expected: false, name: "[target] Value is empty string"}, | ||
{conditions: {min: "2001/01", value: "2000-02"}, expected: false, name: "[target] The min attribute is an invalid month string"}, | ||
{conditions: {min: "2000-02", value: "2000-1"}, expected: false, name: "[target] The value attribute is an invalid month string"}, | ||
{conditions: {min: "988-01", value: "987-01"}, expected: false, name: "[target] The value is an invalid month string(year is three digits)"}, | ||
{conditions: {min: "2001-01", value: "2000-13"}, expected: false, name: "[target] The value is an invalid month string(month is less than 12)"}, | ||
{conditions: {min: "2000-01", value: "2000-12"}, expected: false, name: "[target] The min attribute is less than value attribute"}, | ||
{conditions: {min: "2001-01", value: "2000-12"}, expected: true, name: "[target] The value attribute is less than min attribute"}, | ||
{conditions: {min: "10000-01", value: "2000-01"}, expected: true, name: "[target] The value attribute is less than min attribute(Year is 10000 should be valid)"} | ||
] | ||
}, | ||
{ | ||
tag: "input", | ||
types: ["week"], | ||
testData: [ | ||
{conditions: {min: "", value: "2000-W01"}, expected: false, name: "[target] The min attribute is not set"}, | ||
{conditions: {min: "2000-W01", value: ""}, expected: false, name: "[target] Value is empty string"}, | ||
{conditions: {min: "2001/W02", value: "2000-W01"}, expected: false, name: "[target] The min attribute is an invalid week string"}, | ||
{conditions: {min: "2001-W02", value: "2000-W1"}, expected: false, name: "[target] The value attribute is an invalid week string"}, | ||
{conditions: {min: "2001-W02", value: "2000-w01"}, expected: false, name: "[target] The value attribute is an invalid week string(w is in lowercase)"}, | ||
{conditions: {min: "988-W01", value: "987-W01"}, expected: false, name: "[target] The value is an invalid week string(year is three digits)"}, | ||
{conditions: {min: "2001-W01", value: "2000-W57"}, expected: false, name: "[target] The value is an invalid week string(week is too greater)"}, | ||
{conditions: {min: "2000-W01", value: "2000-W12"}, expected: false, name: "[target] The min attribute is less than value attribute"}, | ||
{conditions: {min: "2000-W12", value: "2000-W01"}, expected: true, name: "[target] The value attribute is less than min attribute"}, | ||
{conditions: {min: "10000-W01", value: "2000-W01"}, expected: true, name: "[target] The value attribute is less than min attribute(Year is 10000 should be valid)"} | ||
] | ||
} | ||
]; | ||
|
||
validator.run_test(testElements, "rangeUnderflow"); | ||
</script> |
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
37 changes: 37 additions & 0 deletions
37
html/semantics/forms/constraints/form-validation-validity-valid-weekmonth.html
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,37 @@ | ||
<!DOCTYPE html> | ||
<meta charset="utf-8"> | ||
<title>The constraint validation API Test: element.validity.valid</title> | ||
<link rel="author" title="Intel" href="http://www.intel.com/"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-validitystate-valid"> | ||
<link rel="help" href="https://html.spec.whatwg.org/multipage/#the-constraint-validation-api"> | ||
<script src="/resources/testharness.js"></script> | ||
<script src="/resources/testharnessreport.js"></script> | ||
<script src="support/validator.js"></script> | ||
<div id="log"></div> | ||
<script> | ||
var testElements = [ | ||
{ | ||
tag: "input", | ||
types: ["month"], | ||
testData: [ | ||
{conditions: {max: "2000-01", value: "2001-01"}, expected: false, name: "[target] validity.valid must be false if validity.rangeOverflow is true"}, | ||
{conditions: {min: "2001-01", value: "2000-01"}, expected: false, name: "[target] validity.valid must be false if validity.rangeUnderflow is true"}, | ||
// Step checks that "months since Jan 1970" is evenly divisible by `step` | ||
{conditions: {step: 3, value: "2001-02"}, expected: false, name: "[target] validity.valid must be false if validity.stepMismatch is true"}, | ||
{conditions: {required: true, value: ""}, expected: false, expectedImmutable: true, name: "[target] validity.valid must be false if validity.valueMissing is true"} | ||
] | ||
}, | ||
{ | ||
tag: "input", | ||
types: ["week"], | ||
testData: [ | ||
{conditions: {max: "2000-W01", value: "2001-W01"}, expected: false, name: "[target] validity.valid must be false if validity.rangeOverflow is true"}, | ||
{conditions: {min: "2001-W01", value: "2000-W01"}, expected: false, name: "[target] validity.valid must be false if validity.rangeUnderflow is true"}, | ||
{conditions: {step: 2 * 1 * 604800000, value: "2001-W03"}, expected: false, name: "[target] validity.valid must be false if validity.stepMismatch is true"}, | ||
{conditions: {required: true, value: ""}, expected: false, expectedImmutable: true, name: "[target] validity.valid must be false if validity.valueMissing is true"} | ||
] | ||
} | ||
]; | ||
|
||
validator.run_test(testElements, "isValid"); | ||
</script> |
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
Oops, something went wrong.