6 <title>Test that property_database.js contains all supported CSS properties
</title>
7 <script type=
"text/javascript" src=
"/MochiKit/MochiKit.js"></script>
8 <script type=
"text/javascript" src=
"/tests/SimpleTest/SimpleTest.js"></script>
9 <script type=
"text/javascript" src=
"css_properties.js"></script>
10 <script type=
"text/javascript" src=
"property_database.js"></script>
11 <link rel=
"stylesheet" type=
"text/css" href=
"/tests/SimpleTest/test.css" />
15 <div id=
"content" style=
"display: none">
17 <div id=
"testnode"></div>
21 <script class=
"testbody" type=
"text/javascript">
23 /** Test that property_database.js contains all supported CSS properties **/
26 * Here we are testing the hand-written property_database.js against
27 * the autogenerated css_properties.js to make sure that everything in
28 * css_properties.js is in property_database.js.
30 * This prevents CSS properties from being added to the code without
31 * also being put under the minimal test coverage provided by the tests
32 * that use property_database.js.
35 for (var idx in gLonghandProperties) {
36 var prop = gLonghandProperties[idx];
37 ok(prop.name in gCSSProperties &&
38 gCSSProperties[prop.name].type == CSS_TYPE_LONGHAND &&
39 gCSSProperties[prop.name].domProp == prop.prop,
40 "'" + prop.name +
"' listed in gCSSProperties as CSS_TYPE_LONGHAND with correct DOM property name");
42 for (var idx in gShorthandProperties) {
43 var prop = gShorthandProperties[idx];
44 ok(prop.name in gCSSProperties &&
45 (gCSSProperties[prop.name].type == CSS_TYPE_TRUE_SHORTHAND ||
46 gCSSProperties[prop.name].type == CSS_TYPE_SHORTHAND_AND_LONGHAND) &&
47 gCSSProperties[prop.name].domProp == prop.prop,
48 "'" + prop.name +
"' listed in gCSSProperties as CSS_TYPE_TRUE_SHORTHAND or CSS_TYPE_SHORTHAND_AND_LONGHAND with correct DOM property name");
50 for (var idx in gShorthandPropertiesLikeLonghand) {
51 var prop = gShorthandPropertiesLikeLonghand[idx];
52 ok(prop.name in gCSSProperties &&
53 gCSSProperties[prop.name].type == CSS_TYPE_SHORTHAND_AND_LONGHAND &&
54 gCSSProperties[prop.name].domProp == prop.prop,
55 "'" + prop.name +
"' listed in gCSSProperties as CSS_TYPE_SHORTHAND_AND_LONGHAND with correct DOM property name");
59 * Test that all shorthand properties have a subproperty list and all
60 * longhand properties do not.
62 for (var prop in gCSSProperties) {
63 var info = gCSSProperties[prop];
64 if (info.type == CSS_TYPE_LONGHAND) {
65 ok(!(
"subproperties" in info),
66 "longhand property '" + prop +
"' must not have subproperty list");
67 } else if (info.type == CSS_TYPE_TRUE_SHORTHAND) {
68 ok(
"subproperties" in info,
69 "shorthand property '" + prop +
"' must have subproperty list");
71 /* optional for CSS_TYPE_SHORTHAND_AND_LONGHAND */
73 if (
"subproperties" in info) {
75 if (info.subproperties.length <
1) {
76 info(
"subproperty list for '" + prop +
"' is empty");
79 for (var idx in info.subproperties) {
80 var subprop = info.subproperties[idx];
81 if (!(subprop in gCSSProperties)) {
82 info(
"subproperty list for '" + prop +
"' lists nonexistent subproperty '" + subprop +
"'");
86 ok(good,
"property '" + prop +
"' has a good subproperty list");
89 ok(
"initial_values" in info && info.initial_values.length
>=
1,
90 "must have initial values for property '" + prop +
"'");
91 ok(
"other_values" in info && info.other_values.length
>=
1,
92 "must have non-initial values for property '" + prop +
"'");