40 lines
1.1 KiB
HTML
40 lines
1.1 KiB
HTML
<!DOCTYPE HTML>
|
||
<html>
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<title>Test console error for invalid pattern attributes</title>
|
||
<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1862199"/>
|
||
<script src="/tests/SimpleTest/SimpleTest.js"></script>
|
||
<link rel="stylesheet" href="/tests/SimpleTest/test.css"/>
|
||
</head>
|
||
<body>
|
||
<p id="display"></p>
|
||
<div id="content" style="display: none">
|
||
<input pattern="[a]" id="inp">
|
||
</div>
|
||
<pre id="test">
|
||
<script>
|
||
SimpleTest.waitForExplicitFinish();
|
||
|
||
function runTest() {
|
||
// should find exactly one error
|
||
SimpleTest.monitorConsole(SimpleTest.finish, [
|
||
{ errorMessage: new RegExp(
|
||
"Unable to check <input pattern=‘\\[a-\\]’> because ‘/\\[a-\\]/v’ is not a valid regexp"
|
||
) }
|
||
], /*forbidUnexpectedMsgs*/ true);
|
||
|
||
let inp = document.getElementById("inp");
|
||
// should cause no error
|
||
inp.value = "a";
|
||
// should cause one error
|
||
inp.pattern = "[a-]";
|
||
|
||
SimpleTest.endMonitorConsole();
|
||
}
|
||
|
||
runTest();
|
||
</script>
|
||
</pre>
|
||
</body>
|
||
</html>
|