gecko/layout/style/test/test_inherit_storage.html
L. David Baron 5a6fcd294a Bug 774169, patch 2: Add property_database.js entries for property aliases. r=bzbarsky
This adds entries for property aliases as though they are shorthands.
This fits with the CSS working group's recent resolution to describe
aliases as shorthands, recorded in
http://lists.w3.org/Archives/Public/www-style/2012Aug/0770.html .

The property_database.js entries themselves are copied from the
non-alias entries for the properties, with these changes:
 (1) The property name is changed to the prefixed form
 (2) The domProp entry is changed to the prefixed form
 (3) Adding alias_for entries for each property.
 (4) When type is CSS_TYPE_LONGHAND in the target of the alias, type for
     the alias is CSS_TYPE_SHORTHAND_AND_LONGHAND and a subproperties
     entry is added with the target of the alias.

There are also some indentation fixes to the copied entries in
property_database.js (made before they were copied, and thus affecting
the original as well).
2012-09-18 11:37:14 -07:00

91 lines
3.0 KiB
HTML

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=375363
-->
<head>
<title>Test for parsing, storage, and serialization of CSS 'inherit'</title>
<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>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=375363">Mozilla Bug 375363</a>
<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 for parsing, storage, and serialization of CSS 'inherit' **/
var gDeclaration = document.getElementById("testnode").style;
function test_property(property)
{
var info = gCSSProperties[property];
function check_initial(sproperty) {
var sinfo = gCSSProperties[sproperty];
var val = gDeclaration.getPropertyValue(sproperty);
is(val, "", "value of '" + sproperty + "' before we do anything");
is(val, gDeclaration[sinfo.domProp],
"consistency between decl.getPropertyValue('" + sproperty + "') and decl." + sinfo.domProp);
}
check_initial(property);
if ("subproperties" in info)
for (var idx in info.subproperties)
check_initial(info.subproperties[idx]);
gDeclaration.setProperty(property, "inherit", "");
function check_set(sproperty) {
var sinfo = gCSSProperties[sproperty];
val = gDeclaration.getPropertyValue(sproperty);
is(val, "inherit",
"inherit reported back for property '" + sproperty + "'");
is(val, gDeclaration[sinfo.domProp],
"consistency between decl.getPropertyValue('" + sproperty +
"') and decl." + sinfo.domProp);
}
check_set(property);
if ("subproperties" in info)
for (var idx in info.subproperties)
check_set(info.subproperties[idx]);
// We don't care particularly about the whitespace or the placement of
// semicolons, but for simplicity we'll test the current behavior.
if ("alias_for" in info) {
is(gDeclaration.cssText, info.alias_for + ": inherit;",
"declaration should serialize to exactly what went in (for inherit)");
} else {
is(gDeclaration.cssText, property + ": inherit;",
"declaration should serialize to exactly what went in (for inherit)");
}
gDeclaration.removeProperty(property);
function check_final(sproperty) {
var sinfo = gCSSProperties[sproperty];
var val = gDeclaration.getPropertyValue(sproperty);
is(val, "", "value of '" + sproperty + "' after removal of value");
is(val, gDeclaration[sinfo.domProp],
"consistency between decl.getPropertyValue('" + sproperty + "') and decl." + sinfo.domProp);
}
check_final(property);
if ("subproperties" in info)
for (var idx in info.subproperties)
check_final(info.subproperties[idx]);
}
for (var prop in gCSSProperties)
test_property(prop);
</script>
</pre>
</body>
</html>