form-validation-validity-valid-weekmonth.html (2160B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>The constraint validation API Test: element.validity.valid</title> 4 <link rel="author" title="Intel" href="http://www.intel.com/"> 5 <link rel="help" href="https://html.spec.whatwg.org/multipage/#dom-validitystate-valid"> 6 <link rel="help" href="https://html.spec.whatwg.org/multipage/#the-constraint-validation-api"> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <script src="support/validator.js"></script> 10 <div id="log"></div> 11 <script> 12 var testElements = [ 13 { 14 tag: "input", 15 types: ["month"], 16 testData: [ 17 {conditions: {max: "2000-01", value: "2001-01"}, expected: false, name: "[target] validity.valid must be false if validity.rangeOverflow is true"}, 18 {conditions: {min: "2001-01", value: "2000-01"}, expected: false, name: "[target] validity.valid must be false if validity.rangeUnderflow is true"}, 19 // Step checks that "months since Jan 1970" is evenly divisible by `step` 20 {conditions: {step: 3, value: "2001-02"}, expected: false, name: "[target] validity.valid must be false if validity.stepMismatch is true"}, 21 {conditions: {required: true, value: ""}, expected: false, expectedImmutable: true, name: "[target] validity.valid must be false if validity.valueMissing is true"} 22 ] 23 }, 24 { 25 tag: "input", 26 types: ["week"], 27 testData: [ 28 {conditions: {max: "2000-W01", value: "2001-W01"}, expected: false, name: "[target] validity.valid must be false if validity.rangeOverflow is true"}, 29 {conditions: {min: "2001-W01", value: "2000-W01"}, expected: false, name: "[target] validity.valid must be false if validity.rangeUnderflow is true"}, 30 {conditions: {step: 2 * 1 * 604800000, value: "2001-W03"}, expected: false, name: "[target] validity.valid must be false if validity.stepMismatch is true"}, 31 {conditions: {required: true, value: ""}, expected: false, expectedImmutable: true, name: "[target] validity.valid must be false if validity.valueMissing is true"} 32 ] 33 } 34 ]; 35 36 validator.run_test(testElements, "isValid"); 37 </script>