form-validation-validity-badInput.html (2728B)
1 <!DOCTYPE html> 2 <meta charset="utf-8"> 3 <title>The constraint validation API Test: element.validity.badInput</title> 4 <link rel="author" title="Intel" href="http://www.intel.com/"> 5 <link rel="help" href="https://html.spec.whatwg.org/multipage/multipage/association-of-controls-and-forms.html#suffering-from-bad-input"> 6 <link rel="help" href="https://html.spec.whatwg.org/multipage/multipage/the-button-element.html#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: ["email"], 16 testData: [ 17 {conditions: {multiple: false, value: ""}, expected: false, name: "[target] The multiple attribute is false and the value attribute is empty"}, 18 {conditions: {multiple: false, value: "test1@example.com"}, expected: false, name: "[target] The multiple attribute is false and the value attribute is a valid e-mail address"}, 19 {conditions: {multiple: true, value: "test1@example.com,test2@eample.com"}, expected: false, name: "[target] The multiple attribute is true and the value contains valid e-mail addresses"}, 20 {conditions: {multiple: true, value: "test,1@example.com"}, expected: false, name: "[target] The multiple attribute is true and the value attribute contains a ','"} 21 //TODO, the value contains characters that cannot be converted to punycode. 22 //Can not find a character that cannot be converted to punycode. 23 ] 24 }, 25 { 26 tag: "input", 27 types: ["datetime-local"], 28 testData: [ 29 {conditions: {value: ""}, expected: false, name: "[target] The value attribute is empty"}, 30 {conditions: {value: "2000-01-01T12:00:00"}, expected: false, name: "[target] The value attribute is a valid date and time string"}, 31 {conditions: {value: "abc"}, expected: false, name: "[target] The value attribute cannot convert to a valid normalized forced-UTC global date and time string"} 32 ] 33 }, 34 { 35 tag: "input", 36 types: ["color"], 37 testData: [ 38 {conditions: {value: ""}, expected: false, name: "[target] The value attribute is empty"}, 39 {conditions: {value: "#000000"}, expected: false, name: "[target] The value attribute is a valid sample color"}, 40 {conditions: {value: "#FFFFFF"}, expected: false, name: "[target] The value attribute is not a valid lowercase sample color"}, 41 {conditions: {value: "abc"}, expected: false, name: "[target] The value attribute cannot convert to a valid sample color"} 42 ] 43 }, 44 ]; 45 validator.run_test (testElements, "badInput"); 46 </script>