summaryrefslogtreecommitdiffstats
path: root/dom/animation/test/chrome/test_cssanimation_missing_keyframes.html
blob: 1d193867123eca2af928096e77c9a848fd6d0291 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!doctype html>
<head>
<meta charset=utf-8>
<title>Bug 1339332 - Test for missing keyframes in CSS Animation</title>
<script type="application/javascript" src="../testharness.js"></script>
<script type="application/javascript" src="../testharnessreport.js"></script>
<script type="application/javascript" src="../testcommon.js"></script>
</head>
<body>
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1339332"
   target="_blank">Mozilla Bug 1339332</a>
<div id="log"></div>
<style>
@keyframes missingFrom {
  to {
    text-align: right;
  }
}
@keyframes missingBoth {
  50% {
    text-align: right;
  }
}
@keyframes missingTo {
  from {
    text-align: right;
  }
}
</style>
<script>
'use strict';

const gTests = [
  { desc: 'missing "from" keyframe',
    animationName: 'missingFrom',
    expected: [{ property: 'text-align',
                 values: [valueFormat(0, undefined, 'replace', 'ease'),
                          valueFormat(1, 'right',   'replace')] } ]
  },
  { desc: 'missing "to" keyframe',
    animationName: 'missingTo',
    expected: [{ property: 'text-align',
                 values: [valueFormat(0, 'right',   'replace', 'ease'),
                          valueFormat(1, undefined, 'replace')] } ]
  },
  { desc: 'missing "from" and "to" keyframes',
    animationName: 'missingBoth',
    expected: [{ property: 'text-align',
                 values: [valueFormat(0,  undefined, 'replace', 'ease'),
                          valueFormat(.5, 'right',   'replace', 'ease'),
                          valueFormat(1,  undefined, 'replace')] } ]
  },
];

SpecialPowers.pushPrefEnv(
  { set: [["dom.animations-api.core.enabled", true]] },
  function() {
    gTests.forEach(function(subtest) {
      test(function(t) {
        const div = addDiv(t);
        div.style.animation = `${ subtest.animationName } 1000s`;
        const animation = div.getAnimations()[0];
        assert_properties_equal(animation.effect.getProperties(),
                                subtest.expected);
      }, subtest.desc);
    });

    done();
  }
);

</script>
</body>