2014-01-08 08:43:36 -08:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<!--
|
2014-01-08 08:43:37 -08:00
|
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=940229
|
2014-01-08 08:43:36 -08:00
|
|
|
-->
|
|
|
|
<head>
|
2014-01-08 08:43:37 -08:00
|
|
|
<title>Test handling extra inherit/initial/unset in CSS declarations (Bug 940229)</title>
|
2014-01-08 08:43:36 -08:00
|
|
|
<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>
|
2014-01-08 08:43:37 -08:00
|
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=940229">Mozilla Bug 940229</a>
|
2014-01-08 08:43:36 -08:00
|
|
|
<p id="display"></p>
|
|
|
|
<div id="content" style="display: none">
|
|
|
|
|
|
|
|
<div id="testnode"></div>
|
|
|
|
|
|
|
|
</div>
|
|
|
|
<pre id="test">
|
|
|
|
<script class="testbody" type="text/javascript">
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Inspired by mistake in quotes noticed while reviewing bug 189519.
|
|
|
|
*/
|
|
|
|
|
|
|
|
var gPropsNeedComma = {
|
|
|
|
"font": true,
|
|
|
|
"font-family": true,
|
|
|
|
"voice-family": true,
|
|
|
|
};
|
|
|
|
|
|
|
|
var gElement = document.getElementById("testnode");
|
|
|
|
var gDeclaration = gElement.style;
|
|
|
|
|
|
|
|
function test_property(property)
|
|
|
|
{
|
|
|
|
var info = gCSSProperties[property];
|
|
|
|
|
|
|
|
var delim = (property in gPropsNeedComma) ? ", " : " ";
|
|
|
|
|
|
|
|
function test_value_pair(relation, val1, val2, extraval) {
|
|
|
|
var decl = property + ": " + val1 + delim + val2;
|
|
|
|
gElement.setAttribute("style", decl);
|
|
|
|
if ("subproperties" in info) {
|
|
|
|
for (idx in info.subproperties) {
|
|
|
|
var subprop = info.subproperties[idx];
|
|
|
|
is(gDeclaration.getPropertyValue(subprop), "",
|
|
|
|
["expected", extraval, "ignored", relation, "value in",
|
|
|
|
"'" + decl + "'", "when looking at subproperty",
|
|
|
|
"'" + subprop + "'"].join(" "));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
is(gDeclaration.getPropertyValue(property), "",
|
|
|
|
["expected", extraval, "ignored", relation, "value in",
|
|
|
|
"'" + decl + "'"].join(" "));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function test_value(value) {
|
|
|
|
test_value_pair("after", value, "inherit", "inherit");
|
2014-01-08 08:43:37 -08:00
|
|
|
test_value_pair("after", value, "initial", "initial");
|
|
|
|
test_value_pair("after", value, "unset", "unset");
|
2014-01-08 08:43:36 -08:00
|
|
|
test_value_pair("before", "inherit", value, "inherit");
|
2014-01-08 08:43:37 -08:00
|
|
|
test_value_pair("before", "initial", value, "initial");
|
|
|
|
test_value_pair("before", "unset", value, "unset");
|
2014-01-08 08:43:36 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
var idx;
|
|
|
|
for (idx in info.initial_values)
|
|
|
|
test_value(info.initial_values[idx]);
|
|
|
|
for (idx in info.other_values)
|
|
|
|
test_value(info.other_values[idx]);
|
|
|
|
}
|
|
|
|
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
2014-01-10 11:48:32 -08:00
|
|
|
SimpleTest.requestLongerTimeout(4);
|
2014-01-12 22:27:04 -08:00
|
|
|
|
|
|
|
function start_test() {
|
|
|
|
for (var prop in gCSSProperties) {
|
|
|
|
test_property(prop);
|
2014-01-08 08:43:36 -08:00
|
|
|
}
|
2014-01-12 22:27:04 -08:00
|
|
|
SimpleTest.finish();
|
2014-01-08 08:43:36 -08:00
|
|
|
}
|
2014-01-12 22:27:04 -08:00
|
|
|
|
2014-01-14 21:43:28 -08:00
|
|
|
// Turn off CSS error reporting for this test, since it's a bit expensive,
|
|
|
|
// and we're expecting to generate tons and tons of parse errors here.
|
|
|
|
SpecialPowers.pushPrefEnv({ "set": [["layout.css.report_errors", false]] },
|
|
|
|
start_test);
|
2014-01-08 08:43:36 -08:00
|
|
|
|
|
|
|
</script>
|
|
|
|
</pre>
|
|
|
|
</body>
|
|
|
|
</html>
|