| Index: pkg/polymer/lib/elements/web-animations-js/test/testcases/test-update-state.html
|
| diff --git a/pkg/polymer/lib/elements/web-animations-js/test/testcases/test-update-state.html b/pkg/polymer/lib/elements/web-animations-js/test/testcases/test-update-state.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..1e242decb20a32c363eb22511252f3466e89a7c7
|
| --- /dev/null
|
| +++ b/pkg/polymer/lib/elements/web-animations-js/test/testcases/test-update-state.html
|
| @@ -0,0 +1,112 @@
|
| +<!--
|
| +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">
|
| +
|
| +<script>
|
| +var expected_failures = {
|
| + 'Updated style should be visible despite unrelated errors at t=5s': {
|
| + firefox: true,
|
| + message: "Issue with window sizing cause value to be zero rather then 500px."
|
| + },
|
| + 'Changing the start time of a new player to before the current time should cause it to take effect at t=3s': {
|
| + msie: true,
|
| + message: "rgb != rgba"
|
| + }
|
| +};
|
| +</script>
|
| +<script src="../bootstrap.js"></script>
|
| +<script>
|
| +"use strict";
|
| +
|
| +var element = document.createElement('span');
|
| +document.body.appendChild(element);
|
| +
|
| +test(function() {
|
| + element.animate([{marginLeft: '1px'}, {marginLeft: '1px'}], 1);
|
| + assert_styles(element, {marginLeft: '0px'});
|
| +}, 'New animation should not apply within script before timeline has started.')
|
| +
|
| +timing_test(function() {
|
| + at(0, function() {
|
| + element.animate([{marginTop: '1px'}, {marginTop: '1px'}], 1);
|
| + assert_styles(element, {marginTop: '1px'});
|
| + });
|
| +}, 'New animation should apply within script after timeline has started.')
|
| +
|
| +timing_test(function() {
|
| + var anim = element.animate([{left: '0px'}, {left: '1000px'}], 10);
|
| + at(1, function() {
|
| + assert_styles(element, {left: '100px'});
|
| +
|
| + anim.player.currentTime += 1;
|
| + assert_styles(element, {left: '200px'});
|
| + });
|
| +}, 'Updated style should be visible after player seek');
|
| +
|
| +timing_test(function() {
|
| + var anim = element.animate([{top: '0px'}, {top: '1000px'}], 10);
|
| + at(1, function() {
|
| + assert_styles(element, {top: '100px'});
|
| +
|
| + anim.specified.delay = -1;
|
| + assert_styles(element, {top: '200px'});
|
| + });
|
| +}, 'Updated style should be visible after change to specified timing');
|
| +
|
| +var group = new SeqGroup([
|
| + new Animation(element, {}, 1),
|
| + new Animation(element, [{right: '0px'}, {right: '1000px'}], 10),
|
| +]);
|
| +document.timeline.play(group);
|
| +timing_test(function() {
|
| + at(2, function() {
|
| + assert_styles(element, {right: '100px'});
|
| +
|
| + group.children[0].specified.duration = 0.5;
|
| + assert_styles(element, {right: '150px'});
|
| +
|
| + group.children[0].remove();
|
| + assert_styles(element, {right: '200px'});
|
| + });
|
| +}, 'Updated style should be visible after change to animation tree');
|
| +
|
| +timing_test(function() {
|
| + at(3, function() {
|
| + var anim = element.animate([{color: 'red'}, {color: 'green'}, {color: 'red'}], 1);
|
| + assert_equals(anim.player.startTime, 3);
|
| + assert_styles(element, {color: 'red'});
|
| +
|
| + anim.player.startTime -= 0.5;
|
| + assert_styles(element, {color: 'green'});
|
| + });
|
| +}, 'Changing the start time of a new player to before the current time should cause it to take effect');
|
| +
|
| +var anim3 = element.animate([{bottom: '0px'}, {bottom: '1000px'}], 10);
|
| +// Run this last, since if it fails it's likely to corrupt the other tests.
|
| +timing_test(function() {
|
| + at(5, function() {
|
| + assert_styles(element, {bottom: '500px'});
|
| +
|
| + try {
|
| + var group = new ParGroup();
|
| + group.append(group);
|
| + } catch (e) {
|
| + }
|
| + anim3.specified.delay = -1;
|
| + assert_styles(element, {bottom: '600px'});
|
| + });
|
| +}, 'Updated style should be visible despite unrelated errors');
|
| +</script>
|
|
|