Home | History | Annotate | Download | only in js
      1 suite('timeline-tests', function() {
      2   setup(function() {
      3     document.timeline._players = [];
      4     webAnimations1.timeline._players = [];
      5   });
      6 
      7   test('no current players', function() {
      8     assert.equal(document.timeline.getAnimationPlayers().length, 0);
      9   });
     10 
     11   test('getAnimationPlayers', function() {
     12     tick(90);
     13     assert.equal(document.timeline.getAnimationPlayers().length, 0);
     14     var player = document.body.animate([], {duration: 500, iterations: 1});
     15     tick(300);
     16     assert.equal(document.timeline.getAnimationPlayers().length, 1);
     17 
     18     var player2 = document.body.animate([], {duration: 1000});
     19     assert.equal(document.timeline.getAnimationPlayers().length, 2);
     20     tick(800);
     21     assert.equal(player.finished, true);
     22     assert.equal(document.timeline.getAnimationPlayers().length, 1);
     23     tick(2000);
     24     assert.equal(document.timeline.getAnimationPlayers().length, 0);
     25   });
     26 
     27   test('getAnimationPlayers checks cancelled animation', function() {
     28     tick(90);
     29     assert.equal(document.timeline.getAnimationPlayers().length, 0);
     30     var player = document.body.animate([], {duration: 500, iterations: 1});
     31     tick(300);
     32     assert.equal(document.timeline.getAnimationPlayers().length, 1);
     33     player.cancel();
     34     assert.equal(document.timeline.getAnimationPlayers().length, 0);
     35   });
     36 });
     37