Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: polymer_0.5.4/bower_components/web-animations-js/test/js/group-player.js

Issue 895523005: Added Polymer 0.5.4 (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 suite('group-player', function() { 1 suite('group-player', function() {
2 setup(function() { 2 setup(function() {
3 document.timeline._players = []; 3 document.timeline._players = [];
4 webAnimationsMinifill.timeline._players = []; 4 webAnimations1.timeline._players = [];
5 this.elements = []; 5 this.elements = [];
6 6
7 var animationMargin = function(target) { 7 var animationMargin = function(target) {
8 return new Animation( 8 return new Animation(
9 target, 9 target,
10 [ 10 [
11 {marginLeft: '0px'}, 11 {marginLeft: '0px'},
12 {marginLeft: '100px'} 12 {marginLeft: '100px'}
13 ], 13 ],
14 500); 14 500);
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 assert.equal(player.currentTime, timingList[1], trace + ' currentTime'); 176 assert.equal(player.currentTime, timingList[1], trace + ' currentTime');
177 } else { 177 } else {
178 _checkTimes(player._childPlayers[index], timingList[0], 0, trace + ' ' + i ndex); 178 _checkTimes(player._childPlayers[index], timingList[0], 0, trace + ' ' + i ndex);
179 _checkTimes(player, timingList.slice(1), index + 1, trace); 179 _checkTimes(player, timingList.slice(1), index + 1, trace);
180 } 180 }
181 } 181 }
182 182
183 test('playing an animationGroup works as expected', function() { 183 test('playing an animationGroup works as expected', function() {
184 tick(90); 184 tick(90);
185 var p = document.timeline.play(simpleAnimationGroup()); 185 var p = document.timeline.play(simpleAnimationGroup());
186 checkTimes(p, [null, 0], []); 186 checkTimes(p, [null, 0], [[null, 0], [null, 0], [null, 0]]);
187 tick(100); 187 tick(100);
188 checkTimes(p, [100, 0], [[100, 0], [100, 0], [100, 0]]); 188 checkTimes(p, [100, 0], [[100, 0], [100, 0], [100, 0]]);
189 tick(300); 189 tick(300);
190 checkTimes(p, [100, 200], [[100, 200], [100, 200], [100, 200]]); 190 checkTimes(p, [100, 200], [[100, 200], [100, 200], [100, 200]]);
191 tick(1200); 191 tick(1200);
192 checkTimes(p, [100, 1100], [[100, 1100], [100, 1000], [100, 1100]]); 192 checkTimes(p, [100, 1100], [[100, 1100], [100, 1000], [100, 1100]]);
193 tick(2200); 193 tick(2200);
194 checkTimes(p, [100, 2100], [[100, 2000], [100, 1000], [100, 2100]]); 194 checkTimes(p, [100, 2100], [[100, 2000], [100, 1000], [100, 2100]]);
195 tick(3200); 195 tick(3200);
196 checkTimes(p, [100, 3000], [[100, 2000], [100, 1000], [100, 3000]]); 196 checkTimes(p, [100, 3000], [[100, 2000], [100, 1000], [100, 3000]]);
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 player.play(); 540 player.play();
541 checkTimes(player, [null, 200], [[null, 200], [null, -300]], 't = 300'); 541 checkTimes(player, [null, 200], [[null, 200], [null, -300]], 't = 300');
542 542
543 tick(301); 543 tick(301);
544 checkTimes(player, [101, 200], [[101, 200], [601, -300]], 't = 301'); 544 checkTimes(player, [101, 200], [[101, 200], [601, -300]], 't = 301');
545 545
546 tick(700); 546 tick(700);
547 checkTimes(player, [101, 599], [[101, 500], [601, 99]], 't = 700'); 547 checkTimes(player, [101, 599], [[101, 500], [601, 99]], 't = 700');
548 }); 548 });
549 549
550 test('pausing before tick works as expected with a simple AnimationSequence', function() {
551 var player = document.timeline.play(this.seqSimple_source);
552 checkTimes(player, [null, 0], [[null, 0], [null, -500]], 't = 0');
553
554 player.pause();
555 checkTimes(player, [null, null], [[null, null], [null, null]], 't = 0');
556
557 tick(10);
558 checkTimes(player, [null, 0], [[null, 0], [null, -500]], 't = 10');
559 });
560
561 test('pausing and seeking before tick works as expected with a simple Animatio nSequence', function() {
562 var player = document.timeline.play(this.seqSimple_source);
563 player.pause();
564
565 player.currentTime = 0;
566 checkTimes(player, [null, 0], [[null, 0], [null, -500]], 't = 10');
567
568 player.currentTime = 250;
569 checkTimes(player, [null, 250], [[null, 250], [null, -250]], 't = 10');
570
571 player.currentTime = 500;
572 checkTimes(player, [null, 500], [[null, 500], [null, 0]], 't = 10');
573
574 // FIXME: Expectation should be [null, 1000], [[null, 500], [null, 500]].
575 player.currentTime = 1000;
576 checkTimes(player, [null, 1000], [[null, 1000], [null, 500]], 't = 10');
577 });
578
550 test('pausing works as expected with an AnimationSequence inside an AnimationS equence', function() { 579 test('pausing works as expected with an AnimationSequence inside an AnimationS equence', function() {
551 var player = document.timeline.play(this.seqWithSeq_source); 580 var player = document.timeline.play(this.seqWithSeq_source);
552 tick(0); 581 tick(0);
553 checkTimes( 582 checkTimes(
554 player, 583 player,
555 [0, 0], [ 584 [0, 0], [
556 [0, 0], 585 [0, 0],
557 [500, -500], [ 586 [500, -500], [
558 [1000, -1000], 587 [1000, -1000],
559 [1500, -1500]]], 588 [1500, -1500]]],
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 tick(103); 937 tick(103);
909 assert.equal(p.playState, 'running'); 938 assert.equal(p.playState, 'running');
910 assert.equal(p._childPlayers[0]._player.playState, 'finished'); 939 assert.equal(p._childPlayers[0]._player.playState, 'finished');
911 assert.equal(p._childPlayers[1]._player.playState, 'running'); 940 assert.equal(p._childPlayers[1]._player.playState, 'running');
912 tick(204); 941 tick(204);
913 assert.equal(p.playState, 'finished'); 942 assert.equal(p.playState, 'finished');
914 assert.equal(p._childPlayers[0]._player.playState, 'finished'); 943 assert.equal(p._childPlayers[0]._player.playState, 'finished');
915 assert.equal(p._childPlayers[1]._player.playState, 'finished'); 944 assert.equal(p._childPlayers[1]._player.playState, 'finished');
916 }); 945 });
917 }); 946 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698