Chromium Code Reviews

Side by Side Diff: bower_components/web-animations-js/test/testcases/unit-test-modify-timing-params.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.
Jump to:
View unified diff |
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 <div id="anim"></div>
19
20 <script src="../bootstrap.js"></script>
21 <script>
22 "use strict";
23
24 var anim = new Animation(document.getElementById("anim"), {left: "100px"},
25 1.0);
26
27 // Test that updates to a TimedItem's startTime, or duration
28 // cause corresponding updates to its endTime.
29 test(function() {assert_equals(anim.endTime, 1.0)},
30 "endTime should reflect initial duration");
31 test(function() {
32 assert_throws(new TypeError(), function() {
33 anim.startTime = 2.0;
34 });
35 assert_equals(anim.startTime, 0.0);
36 }, "startTime should be read-only");
37 anim.timing.duration = 3.0;
38 test(function() {assert_equals(anim.endTime, 3.0)},
39 "endTime should reflect Timing.duration");
40 anim.timing.duration = 4.0;
41 test(function() {assert_equals(anim.endTime, 4.0)},
42 "endTime should reflect duration");
43
44 test(function() {
45 assert_throws(new TypeError(), function() {
46 anim.endTime = 6.5;
47 });
48 assert_true(anim.endTime != 6.5);
49 }, "TimedItem.endTime should be read-only");
50
51 // Test that updates to a TimedItem's endTime cause re-layout of a parent
52 // parallel group.
53 anim.timing.duration = 3;
54 var animationGroup = new AnimationGroup([anim]);
55 test(function() {assert_equals(animationGroup.duration, 3.0)},
56 "Parallel group duration should reflect child endTime");
57 test(function() {assert_equals(animationGroup.endTime, 3.0)},
58 "Parallel group end time should reflect child endTime");
59 // Update via Timing.duration
60 anim.timing.duration = 8.0;
61 test(function() {assert_equals(animationGroup.duration, 8.0)},
62 "Parallel group duration should reflect updated child Timing.duration");
63 test(function() {assert_equals(animationGroup.endTime, 8.0)},
64 "Parallel group end time should reflect updated child Timing.duration");
65 // Update via duration
66 anim.timing.duration = 9.0;
67 test(function() {assert_equals(animationGroup.duration, 9.0)},
68 "Parallel group duration should reflect updated child duration");
69 test(function() {assert_equals(animationGroup.endTime, 9.0)},
70 "Parallel group end time should reflect updated child duration");
71
72 // Test that updates to a TimedItem's delay and duration cause
73 // re-layout of a parent sequence group.
74 anim.timing.duration = "auto";
75 var siblingAnim = new Animation(document.getElementById("anim"), {top: "100px"},
76 1.0);
77 var animationSequence = new AnimationSequence([anim, siblingAnim]);
78 test(function() {assert_equals(anim.startTime, 0.0)},
79 "Sequence group should reset child startTime");
80 test(function() {assert_equals(siblingAnim.startTime, 0.0)},
81 "Sequence group should set child startTime");
82 test(function() {assert_equals(siblingAnim.endTime, 1.0)},
83 "Sequence group should set child endTime");
84 test(function() {assert_equals(animationSequence.duration, 1.0)},
85 "Sequence group duration should reflect child durations");
86 test(function() {assert_equals(animationSequence.endTime, 1.0)},
87 "Sequence group end time should reflect child durations");
88 // delay
89 anim.timing.delay = 11.0;
90 test(function() {assert_equals(siblingAnim.startTime, 11.0)},
91 "Sequence group should update sibling after updated child delay");
92 test(function() {assert_equals(animationSequence.duration, 12.0)},
93 "Sequence group duration should reflect updated child delay");
94 test(function() {assert_equals(animationSequence.endTime, 12.0)},
95 "Sequence group end time should reflect updated child delay");
96 // duration
97 anim.timing.duration = 12.0;
98 test(function() {assert_equals(siblingAnim.startTime, 23.0)},
99 "Sequence group should update sibling after updated child Timing.duration") ;
100 test(function() {assert_equals(animationSequence.duration, 24.0)},
101 "Sequence group duration should reflect updated child Timing.duration");
102 test(function() {assert_equals(animationSequence.endTime, 24.0)},
103 "Sequence group end time should reflect updated child Timing.duration");
104
105 </script>
OLDNEW

Powered by Google App Engine