-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathtimeline.js
45 lines (40 loc) · 1.62 KB
/
timeline.js
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
suite('timeline-tests', function() {
setup(function() {
document.timeline._players = [];
webAnimations1.timeline._players = [];
});
test('no current players', function() {
assert.equal(document.timeline.getAnimationPlayers().length, 0);
});
test('getAnimationPlayers', function() {
tick(90);
assert.equal(document.timeline.getAnimationPlayers().length, 0);
var player = document.body.animate([], {duration: 500, iterations: 1});
tick(300);
assert.equal(document.timeline.getAnimationPlayers().length, 1);
var player2 = document.body.animate([], {duration: 1000});
assert.equal(document.timeline.getAnimationPlayers().length, 2);
tick(800);
assert.equal(player.finished, true);
assert.equal(document.timeline.getAnimationPlayers().length, 1);
tick(2000);
assert.equal(document.timeline.getAnimationPlayers().length, 0);
});
test('getAnimationPlayers checks cancelled animation', function() {
tick(90);
assert.equal(document.timeline.getAnimationPlayers().length, 0);
var player = document.body.animate([], {duration: 500, iterations: 1});
tick(300);
assert.equal(document.timeline.getAnimationPlayers().length, 1);
player.cancel();
assert.equal(document.timeline.getAnimationPlayers().length, 0);
});
test('getAnimationPlayers returns fill forwards animation', function() {
tick(90);
var player = document.body.animate([], {duration: 100, fill: 'forwards'});
tick(300);
assert.equal(document.timeline.getAnimationPlayers().length, 1);
tick(450);
assert.equal(document.timeline.getAnimationPlayers().length, 1);
});
});