зеркало из https://github.com/mozilla/pjs.git
Add tests for invalid values in the property database, and add cases fixed in bug 258080.
This commit is contained in:
Родитель
0be6cf1d31
Коммит
4d08619789
|
@ -74,6 +74,7 @@ _TEST_FILES = test_bug302186.html \
|
|||
test_inherit_storage.html \
|
||||
test_initial_storage.html \
|
||||
test_property_database.html \
|
||||
test_property_syntax_errors.html \
|
||||
css_properties.js \
|
||||
property_database.js \
|
||||
$(NULL)
|
||||
|
|
|
@ -244,7 +244,10 @@ var gCSSProperties = {
|
|||
type: CSS_TYPE_LONGHAND,
|
||||
initial_values: [ "auto" ],
|
||||
other_values: [ "1", "0", "17" ],
|
||||
invalid_values: [ "-1", "3px" ]
|
||||
invalid_values: [
|
||||
// "-1", unclear: see http://lists.w3.org/Archives/Public/www-style/2007Apr/0030
|
||||
"3px"
|
||||
]
|
||||
},
|
||||
"-moz-column-gap": {
|
||||
domProp: "MozColumnGap",
|
||||
|
@ -430,9 +433,14 @@ var gCSSProperties = {
|
|||
backend_only: false,
|
||||
type: CSS_TYPE_TRUE_SHORTHAND,
|
||||
subproperties: [ "background-attachment", "background-color", "background-image", "background-position", "background-repeat", "-moz-background-clip", "-moz-background-inline-policy", "-moz-background-origin" ],
|
||||
initial_values: [ "transparent", "none", "repeat", "scroll", "0% 0%", "top left", "left top", "transparent none", "top left none", "none 0% 0%", "transparent none repeat scroll top left", "left top repeat none scroll transparent"],
|
||||
initial_values: [ "transparent", "none", "repeat", "scroll", "0% 0%", "top left", "left top", "transparent none", "top left none", "left top none", "none left top", "none top left", "none 0% 0%", "transparent none repeat scroll top left", "left top repeat none scroll transparent"],
|
||||
other_values: [ "green", "none green repeat scroll left top", "url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAKElEQVR42u3NQQ0AAAgEoNP+nTWFDzcoQE1udQQCgUAgEAgEAsGTYAGjxAE/G/Q2tQAAAABJRU5ErkJggg==)", "repeat url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAAKElEQVR42u3NQQ0AAAgEoNP+nTWFDzcoQE1udQQCgUAgEAgEAsGTYAGjxAE/G/Q2tQAAAABJRU5ErkJggg==') transparent left top scroll", "repeat-x", "repeat-y", "no-repeat", "none repeat-y transparent scroll 0% 0%", "fixed", "0% top transparent fixed repeat none", "top", "left", "50% 50%", "center", "bottom right scroll none transparent repeat", "50% transparent", "transparent 50%", "50%" ],
|
||||
invalid_values: [ "50% left", "top 50%" ]
|
||||
invalid_values: [
|
||||
/* mixes with keywords have to be in correct order */
|
||||
"50% left", "top 50%",
|
||||
/* bug 258080: don't accept background-position separated */
|
||||
"left url(404.png) top", "top url(404.png) left"
|
||||
]
|
||||
},
|
||||
"background-attachment": {
|
||||
domProp: "backgroundAttachment",
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
-->
|
||||
<head>
|
||||
<title>Test that we reject syntax errors listed in property_database.js</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>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
<div id="testnode"></div>
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
var gDeclaration = document.getElementById("testnode").style;
|
||||
|
||||
for (var property in gCSSProperties) {
|
||||
var info = gCSSProperties[property];
|
||||
for (var idx in info.invalid_values) {
|
||||
var badval = info.invalid_values[idx];
|
||||
|
||||
gDeclaration.setProperty(property, badval, "");
|
||||
|
||||
is(gDeclaration.getPropertyValue(property), "",
|
||||
"invalid value '" + badval + "' not accepted for '" + property +
|
||||
"' property");
|
||||
|
||||
if ("subproperties" in info) {
|
||||
for (var sidx in info.subproperties) {
|
||||
var subprop = info.subproperties[sidx];
|
||||
is(gDeclaration.getPropertyValue(subprop), "",
|
||||
"invalid value '" + badval + "' not accepted for '" + property +
|
||||
"' property when testing subproperty '" + subprop + "'");
|
||||
}
|
||||
}
|
||||
|
||||
gDeclaration.removeProperty(property);
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Загрузка…
Ссылка в новой задаче