blob: e7138eb9fb3446d1279bf100100393d9bff9c373 [file] [log] [blame]
<html>
<body>
<div>Tests that CSS parser correctly recovers after {}, () and [] invalid blocks.</div>
<div id="result"></div>
<div id="tests"></div>
<script type="text/javascript">
if (window.testRunner)
testRunner.dumpAsText();
var BASE_EXPR = "1px,\"x\",var(y) /calc(1px + (((5px)))),-webkit-min(1px,2px)";
var INVALID_BLOCKS = ["#", "{}", "()", "[]", "{(){{}{{}}[]}}", "(})", "(])", "[}]", "[)]", "{)}", "{]}", "#({})"];
var tests = document.getElementById("tests");
for (var i = 0; i <= BASE_EXPR.length; i++) {
for (var j = 0; j < INVALID_BLOCKS.length; j++) {
var invalidExpr = BASE_EXPR.substr(0, i) + INVALID_BLOCKS[j] + BASE_EXPR.substr(i);
var test = document.createElement("DIV");
test.textContent = "failed: " + invalidExpr;
test.style.cssText = "color:" + invalidExpr + "; display: none;";
tests.appendChild(test);
}
}
var failed = 0;
for (var test = tests.firstChild; test; test = test.nextSibling) {
if (getComputedStyle(test).display != "none")
failed++;
}
document.getElementById("result").textContent = failed ? "Failed " + failed + " tests" : "All tests passed";
</script>
</body>