tooLong-input-tel-delete-manual.html (1408B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>input[type="tel"], ValidityState.tooLong and user editing</title> 6 <link rel="author" title="Chris Rebert" href="http://chrisrebert.com"> 7 <link rel="help" href="https://html.spec.whatwg.org/multipage/#limiting-user-input-length:-the-maxlength-attribute"> 8 <meta name="flags" content="interact"> 9 <meta name="assert" content="Per the 'Constraint validation' definition in the referenced section, an input whose value was edited by the user but still exceeds the input's maxlength should suffer from being too long."> 10 <script src="/resources/testharness.js"></script> 11 <script src="/resources/testharnessreport.js"></script> 12 </head> 13 <body> 14 <p>Delete one character from the following text input:</p> 15 <input type="tel" value="123-456-7890" maxlength="7" autocomplete="off" id="testinput"> 16 17 <div id="log"></div> 18 <script> 19 var input = document.getElementById('testinput'); 20 setup({explicit_timeout: true, explicit_done: true}); 21 on_event(input, "input", function () { 22 test(function() { 23 assert_class_string(input.validity, 'ValidityState', 'HTMLInputElement.validity must be a ValidityState instance'); 24 assert_true(input.validity.tooLong, "tooLong must be true since the user just changed the input's value and the value exceeds the maxlength"); 25 }); 26 done(); 27 }); 28 </script> 29 </body> 30 </html>