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

Side by Side Diff: bower_components/web-animations-js/test/testcases/test-restart.html

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, 11 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
(Empty)
1 <!--
2 Copyright 2013 Google Inc. All Rights Reserved.
3
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15 -->
16
17 <!DOCTYPE html><meta charset="UTF-8">
18 <style>
19 div.anim {
20 position: relative;
21 left: 0px;
22 }
23 </style>
24
25 <div id="anim1" class="anim"></div>
26 <div id="anim2" class="anim"></div>
27 <div id="anim3" class="anim"></div>
28 <div id="anim4" class="anim"></div>
29
30 <script src="../bootstrap.js"></script>
31 <script>
32 "use strict";
33
34 var animFunc = {left: "100px"};
35 var anim1 = new Animation(document.getElementById("anim1"), animFunc, {duration: 1.0, fill: 'forwards'});
36 var player1 = document.timeline.play(anim1);
37
38 var anim2 = new Animation(document.getElementById("anim2"), animFunc, {duration: 1.0, fill: 'forwards'});
39 var player2 = document.timeline.play(anim2);
40
41 var anim3 = new Animation(document.getElementById("anim3"), animFunc, {duration: 1.0, fill: 'forwards'});
42 var player3 = document.timeline.play(anim3);
43
44 // Check that once an animation is completed, creating a new AnimationPlayer res tarts it.
45 timing_test(function() {
46 at(1.0, function() {
47 assert_styles('#anim1', {'left': '100px'});
48 document.timeline.play(anim1);
49 });
50 }, "Animation 1 should be in end state");
51
52 timing_test(function() {
53 at(1.5, function() {assert_styles('#anim1', {'left': '50px'})});
54 }, "Animation 1 should have been restarted");
55
56 timing_test(function() {
57 at(2.0, function() {assert_styles('#anim1', {'left': '100px'})});
58 }, "Animation 1 should be in end state a second time");
59
60 // Setting AnimationPlayer.currentTime = 0 restarts it.
61 timing_test(function() {
62 at(0.5, function() {
63 assert_styles("#anim2", {'left': '50px'});
64 player2.currentTime = 0.0;
65 });
66 }, "Animation 2 should be in the middle of running");
67
68 timing_test(function() {
69 at(0.75, function() {
70 assert_styles('#anim2', {'left': '25px'});
71 });
72 }, "Animation 2 should have been restarted");
73
74 timing_test(function() {
75 at(1.0, function() {
76 assert_styles('#anim2', {'left': '50px'});
77 });
78 }, "Animation 2 should have been restarted, 2");
79
80 timing_test(function() {
81 at(1.5, function() {
82 assert_styles('#anim2', {'left': '100px'});
83 });
84 }, "Animation 2 should be in end state a second time");
85
86 // Even when animation is completed, setting AnimationPlayer.currentTime = 0
87 // restarts it.
88 timing_test(function() {
89 at(1.0, function() {
90 assert_styles("#anim3", {'left': '100px'});
91 player3.currentTime = 0.0;
92 });
93 }, "Animation 3 should be in end state");
94
95 timing_test(function() {
96 at(1.5, function() {
97 assert_styles('#anim3', {'left': '50px'});
98 });
99 }, "Animation 3 should have been restarted");
100
101 timing_test(function() { at(2.0, function() {
102 assert_styles('#anim3', {'left': '100px'});
103 });
104 }, "Animation 3 should be in end state a second time");
105
106
107 // Check that TimedItem.localTime is read-only.
108 var anim4 = new Animation(document.getElementById("anim4"), animFunc, 1.0);
109 document.timeline.play(anim4);
110 test(function() {
111 assert_throws(new TypeError(), function() {anim4.localTime = 0;});
112 assert_equals(anim4.localTime, null);
113 }, "TimedItem.localTime should be read-only");
114
115 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698