gecko/layout/style/test/test_initial_storage.html

73 lines
2.2 KiB
HTML

<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=375363
-->
<head>
<title>Test for parsing, storage, and serialization of CSS '-moz-initial'</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="css_properties.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 '-moz-initial' **/
var gDeclaration = document.getElementById("testnode").style;
/* all failures covered by bug 375363 */
var gKnownFails = {
"background-position": true
};
function test_property(property)
{
var pass = true;
var match = true;
var val = gDeclaration.getPropertyValue(property.name);
pass = pass && val == "";
if (property.prop)
match = match && gDeclaration[property.prop] == val;
gDeclaration.setProperty(property.name, "-moz-initial", "");
val = gDeclaration.getPropertyValue(property.name);
pass = pass && val == "-moz-initial";
if (property.prop)
match = match && gDeclaration[property.prop] == val;
gDeclaration.removeProperty(property.name);
val = gDeclaration.getPropertyValue(property.name);
pass = pass && val == "";
if (property.prop)
match = match && gDeclaration[property.prop] == val;
(property.name in gKnownFails ? todo : ok)(pass && match, "-moz-initial parsed, stored, and serialized for CSS '" + property.name + "'");
if (!match) {
/* already included in above todo/ok, but exceptional in itself */
ok(match, "getPropertyValue matches nsICSSProperties for CSS '" + property.name + "'");
}
}
for (var idx in gLonghandProperties)
test_property(gLonghandProperties[idx]);
for (var idx in gShorthandPropertiesLikeLonghand)
test_property(gShorthandPropertiesLikeLonghand[idx]);
</script>
</pre>
</body>
</html>