tooShort-textarea-add-manual.html (1434B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>textarea, ValidityState.tooShort 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/#setting-minimum-input-length-requirements:-the-minlength-attribute"> 8 <meta name="flags" content="interact"> 9 <meta name="assert" content="Per the 'Constraint validation' definition in the referenced section, a textarea whose value was edited by the user but still falls below the textarea's minlength should suffer from being too short."> 10 <script src="/resources/testharness.js"></script> 11 <script src="/resources/testharnessreport.js"></script> 12 </head> 13 <body> 14 <p>Type one additional character into the following text area:</p> 15 <textarea minlength="15" autocomplete="off" id="testinput">123456789</textarea> 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', 'HTMLTextAreaElement.validity must be a ValidityState instance'); 24 assert_true(input.validity.tooShort, "tooShort must be true since the user just changed the input's value and the value falls below the minlength"); 25 }); 26 done(); 27 }); 28 </script> 29 </body> 30 </html>