| 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 <script src='../bootstrap.js'></script> | |
| 19 <script> | |
| 20 'use strict'; | |
| 21 | |
| 22 var effect = [{left: '100px'}, {left: '100px'}]; | |
| 23 function inEffect(element) { | |
| 24 return getComputedStyle(element).left === '100px'; | |
| 25 } | |
| 26 | |
| 27 function createAnim(element, fill) { | |
| 28 return new Animation(element, effect, { | |
| 29 delay: 0.1, | |
| 30 duration: 0.1, | |
| 31 fill: fill, | |
| 32 }); | |
| 33 } | |
| 34 function createGroup(element, fill) { | |
| 35 return new AnimationSequence([ | |
| 36 new Animation(element, effect, { | |
| 37 duration: 0.1, | |
| 38 fill: 'both'}) | |
| 39 ], { | |
| 40 delay: 0.1, | |
| 41 }); | |
| 42 } | |
| 43 | |
| 44 function createElement() { | |
| 45 var element = document.createElement('div'); | |
| 46 document.body.appendChild(element); | |
| 47 return element; | |
| 48 } | |
| 49 | |
| 50 timing_test(function() { | |
| 51 var animElement = createElement(); | |
| 52 document.timeline.play(createAnim(animElement, 'auto')); | |
| 53 var changingAnimElement = createElement(); | |
| 54 var changingAnim = createAnim(changingAnimElement, 'both'); | |
| 55 document.timeline.play(changingAnim); | |
| 56 | |
| 57 var groupElement = createElement(); | |
| 58 document.timeline.play(createGroup(groupElement, 'auto')); | |
| 59 var changingGroupElement = createElement(); | |
| 60 var changingGroup = createGroup(changingGroupElement, 'none'); | |
| 61 document.timeline.play(changingGroup); | |
| 62 | |
| 63 at(0, function () { | |
| 64 assert_false(inEffect(animElement), 'Animations should not be in effect by d
efault before they start.'); | |
| 65 assert_true(inEffect(groupElement), 'Timing Groups should be in effect by de
fault before they start.'); | |
| 66 }, 'Before phase'); | |
| 67 | |
| 68 at(0.5, function () { | |
| 69 assert_false(inEffect(animElement), 'Animations should not be in effect by d
efault after they end.'); | |
| 70 assert_true(inEffect(groupElement), 'Timing Groups should be in effect by de
fault before after they end.'); | |
| 71 | |
| 72 changingAnim.timing.fill = 'auto'; | |
| 73 changingGroup.timing.fill = 'auto'; | |
| 74 assert_false(inEffect(changingAnimElement), 'Updating Animation fill mode to
auto should take effect immediately.'); | |
| 75 assert_true(inEffect(changingGroupElement), 'Updating Timing Group fill mode
to auto should take effect immediately.'); | |
| 76 }, 'After phase'); | |
| 77 }); | |
| 78 </script> | |
| OLD | NEW |