test_reportPatternFailure.html (1079B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>Test console error for invalid pattern attributes</title> 6 <link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1862199"/> 7 <script src="/tests/SimpleTest/SimpleTest.js"></script> 8 <link rel="stylesheet" href="/tests/SimpleTest/test.css"/> 9 </head> 10 <body> 11 <p id="display"></p> 12 <div id="content" style="display: none"> 13 <input pattern="[a]" id="inp"> 14 </div> 15 <pre id="test"> 16 <script> 17 SimpleTest.waitForExplicitFinish(); 18 19 function runTest() { 20 // should find exactly one error 21 SimpleTest.monitorConsole(SimpleTest.finish, [ 22 { errorMessage: new RegExp( 23 "Unable to check <input pattern=ā\\[a-\\]ā> because ā/\\[a-\\]/vā is not a valid regexp" 24 ) } 25 ], /*forbidUnexpectedMsgs*/ true); 26 27 let inp = document.getElementById("inp"); 28 // should cause no error 29 inp.value = "a"; 30 // should cause one error 31 inp.pattern = "[a-]"; 32 33 SimpleTest.endMonitorConsole(); 34 } 35 36 runTest(); 37 </script> 38 </pre> 39 </body> 40 </html>