2007-04-15 15:27:14 -07:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test that property_database.js contains all supported CSS properties</title>
|
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<script type="text/javascript" src="css_properties.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">
|
|
|
|
|
|
|
|
/** Test that property_database.js contains all supported CSS properties **/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Here we are testing the hand-written property_database.js against
|
|
|
|
* the autogenerated css_properties.js to make sure that everything in
|
|
|
|
* css_properties.js is in property_database.js.
|
|
|
|
*
|
|
|
|
* This prevents CSS properties from being added to the code without
|
|
|
|
* also being put under the minimal test coverage provided by the tests
|
|
|
|
* that use property_database.js.
|
|
|
|
*/
|
|
|
|
|
|
|
|
for (var idx in gLonghandProperties) {
|
|
|
|
var prop = gLonghandProperties[idx];
|
2011-03-17 20:14:31 -07:00
|
|
|
var present = prop.name in gCSSProperties;
|
|
|
|
ok(present,
|
2010-02-06 13:24:00 -08:00
|
|
|
"'" + prop.name + "' listed in gCSSProperties");
|
2011-03-17 20:14:31 -07:00
|
|
|
if (present) {
|
|
|
|
is(gCSSProperties[prop.name].type, CSS_TYPE_LONGHAND,
|
|
|
|
"'" + prop.name + "' listed as CSS_TYPE_LONGHAND");
|
|
|
|
is(gCSSProperties[prop.name].domProp, prop.prop,
|
|
|
|
"'" + prop.name + "' listed with correct DOM property name");
|
|
|
|
}
|
2007-04-15 15:27:14 -07:00
|
|
|
}
|
|
|
|
for (var idx in gShorthandProperties) {
|
|
|
|
var prop = gShorthandProperties[idx];
|
2011-03-17 20:14:31 -07:00
|
|
|
var present = prop.name in gCSSProperties;
|
|
|
|
ok(present,
|
|
|
|
"'" + prop.name + "' listed in gCSSProperties");
|
|
|
|
if (present) {
|
|
|
|
ok(gCSSProperties[prop.name].type == CSS_TYPE_TRUE_SHORTHAND ||
|
|
|
|
gCSSProperties[prop.name].type == CSS_TYPE_SHORTHAND_AND_LONGHAND,
|
|
|
|
"'" + prop.name + "' listed as CSS_TYPE_TRUE_SHORTHAND or CSS_TYPE_SHORTHAND_AND_LONGHAND");
|
|
|
|
ok(gCSSProperties[prop.name].domProp == prop.prop,
|
|
|
|
"'" + prop.name + "' listed with correct DOM property name");
|
|
|
|
}
|
2007-04-15 15:27:14 -07:00
|
|
|
}
|
|
|
|
for (var idx in gShorthandPropertiesLikeLonghand) {
|
|
|
|
var prop = gShorthandPropertiesLikeLonghand[idx];
|
2011-03-17 20:14:31 -07:00
|
|
|
var present = prop.name in gCSSProperties;
|
|
|
|
ok(present,
|
|
|
|
"'" + prop.name + "' listed in gCSSProperties");
|
|
|
|
if (present) {
|
|
|
|
ok(gCSSProperties[prop.name].type == CSS_TYPE_SHORTHAND_AND_LONGHAND,
|
|
|
|
"'" + prop.name + "' listed as CSS_TYPE_SHORTHAND_AND_LONGHAND");
|
|
|
|
ok(gCSSProperties[prop.name].domProp == prop.prop,
|
|
|
|
"'" + prop.name + "' listed with correct DOM property name");
|
|
|
|
}
|
2007-04-15 15:27:14 -07:00
|
|
|
}
|
|
|
|
|
2007-04-15 15:28:07 -07:00
|
|
|
/*
|
|
|
|
* Test that all shorthand properties have a subproperty list and all
|
|
|
|
* longhand properties do not.
|
|
|
|
*/
|
|
|
|
for (var prop in gCSSProperties) {
|
|
|
|
var info = gCSSProperties[prop];
|
|
|
|
if (info.type == CSS_TYPE_LONGHAND) {
|
|
|
|
ok(!("subproperties" in info),
|
|
|
|
"longhand property '" + prop + "' must not have subproperty list");
|
|
|
|
} else if (info.type == CSS_TYPE_TRUE_SHORTHAND) {
|
|
|
|
ok("subproperties" in info,
|
|
|
|
"shorthand property '" + prop + "' must have subproperty list");
|
|
|
|
}
|
|
|
|
/* optional for CSS_TYPE_SHORTHAND_AND_LONGHAND */
|
|
|
|
|
|
|
|
if ("subproperties" in info) {
|
|
|
|
var good = true;
|
|
|
|
if (info.subproperties.length < 1) {
|
|
|
|
info("subproperty list for '" + prop + "' is empty");
|
|
|
|
good = false;
|
|
|
|
}
|
|
|
|
for (var idx in info.subproperties) {
|
|
|
|
var subprop = info.subproperties[idx];
|
|
|
|
if (!(subprop in gCSSProperties)) {
|
|
|
|
info("subproperty list for '" + prop + "' lists nonexistent subproperty '" + subprop + "'");
|
|
|
|
good = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ok(good, "property '" + prop + "' has a good subproperty list");
|
|
|
|
}
|
2007-04-16 18:07:22 -07:00
|
|
|
|
|
|
|
ok("initial_values" in info && info.initial_values.length >= 1,
|
|
|
|
"must have initial values for property '" + prop + "'");
|
|
|
|
ok("other_values" in info && info.other_values.length >= 1,
|
|
|
|
"must have non-initial values for property '" + prop + "'");
|
2007-04-15 15:28:07 -07:00
|
|
|
}
|
|
|
|
|
2007-04-15 15:27:14 -07:00
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|