gecko/layout/style/test/test_property_syntax_errors.html

64 lines
1.8 KiB
HTML
Raw Normal View History

<!DOCTYPE HTML>
<html>
<!--
-->
<head>
<title>Test that we reject syntax errors listed in property_database.js</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="property_database.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
<div id="testnode"></div>
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
var gDeclaration = document.getElementById("testnode").style;
var gKnownFails = {
"pitch-range": [ " -0.01", "100.2", "108", "-3" ],
"richness": [ " -0.01", "100.2", "108", "-3" ],
"stress": [ " -0.01", "100.2", "108", "-3" ],
"volume": [ " -0.01", "100.2", "108", "-3" ]
}
for (var property in gCSSProperties) {
var info = gCSSProperties[property];
for (var idx in info.invalid_values) {
var badval = info.invalid_values[idx];
gDeclaration.setProperty(property, badval, "");
var func = is;
if (property in gKnownFails &&
gKnownFails[property].indexOf(badval) != -1)
func = todo_is;
func(gDeclaration.getPropertyValue(property), "",
"invalid value '" + badval + "' not accepted for '" + property +
"' property");
if ("subproperties" in info) {
for (var sidx in info.subproperties) {
var subprop = info.subproperties[sidx];
func(gDeclaration.getPropertyValue(subprop), "",
"invalid value '" + badval + "' not accepted for '" + property +
"' property when testing subproperty '" + subprop + "'");
}
}
gDeclaration.removeProperty(property);
}
}
</script>
</pre>
</body>
</html>