| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <meta charset=utf-8> |
| 3 <title>KeyframeEffectReadOnly constructor tests</title> |
| 4 <link rel="help" href="https://w3c.github.io/web-animations/#processing-a-keyfra
mes-argument"> |
| 5 <script src="../../../../../resources/testharness.js"></script> |
| 6 <script src="../../../../../resources/testharnessreport.js"></script> |
| 7 <script src="../../testcommon.js"></script> |
| 8 <body> |
| 9 <div id="log"></div> |
| 10 <div id="target"></div> |
| 11 <script> |
| 12 'use strict'; |
| 13 |
| 14 // Test the "process a keyframe-like object" procedure. |
| 15 // |
| 16 // This file only tests the KeyframeEffectReadOnly constructor since it is |
| 17 // assumed that the implementation of the KeyframeEffect constructor, |
| 18 // Animatable.animate() method, and KeyframeEffect.setKeyframes() method will |
| 19 // all share common machinery and it is not necessary to test each method. |
| 20 |
| 21 // Test that only animatable properties are accessed |
| 22 |
| 23 var gNonAnimatableProps = [ |
| 24 'animation', // Shorthands where all the longhand sub-properties are not |
| 25 // animatable, are also not animatable. |
| 26 'animationDelay', |
| 27 'animationDirection', |
| 28 'animationDuration', |
| 29 'animationFillMode', |
| 30 'animationIterationCount', |
| 31 'animationName', |
| 32 'animationPlayState', |
| 33 'animationTimingFunction', |
| 34 'transition', |
| 35 'transitionDelay', |
| 36 'transitionDuration', |
| 37 'transitionProperty', |
| 38 'transitionTimingFunction', |
| 39 'display', |
| 40 'unsupportedProperty', |
| 41 ]; |
| 42 |
| 43 function TestKeyframe(testProp) { |
| 44 var _propAccessCount = 0; |
| 45 |
| 46 Object.defineProperty(this, testProp, { |
| 47 get: function() { _propAccessCount++; }, |
| 48 enumerable: true |
| 49 }); |
| 50 |
| 51 Object.defineProperty(this, 'propAccessCount', { |
| 52 get: function() { return _propAccessCount; } |
| 53 }); |
| 54 } |
| 55 |
| 56 function GetTestKeyframeSequence(testProp) { |
| 57 return [ new TestKeyframe(testProp) ] |
| 58 } |
| 59 |
| 60 gNonAnimatableProps.forEach(function(prop) { |
| 61 test(function(t) { |
| 62 var testKeyframe = new TestKeyframe(prop); |
| 63 |
| 64 new KeyframeEffectReadOnly(null, testKeyframe); |
| 65 |
| 66 assert_equals(testKeyframe.propAccessCount, 0, 'Accessor not called'); |
| 67 }, 'non-animatable property \'' + prop + '\' is not accessed when using' |
| 68 + ' a property-indexed keyframe object'); |
| 69 }); |
| 70 |
| 71 gNonAnimatableProps.forEach(function(prop) { |
| 72 test(function(t) { |
| 73 var testKeyframes = GetTestKeyframeSequence(prop); |
| 74 |
| 75 new KeyframeEffectReadOnly(null, testKeyframes); |
| 76 |
| 77 assert_equals(testKeyframes[0].propAccessCount, 0, 'Accessor not called'); |
| 78 }, 'non-animatable property \'' + prop + '\' is not accessed when using' |
| 79 + ' a keyframe sequence'); |
| 80 }); |
| 81 |
| 82 // FIXME: Test that non-enumerable properties are not accessed |
| 83 |
| 84 // FIXME: Test that properties are accessed in ascending order by Unicode |
| 85 // codepoint |
| 86 // (There is an existing test for this in |
| 87 // keyframe-effect/constructor.html that should be moved here.) |
| 88 |
| 89 </script> |
| OLD | NEW |