| OLD | NEW |
| (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 <style> | |
| 19 div.anim { | |
| 20 position: relative; | |
| 21 left: 0px; | |
| 22 } | |
| 23 </style> | |
| 24 | |
| 25 <div id="anim1" class="anim"></div> | |
| 26 <div id="anim2" class="anim"></div> | |
| 27 | |
| 28 <script src="../bootstrap.js"></script> | |
| 29 <script> | |
| 30 "use strict"; | |
| 31 | |
| 32 var animFunc = [{left: "100px"}, {left: "200px"}]; | |
| 33 | |
| 34 // Test that the animation interval uses inclusive start and end bounds. | |
| 35 var elem1 = document.getElementById("anim1"); | |
| 36 var player1 = | |
| 37 document.timeline.play(new Animation(elem1, animFunc, {duration: 1.0, fill: 'f
orwards'})); | |
| 38 | |
| 39 timing_test(function() { | |
| 40 at(0, function() { assert_equals(getComputedStyle(elem1).left, "100px") }); | |
| 41 }, | |
| 42 "Start bound should be inclusive"); | |
| 43 | |
| 44 timing_test(function() { | |
| 45 at(1.0, function() { assert_equals(getComputedStyle(elem1).left, "200px") })
; | |
| 46 }, | |
| 47 "End bound should be inclusive"); | |
| 48 | |
| 49 // Test that delay is applied correctly. | |
| 50 var elem2 = document.getElementById("anim2"); | |
| 51 var player2 = document.timeline.play( | |
| 52 new Animation(elem2, animFunc, {duration: 1.0, delay: 1.0, fill: 'forwards'}))
; | |
| 53 | |
| 54 timing_test(function() { | |
| 55 at(0, function() { assert_equals(getComputedStyle(elem2).left, "0px"); }); | |
| 56 }, | |
| 57 "Start bound should include delay"); | |
| 58 | |
| 59 timing_test(function() { | |
| 60 at(1.0, function() { assert_equals(getComputedStyle(elem2).left, "100px"); }
); | |
| 61 }, | |
| 62 "Start bound with delay should be inclusive"); | |
| 63 | |
| 64 timing_test(function() { | |
| 65 at(2.0, function() { assert_equals(getComputedStyle(elem2).left, "200px"); }
); | |
| 66 }, | |
| 67 "End bound with delay should be inclusive"); | |
| 68 | |
| 69 </script> | |
| OLD | NEW |