2007-03-25 22:54:44 -07:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=375363
|
|
|
|
-->
|
|
|
|
<head>
|
|
|
|
<title>Test for parsing, storage, and serialization of CSS 'inherit'</title>
|
2009-05-06 13:46:04 -07:00
|
|
|
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
2007-03-25 22:54:44 -07:00
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
2007-04-15 15:28:07 -07:00
|
|
|
<script type="text/javascript" src="property_database.js"></script>
|
2007-03-25 22:54:44 -07:00
|
|
|
<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)
|
|
|
|
{
|
2007-04-15 15:28:07 -07:00
|
|
|
var info = gCSSProperties[property];
|
2007-03-25 22:54:44 -07:00
|
|
|
|
2007-04-15 15:28:07 -07:00
|
|
|
function check_initial(sproperty) {
|
|
|
|
var sinfo = gCSSProperties[sproperty];
|
|
|
|
var val = gDeclaration.getPropertyValue(sproperty);
|
|
|
|
is(val, "", "value of '" + sproperty + "' before we do anything");
|
2010-02-06 14:36:05 -08:00
|
|
|
is(val, gDeclaration[sinfo.domProp],
|
|
|
|
"consistency between decl.getPropertyValue('" + sproperty + "') and decl." + sinfo.domProp);
|
2007-04-15 15:28:07 -07:00
|
|
|
}
|
|
|
|
check_initial(property);
|
|
|
|
if ("subproperties" in info)
|
|
|
|
for (var idx in info.subproperties)
|
|
|
|
check_initial(info.subproperties[idx]);
|
2007-03-25 22:54:44 -07:00
|
|
|
|
2007-04-15 15:28:07 -07:00
|
|
|
gDeclaration.setProperty(property, "inherit", "");
|
2007-03-25 22:54:44 -07:00
|
|
|
|
2007-04-15 15:28:07 -07:00
|
|
|
function check_set(sproperty) {
|
|
|
|
var sinfo = gCSSProperties[sproperty];
|
|
|
|
val = gDeclaration.getPropertyValue(sproperty);
|
2008-10-07 15:10:20 -07:00
|
|
|
is(val, "inherit",
|
|
|
|
"inherit reported back for property '" + sproperty + "'");
|
2010-02-06 14:36:05 -08:00
|
|
|
is(val, gDeclaration[sinfo.domProp],
|
|
|
|
"consistency between decl.getPropertyValue('" + sproperty +
|
|
|
|
"') and decl." + sinfo.domProp);
|
2007-04-15 15:28:07 -07:00
|
|
|
}
|
|
|
|
check_set(property);
|
|
|
|
if ("subproperties" in info)
|
|
|
|
for (var idx in info.subproperties)
|
|
|
|
check_set(info.subproperties[idx]);
|
2007-03-25 22:54:44 -07:00
|
|
|
|
2007-04-16 20:50:30 -07:00
|
|
|
// We don't care particularly about the whitespace or the placement of
|
|
|
|
// semicolons, but for simplicity we'll test the current behavior.
|
2008-12-23 06:06:57 -08:00
|
|
|
is(gDeclaration.cssText, property + ": inherit;",
|
2007-04-16 20:50:30 -07:00
|
|
|
"declaration should serialize to exactly what went in (for inherit)");
|
|
|
|
|
2007-04-15 15:28:07 -07:00
|
|
|
gDeclaration.removeProperty(property);
|
2007-03-25 22:54:44 -07:00
|
|
|
|
2007-04-15 15:28:07 -07:00
|
|
|
function check_final(sproperty) {
|
|
|
|
var sinfo = gCSSProperties[sproperty];
|
|
|
|
var val = gDeclaration.getPropertyValue(sproperty);
|
|
|
|
is(val, "", "value of '" + sproperty + "' after removal of value");
|
2010-02-06 14:36:05 -08:00
|
|
|
is(val, gDeclaration[sinfo.domProp],
|
|
|
|
"consistency between decl.getPropertyValue('" + sproperty + "') and decl." + sinfo.domProp);
|
2007-03-25 22:54:44 -07:00
|
|
|
}
|
2007-04-15 15:28:07 -07:00
|
|
|
check_final(property);
|
|
|
|
if ("subproperties" in info)
|
|
|
|
for (var idx in info.subproperties)
|
|
|
|
check_final(info.subproperties[idx]);
|
2007-03-25 22:54:44 -07:00
|
|
|
}
|
|
|
|
|
2007-04-15 15:28:07 -07:00
|
|
|
for (var prop in gCSSProperties)
|
|
|
|
test_property(prop);
|
2007-03-25 22:54:44 -07:00
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|