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

Unified Diff: polymer_0.5.0/bower_components/web-animations-js/test/js/timing.js

Issue 786953007: npm_modules: Fork bower_components into Polymer 0.4.0 and 0.5.0 versions (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 5 years, 12 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 side-by-side diff with in-line comments
Download patch
Index: polymer_0.5.0/bower_components/web-animations-js/test/js/timing.js
diff --git a/polymer_0.5.0/bower_components/web-animations-js/test/js/timing.js b/polymer_0.5.0/bower_components/web-animations-js/test/js/timing.js
new file mode 100644
index 0000000000000000000000000000000000000000..817fc475a003ce3fc39927406c2c43df17a879d1
--- /dev/null
+++ b/polymer_0.5.0/bower_components/web-animations-js/test/js/timing.js
@@ -0,0 +1,51 @@
+suite('timing', function() {
+ setup(function() {
+ webAnimationsMinifill.timeline._players = [];
+ });
+
+ test('pause and scrub', function() {
+ var player = document.body.animate([], { duration: 1000 });
+ player.pause();
+
+ player.currentTime = 500;
+ assert.equal(player.currentTime, 500);
+ });
+
+ test('pause, scrub and play', function() {
+ var target = document.createElement('div');
+ document.body.appendChild(target);
+
+ var player = target.animate([
+ { background: 'blue' },
+ { background: 'red' }
+ ], { duration: 1000 });
+ tick(100);
+ player.pause();
+
+ player.currentTime = 200;
+ // http://www.w3.org/TR/web-animations/#the-current-time-of-a-player
+ // currentTime should now mean 'hold time' - this allows scrubbing.
+ assert.equal(player.currentTime, 200);
+ player.play();
+
+ tick(200);
+ tick(300);
+ assert.equal(player.currentTime, 300);
+ assert.equal(player.startTime, 0);
+ });
+
+ test('sanity-check NaN timing', function() {
+ // This has no actual tests, but will infinite loop without fix.
+
+ var player = document.body.animate([], {
+ duration: 2000,
+ easing: 'ease-in' // fails only with cubic easing, not linear
+ });
+ tick(100);
+ player.currentTime = NaN;
+ tick(200);
+
+ player = document.body.animate([], { duration: NaN, easing: 'ease-out' });
+ tick(300);
+ });
+});

Powered by Google App Engine
This is Rietveld 408576698