| 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>
|
|
|