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

Unified Diff: pkg/polymer/lib/elements/web-animations-js/test/testcases/unit-test-modify-timing-params.html

Issue 175443005: [polymer] import all elements (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: updated from bower Created 6 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 side-by-side diff with in-line comments
Download patch
Index: pkg/polymer/lib/elements/web-animations-js/test/testcases/unit-test-modify-timing-params.html
diff --git a/pkg/polymer/lib/elements/web-animations-js/test/testcases/unit-test-modify-timing-params.html b/pkg/polymer/lib/elements/web-animations-js/test/testcases/unit-test-modify-timing-params.html
new file mode 100644
index 0000000000000000000000000000000000000000..9009d6ec839eed25df96c5eb9f9bafc217054871
--- /dev/null
+++ b/pkg/polymer/lib/elements/web-animations-js/test/testcases/unit-test-modify-timing-params.html
@@ -0,0 +1,105 @@
+<!--
+Copyright 2013 Google Inc. All Rights Reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+-->
+
+<!DOCTYPE html><meta charset="UTF-8">
+<div id="anim"></div>
+
+<script src="../bootstrap.js"></script>
+<script>
+"use strict";
+
+var anim = new Animation(document.getElementById("anim"), {left: "100px"},
+ 1.0);
+
+// Test that updates to a TimedItem's startTime, or duration
+// cause corresponding updates to its endTime.
+test(function() {assert_equals(anim.endTime, 1.0)},
+ "endTime should reflect initial duration");
+test(function() {
+ assert_throws(new TypeError(), function() {
+ anim.startTime = 2.0;
+ });
+ assert_equals(anim.startTime, 0.0);
+}, "startTime should be read-only");
+anim.specified.duration = 3.0;
+test(function() {assert_equals(anim.endTime, 3.0)},
+ "endTime should reflect Timing.duration");
+anim.specified.duration = 4.0;
+test(function() {assert_equals(anim.endTime, 4.0)},
+ "endTime should reflect duration");
+
+test(function() {
+ assert_throws(new TypeError(), function() {
+ anim.endTime = 6.5;
+ });
+ assert_true(anim.endTime != 6.5);
+}, "TimedItem.endTime should be read-only");
+
+// Test that updates to a TimedItem's endTime cause re-layout of a parent
+// parallel group.
+anim.specified.duration = 3;
+var parGroup = new ParGroup([anim]);
+test(function() {assert_equals(parGroup.duration, 3.0)},
+ "Parallel group duration should reflect child endTime");
+test(function() {assert_equals(parGroup.endTime, 3.0)},
+ "Parallel group end time should reflect child endTime");
+// Update via Timing.duration
+anim.specified.duration = 8.0;
+test(function() {assert_equals(parGroup.duration, 8.0)},
+ "Parallel group duration should reflect updated child Timing.duration");
+test(function() {assert_equals(parGroup.endTime, 8.0)},
+ "Parallel group end time should reflect updated child Timing.duration");
+// Update via duration
+anim.specified.duration = 9.0;
+test(function() {assert_equals(parGroup.duration, 9.0)},
+ "Parallel group duration should reflect updated child duration");
+test(function() {assert_equals(parGroup.endTime, 9.0)},
+ "Parallel group end time should reflect updated child duration");
+
+// Test that updates to a TimedItem's delay and duration cause
+// re-layout of a parent sequence group.
+anim.specified.duration = "auto";
+var siblingAnim = new Animation(document.getElementById("anim"), {top: "100px"},
+ 1.0);
+var seqGroup = new SeqGroup([anim, siblingAnim]);
+test(function() {assert_equals(anim.startTime, 0.0)},
+ "Sequence group should reset child startTime");
+test(function() {assert_equals(siblingAnim.startTime, 0.0)},
+ "Sequence group should set child startTime");
+test(function() {assert_equals(siblingAnim.endTime, 1.0)},
+ "Sequence group should set child endTime");
+test(function() {assert_equals(seqGroup.duration, 1.0)},
+ "Sequence group duration should reflect child durations");
+test(function() {assert_equals(seqGroup.endTime, 1.0)},
+ "Sequence group end time should reflect child durations");
+// delay
+anim.specified.delay = 11.0;
+test(function() {assert_equals(siblingAnim.startTime, 11.0)},
+ "Sequence group should update sibling after updated child delay");
+test(function() {assert_equals(seqGroup.duration, 12.0)},
+ "Sequence group duration should reflect updated child delay");
+test(function() {assert_equals(seqGroup.endTime, 12.0)},
+ "Sequence group end time should reflect updated child delay");
+// duration
+anim.specified.duration = 12.0;
+test(function() {assert_equals(siblingAnim.startTime, 23.0)},
+ "Sequence group should update sibling after updated child Timing.duration");
+test(function() {assert_equals(seqGroup.duration, 24.0)},
+ "Sequence group duration should reflect updated child Timing.duration");
+test(function() {assert_equals(seqGroup.endTime, 24.0)},
+ "Sequence group end time should reflect updated child Timing.duration");
+
+</script>

Powered by Google App Engine
This is Rietveld 408576698