Add tests that exercise nsCSSDeclaration::ToString.

This commit is contained in:
dbaron%dbaron.org 2007-04-17 03:50:30 +00:00
Родитель 32c1cb23e7
Коммит e62e269ff1
2 изменённых файлов: 62 добавлений и 13 удалений

Просмотреть файл

@ -47,6 +47,22 @@ var gKnownFails = {
"pause": true
};
var gKnownFails2 = {
"-moz-border-radius": 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 pass = true;
@ -72,14 +88,15 @@ function test_property(property)
function check_set(sproperty) {
var sinfo = gCSSProperties[sproperty];
val = gDeclaration.getPropertyValue(sproperty);
if (sproperty == property && property in gKnownFails) {
todo(val == "inherit", "inherit reported back for property '" + sproperty + "'");
} else {
is(val, "inherit", "inherit reported back for property '" + 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);
"consistency between decl.getPropertyValue('" + sproperty +
"') and decl." + sinfo.domProp);
}
}
check_set(property);
@ -87,6 +104,14 @@ function test_property(property)
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) {

Просмотреть файл

@ -45,7 +45,22 @@ var gKnownFails = {
"outline": true,
"padding": true,
"pause": true
/* also see bug 377521 below */
};
var gKnownFails2 = {
"-moz-border-radius": 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)
@ -73,15 +88,16 @@ function test_property(property)
function check_set(sproperty) {
var sinfo = gCSSProperties[sproperty];
val = gDeclaration.getPropertyValue(sproperty);
var func = is;
if ((sproperty == property && property in gKnownFails) ||
(property == "font" && sproperty != "font-family")) { /* bug 377521 */
todo(val == "-moz-initial", "-moz-initial reported back for property '" + sproperty + "'");
} else {
is(val, "-moz-initial", "-moz-initial reported back for property '" + sproperty + "'");
}
(property == "font" && sproperty != "font-family")) /* bug 377521 */
func = todo_is;
func(val, "-moz-initial",
"-moz-initial reported back for property '" + sproperty + "'");
if (sinfo.domProp) {
is(val, gDeclaration[sinfo.domProp],
"consistency between decl.getPropertyValue('" + sproperty + "') and decl." + sinfo.domProp);
"consistency between decl.getPropertyValue('" + sproperty +
"') and decl." + sinfo.domProp);
}
}
check_set(property);
@ -89,6 +105,14 @@ function test_property(property)
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 + ": -moz-initial;",
"declaration should serialize to exactly what went in (for -moz-initial)");
gDeclaration.removeProperty(property);
function check_final(sproperty) {