| Index: pkg/polymer/lib/elements/web-animations-js/test/testcases/test-player-cleanup.html
|
| diff --git a/pkg/polymer/lib/elements/web-animations-js/test/testcases/test-player-cleanup.html b/pkg/polymer/lib/elements/web-animations-js/test/testcases/test-player-cleanup.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..98b8a8cb475f1faa55c9c05c536e7035a81211c9
|
| --- /dev/null
|
| +++ b/pkg/polymer/lib/elements/web-animations-js/test/testcases/test-player-cleanup.html
|
| @@ -0,0 +1,78 @@
|
| +<!--
|
| +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>
|
| +var expected_failures = {
|
| + '/.* t=(3|5)s/': {
|
| + msie: true,
|
| + message: "IE returns rgba not rga."
|
| + }
|
| +};
|
| +</script>
|
| +<script src="../bootstrap.js"></script>
|
| +<script>
|
| +"use strict";
|
| +
|
| +
|
| +document.timeline.play(new Animation(null, {},
|
| + {duration: 1, fill: 'forwards'}));
|
| +document.timeline.play(new Animation(null, {},
|
| + {duration: 1, fill: 'none'}));
|
| +var player = document.timeline.play(new Animation(anim,
|
| + [{backgroundColor: 'red'}, {backgroundColor: 'white'}],
|
| + {duration: 1, fill: 'none'}));
|
| +
|
| +timing_test(function() {
|
| + at(0.5, function() {
|
| + assert_equals(document.timeline.getCurrentPlayers().length, 3,
|
| + "All animations current");
|
| + assert_equals(_WebAnimationsTestingUtilities._knownPlayers.length, 3,
|
| + "All animations known");
|
| + });
|
| + at(2, function() {
|
| + assert_equals(document.timeline.getCurrentPlayers().length, 0,
|
| + "No animations current");
|
| + assert_equals(_WebAnimationsTestingUtilities._knownPlayers.length, 1,
|
| + "Only animations with forward fill known");
|
| + });
|
| + at(3, function() {
|
| + player.currentTime = 0;
|
| + assert_equals(document.timeline.getCurrentPlayers().length, 1,
|
| + "Only restarted animation current");
|
| + assert_equals(_WebAnimationsTestingUtilities._knownPlayers.length, 2,
|
| + "Restarted and forward filling animations known");
|
| + assert_styles('#anim', [{"backgroundColor": 'rgb(255, 0, 0)'}],
|
| + "takes effect immediately");
|
| + });
|
| + at(3.5, function() {
|
| + assert_equals(document.timeline.getCurrentPlayers().length, 1,
|
| + "Only restarted animation current");
|
| + assert_equals(_WebAnimationsTestingUtilities._knownPlayers.length, 2,
|
| + "Restarted and forward filling animations known");
|
| + })
|
| +
|
| + at(5, function() {
|
| + player.source.specified.duration = 4;
|
| + assert_equals(document.timeline.getCurrentPlayers().length, 1,
|
| + "Only restarted animation current");
|
| + assert_equals(_WebAnimationsTestingUtilities._knownPlayers.length, 2,
|
| + "Restarted and forward filling animations known");
|
| + assert_styles('#anim', [{"backgroundColor": 'rgb(255, 64, 64)'}],
|
| + "takes effect immediately");
|
| + });
|
| +});
|
| +</script>
|
|
|