Thu, 15 Jan 2015 21:03:48 +0100
Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 -->
5 <head>
6 <title>Test that property_database.js contains all supported CSS properties</title>
7 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
8 <script type="text/javascript" src="css_properties.js"></script>
9 <script type="text/javascript" src="property_database.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
11 </head>
12 <body>
13 <p id="display"></p>
14 <div id="content" style="display: none">
16 <div id="testnode"></div>
18 </div>
19 <pre id="test">
20 <script class="testbody" type="text/javascript">
22 /** Test that property_database.js contains all supported CSS properties **/
24 /*
25 * Here we are testing the hand-written property_database.js against
26 * the autogenerated css_properties.js to make sure that everything in
27 * css_properties.js is in property_database.js.
28 *
29 * This prevents CSS properties from being added to the code without
30 * also being put under the minimal test coverage provided by the tests
31 * that use property_database.js.
32 */
34 for (var idx in gLonghandProperties) {
35 var prop = gLonghandProperties[idx];
36 if (prop.pref && !SpecialPowers.getBoolPref(prop.pref)) {
37 continue;
38 }
39 var present = prop.name in gCSSProperties;
40 ok(present,
41 "'" + prop.name + "' listed in gCSSProperties");
42 if (present) {
43 is(gCSSProperties[prop.name].type, CSS_TYPE_LONGHAND,
44 "'" + prop.name + "' listed as CSS_TYPE_LONGHAND");
45 is(gCSSProperties[prop.name].domProp, prop.prop,
46 "'" + prop.name + "' listed with correct DOM property name");
47 }
48 }
49 for (var idx in gShorthandProperties) {
50 var prop = gShorthandProperties[idx];
51 if (prop.pref && !SpecialPowers.getBoolPref(prop.pref)) {
52 continue;
53 }
54 if (prop.name == "all") {
55 // "all" isn't listed in property_database.js.
56 continue;
57 }
58 var present = prop.name in gCSSProperties;
59 ok(present,
60 "'" + prop.name + "' listed in gCSSProperties");
61 if (present) {
62 ok(gCSSProperties[prop.name].type == CSS_TYPE_TRUE_SHORTHAND ||
63 gCSSProperties[prop.name].type == CSS_TYPE_SHORTHAND_AND_LONGHAND,
64 "'" + prop.name + "' listed as CSS_TYPE_TRUE_SHORTHAND or CSS_TYPE_SHORTHAND_AND_LONGHAND");
65 ok(gCSSProperties[prop.name].domProp == prop.prop,
66 "'" + prop.name + "' listed with correct DOM property name");
67 }
68 }
69 for (var idx in gShorthandPropertiesLikeLonghand) {
70 var prop = gShorthandPropertiesLikeLonghand[idx];
71 if (prop.pref && !SpecialPowers.getBoolPref(prop.pref)) {
72 continue;
73 }
74 var present = prop.name in gCSSProperties;
75 ok(present,
76 "'" + prop.name + "' listed in gCSSProperties");
77 if (present) {
78 ok(gCSSProperties[prop.name].type == CSS_TYPE_SHORTHAND_AND_LONGHAND,
79 "'" + prop.name + "' listed as CSS_TYPE_SHORTHAND_AND_LONGHAND");
80 ok(gCSSProperties[prop.name].domProp == prop.prop,
81 "'" + prop.name + "' listed with correct DOM property name");
82 }
83 }
85 /*
86 * Test that all shorthand properties have a subproperty list and all
87 * longhand properties do not.
88 */
89 for (var prop in gCSSProperties) {
90 var info = gCSSProperties[prop];
91 if (info.pref && !SpecialPowers.getBoolPref(info.pref)) {
92 continue;
93 }
94 if (info.type == CSS_TYPE_LONGHAND) {
95 ok(!("subproperties" in info),
96 "longhand property '" + prop + "' must not have subproperty list");
97 } else if (info.type == CSS_TYPE_TRUE_SHORTHAND) {
98 ok("subproperties" in info,
99 "shorthand property '" + prop + "' must have subproperty list");
100 }
101 /* optional for CSS_TYPE_SHORTHAND_AND_LONGHAND */
103 if ("subproperties" in info) {
104 var good = true;
105 if (info.subproperties.length < 1) {
106 info("subproperty list for '" + prop + "' is empty");
107 good = false;
108 }
109 for (var idx in info.subproperties) {
110 var subprop = info.subproperties[idx];
111 if (!(subprop in gCSSProperties)) {
112 info("subproperty list for '" + prop + "' lists nonexistent subproperty '" + subprop + "'");
113 good = false;
114 }
115 }
116 ok(good, "property '" + prop + "' has a good subproperty list");
117 }
119 ok("initial_values" in info && info.initial_values.length >= 1,
120 "must have initial values for property '" + prop + "'");
121 ok("other_values" in info && info.other_values.length >= 1,
122 "must have non-initial values for property '" + prop + "'");
123 }
125 </script>
126 </pre>
127 </body>
128 </html>