summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/web-animations-api/animation-constructor.html
blob: 6c131ee9f7daa6ce4b85950fbc05f9580775b30b (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
<!DOCTYPE html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>

<div id='e'></div>

<script>
var element = document.getElementById('e');

var keyframes = [{opacity: '1'}, {opacity: '0'}];
var timingObject = {duration: 2, iterations: 5};

test(function() {
    var keyframeEffect = new KeyframeEffect(element, keyframes, timingObject);
    assert_not_equals(keyframeEffect, undefined);
    assert_equals(keyframeEffect.constructor, KeyframeEffect);
}, 'Calling new KeyframeEffect() with a timing object input should create an keyframeEffect.');

test(function() {
    var keyframeEffect = new KeyframeEffect(element, keyframes, 2);
    assert_not_equals(keyframeEffect, undefined);
    assert_equals(keyframeEffect.constructor, KeyframeEffect);
}, 'Calling new KeyframeEffect() with a duration input should create an keyframeEffect.');

test(function() {
    var keyframeEffect = new KeyframeEffect(element, keyframes);
    assert_not_equals(keyframeEffect, undefined);
    assert_equals(keyframeEffect.constructor, KeyframeEffect);
}, 'Calling new KeyframeEffect() with no timing input should create an keyframeEffect.');

test(function() {
    var keyframeEffect = new KeyframeEffect(null, keyframes);
    assert_not_equals(keyframeEffect, undefined);
    assert_equals(keyframeEffect.constructor, KeyframeEffect);
}, 'Calling new KeyframeEffect() with no target should create an keyframeEffect.');
</script>