Files
tubestation/dom/base/test/test_reportPatternFailure.html

41 lines
1.1 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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>