4 https://bugzilla.mozilla.org/show_bug.cgi?id=1112014
8 <title>Test for Bug
1112014</title>
9 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
10 <script src=
"property_database.js"></script>
11 <script type=
"application/javascript">
13 SimpleTest.waitForExplicitFinish();
14 SimpleTest.requestLongerTimeout(
2);
16 async function test() {
17 const InspectorUtils = SpecialPowers.InspectorUtils;
19 // This holds a canonical test value for each TYPE_ constant.
21 "color":
"rgb(3,3,3)",
22 "gradient":
"linear-gradient( 45deg, blue, red )",
23 "timing-function":
"cubic-bezier(0.1, 0.7, 1.0, 0.1)",
26 // The canonical test values don't work for all properties, in
27 // particular some shorthand properties. For these cases we have
29 let overrideValues = {
31 "color": testValues.color +
" 2px 2px"
33 "-webkit-box-shadow": {
34 "color": testValues.color +
" 2px 2px"
37 "color": testValues.color +
" " + testValues.color,
40 "color": testValues.color +
" 2px 2px"
45 // Ensure that all the TYPE_ constants have a representative
46 // test value, to try to ensure that this test is updated
47 // whenever a new type is added.
48 let reps = await SpecialPowers.spawn(window, [], () =
> {
49 return Object.getOwnPropertyNames(InspectorUtils).filter(tc =
> /TYPE_/.test(tc));
50 }).then(v =
> v.filter(tc =
> !(tc in testValues)));
51 is(reps.join(
","),
"",
"all types have representative test value");
53 for (let propertyName in gCSSProperties) {
54 let prop = gCSSProperties[propertyName];
56 for (let iter in testValues) {
57 let testValue = testValues[iter];
58 if (propertyName in overrideValues &&
59 iter in overrideValues[propertyName]) {
60 testValue = overrideValues[propertyName][iter];
64 InspectorUtils.cssPropertySupportsType(propertyName, iter);
65 let parsed = CSS.supports(propertyName, testValue);
66 is(supported, parsed, propertyName +
" supports " + iter);
70 // Regression test for an assertion failure in an earlier version of
71 // the code. Note that cssPropertySupportsType returns false for
72 // all types for a variable.
73 ok(!InspectorUtils.cssPropertySupportsType(
"--variable",
"color"),
74 "cssPropertySupportsType returns false for variable");
80 <body onload=
"test()">
81 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=1112014">Mozilla Bug
1112014</a>
83 <div id=
"content" style=
"display: none">