зеркало из https://github.com/mozilla/gecko-dev.git
Bug 940229 part 1: Test extra inherit/-moz-initial at the start/end of property values. r=dholbert
This commit is contained in:
Родитель
76ca557e2c
Коммит
f718ccb7a3
|
@ -111,6 +111,7 @@ support-files = file_bug829816.css
|
|||
[test_descriptor_storage.html]
|
||||
[test_descriptor_syntax_errors.html]
|
||||
[test_dont_use_document_colors.html]
|
||||
[test_extra_inherit_initial.html]
|
||||
[test_flexbox_align_self_auto.html]
|
||||
[test_flexbox_child_display_values.xhtml]
|
||||
[test_flexbox_flex_grow_and_shrink.html]
|
||||
|
|
|
@ -2406,7 +2406,7 @@ var gCSSProperties = {
|
|||
type: CSS_TYPE_TRUE_SHORTHAND,
|
||||
subproperties: [ "font-style", "font-variant", "font-weight", "font-size", "line-height", "font-family", "font-stretch", "font-size-adjust", "-moz-font-feature-settings", "-moz-font-language-override" ],
|
||||
initial_values: [ (gInitialFontFamilyIsSansSerif ? "medium sans-serif" : "medium serif") ],
|
||||
other_values: [ "large serif", "9px fantasy", "bold italic small-caps 24px/1.4 Times New Roman, serif",
|
||||
other_values: [ "large serif", "9px fantasy", "bold italic small-caps 24px/1.4 Times New Roman, serif", "small inherit roman", "small roman inherit",
|
||||
// system fonts
|
||||
"caption", "icon", "menu", "message-box", "small-caption", "status-bar",
|
||||
// Gecko-specific system fonts
|
||||
|
@ -2419,7 +2419,7 @@ var gCSSProperties = {
|
|||
inherited: true,
|
||||
type: CSS_TYPE_LONGHAND,
|
||||
initial_values: [ (gInitialFontFamilyIsSansSerif ? "sans-serif" : "serif") ],
|
||||
other_values: [ (gInitialFontFamilyIsSansSerif ? "serif" : "sans-serif"), "Times New Roman, serif", "'Times New Roman', serif", "cursive", "fantasy", "\\\"Times New Roman", "\"Times New Roman\"", "Times, \\\"Times New Roman", "Times, \"Times New Roman\"", "-no-such-font-installed" ],
|
||||
other_values: [ (gInitialFontFamilyIsSansSerif ? "serif" : "sans-serif"), "Times New Roman, serif", "'Times New Roman', serif", "cursive", "fantasy", "\\\"Times New Roman", "\"Times New Roman\"", "Times, \\\"Times New Roman", "Times, \"Times New Roman\"", "-no-such-font-installed", "inherit roman", "roman inherit", "Times, inherit roman", "inherit roman, Times", "roman inherit, Times", "Times, roman inherit" ],
|
||||
invalid_values: [ "\"Times New\" Roman", "\"Times New Roman\n", "Times, \"Times New Roman\n" ]
|
||||
},
|
||||
"-moz-font-feature-settings": {
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
-->
|
||||
<head>
|
||||
<title>Test handling extra inherit/-moz-initial in CSS declarations</title>
|
||||
<script type="text/javascript" src="/MochiKit/packed.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>
|
||||
<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");
|
||||
test_value_pair("after", value, "-moz-initial", "-moz-initial");
|
||||
test_value_pair("before", "inherit", value, "inherit");
|
||||
test_value_pair("before", "-moz-initial", value, "-moz-initial");
|
||||
}
|
||||
|
||||
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]);
|
||||
}
|
||||
|
||||
// To avoid triggering the slow script dialog, we have to test one
|
||||
// property at a time.
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
var props = [];
|
||||
for (var prop in gCSSProperties)
|
||||
props.push(prop);
|
||||
props = props.reverse();
|
||||
function do_one() {
|
||||
if (props.length == 0) {
|
||||
SimpleTest.finish();
|
||||
return;
|
||||
}
|
||||
test_property(props.pop());
|
||||
SimpleTest.executeSoon(do_one);
|
||||
}
|
||||
SimpleTest.executeSoon(do_one);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче