зеркало из https://github.com/mozilla/pjs.git
143 строки
4.0 KiB
HTML
143 строки
4.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="/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>
|
|
<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;
|
|
|
|
var gKnownFails = {
|
|
/* bug 377519: */
|
|
"-moz-border-end": true,
|
|
"-moz-border-radius": true,
|
|
"-moz-border-start": true,
|
|
"-moz-column-rule": true,
|
|
"-moz-outline-radius": true,
|
|
"background": true,
|
|
"border": true,
|
|
"border-bottom": true,
|
|
"border-color": true,
|
|
"border-left": true,
|
|
"border-right": true,
|
|
"border-style": true,
|
|
"border-top": true,
|
|
"border-width": true,
|
|
"cue": true,
|
|
"font": true,
|
|
"list-style": true,
|
|
"margin": true,
|
|
"outline": true,
|
|
"padding": true,
|
|
"pause": true
|
|
};
|
|
|
|
var gKnownFails2 = {
|
|
"-moz-border-end": true,
|
|
"-moz-border-radius": true,
|
|
"-moz-border-start": true,
|
|
"-moz-column-rule": true,
|
|
"-moz-outline-radius": true,
|
|
"background": true,
|
|
"border": true,
|
|
"border-bottom": true,
|
|
"border-left": true,
|
|
"border-right": true,
|
|
"border-top": true,
|
|
"cue": true,
|
|
"font": true,
|
|
"list-style": true,
|
|
"outline": true,
|
|
"pause": true
|
|
};
|
|
|
|
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");
|
|
if (sinfo.domProp) {
|
|
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);
|
|
var func = is;
|
|
if (sproperty == property && property in gKnownFails)
|
|
func = todo_is;
|
|
func(val, "inherit",
|
|
"inherit reported back for property '" + sproperty + "'");
|
|
if (sinfo.domProp) {
|
|
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.
|
|
var cssTextFunc = is;
|
|
if (property in gKnownFails2)
|
|
cssTextFunc = todo_is;
|
|
cssTextFunc(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");
|
|
if (sinfo.domProp) {
|
|
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>
|