summaryrefslogtreecommitdiffstats
path: root/devtools/server/tests/chrome/test_animation-type-longhand.html
blob: 97f5b1e46958982187df0c3faabecbb40f53db0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!DOCTYPE html>
<meta charset="UTF-8">
<title>Test animation-type-longhand</title>
<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<body>
<script>
  "use strict";

  // This test checks the content of animation type for longhands table that
  // * every longhand property is included
  // * nothing else is included
  // * no property is mapped to more than one animation type
  window.onload = function() {
    const {require} = ChromeUtils.importESModule("resource://devtools/shared/loader/Loader.sys.mjs");
    const { ANIMATION_TYPE_FOR_LONGHANDS } =
      require("devtools/server/actors/animation-type-longhand");
    const InspectorUtils = SpecialPowers.InspectorUtils;

    const all_longhands = InspectorUtils.getCSSPropertyNames({
      includeShorthands: false,
      includeExperimentals: true,
    });

    const unseen_longhands = new Set(all_longhands);
    const seen_longhands = new Set();
    for (const [, names] of ANIMATION_TYPE_FOR_LONGHANDS) {
      for (const name of names) {
        ok(!seen_longhands.has(name),
           `${name} should have only one animation type`);
        ok(unseen_longhands.has(name),
           `${name} is an unseen longhand property`);
        unseen_longhands.delete(name);
        seen_longhands.add(name);
      }
    }
    is(unseen_longhands.size, 0,
       "All longhands should be mapped to some animation type: " + [...unseen_longhands].join(", "));

    SimpleTest.finish();
  };
</script>
</body>