| OLD | NEW |
| 1 <!doctype html> | 1 <!DOCTYPE html> |
| 2 <meta charset='utf-8'> |
| 2 <title>Web Animations API: Keyframe Property tests</title> | 3 <title>Web Animations API: Keyframe Property tests</title> |
| 4 <link rel='help' href='https://w3c.github.io/web-animations/#processing-a-keyfra
mes-argument'> |
| 3 <script src="../../resources/testharness.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
| 4 <script src="../../resources/testharnessreport.js"></script> | 6 <script src="../../resources/testharnessreport.js"></script> |
| 5 <div id="log"></div> | |
| 6 <div id="div"></div> | 7 <div id="div"></div> |
| 7 <script> | 8 <script> |
| 8 | 9 |
| 9 test(function() { | 10 test(function() { |
| 10 var keyframe = {}; | 11 var keyframe = {}; |
| 11 Object.defineProperty(keyframe, 'width', {value: '200px'}); | 12 Object.defineProperty(keyframe, 'width', {value: '200px'}); |
| 12 Object.defineProperty(keyframe, 'height', { | 13 Object.defineProperty(keyframe, 'height', { |
| 13 value: '100px', | 14 value: '100px', |
| 14 enumerable: true}); | 15 enumerable: true}); |
| 15 assert_equals(keyframe.width, '200px', 'width of keyframe is readable'); | 16 assert_equals(keyframe.width, '200px', 'width of keyframe is readable'); |
| 16 assert_equals(keyframe.height, '100px', 'height of keyframe is readable'); | 17 assert_equals(keyframe.height, '100px', 'height of keyframe is readable'); |
| 17 try { | 18 try { |
| 18 div.animate([keyframe, {height: '200px'}], 1); | 19 div.animate([keyframe, {height: '200px'}], 1); |
| 19 } catch (e) { | 20 } catch (e) { |
| 20 assert_unreached("Mismatched properties - both or neither properties on keyf
rame were considered."); | 21 assert_unreached("Mismatched properties - both or neither properties on keyf
rame were considered."); |
| 21 } | 22 } |
| 22 }, | 23 }, 'Only enumerable properties on keyframes are considered'); |
| 23 'enumerable keyframe properties tests', | |
| 24 { | |
| 25 help: 'http://dev.w3.org/fxtf/web-animations/#dfn-procedure-for-converting-a
n-ecmascript-value-to-an-idl-keyframe-object', | |
| 26 assert: 'Only enumerable properties on keyframes are considered', | |
| 27 author: 'Shane Stephens' | |
| 28 }); | |
| 29 | 24 |
| 30 test(function() { | 25 test(function() { |
| 31 var KeyframeParent = function() { this.width = "100px"; }; | 26 var KeyframeParent = function() { this.width = "100px"; }; |
| 32 KeyframeParent.prototype = { height: "100px" }; | 27 KeyframeParent.prototype = { height: "100px" }; |
| 33 var Keyframe = function() { this.top = "100px"; }; | 28 var Keyframe = function() { this.top = "100px"; }; |
| 34 Keyframe.prototype = Object.create(KeyframeParent.prototype); | 29 Keyframe.prototype = Object.create(KeyframeParent.prototype); |
| 35 Object.defineProperty(Keyframe.prototype, "left", { | 30 Object.defineProperty(Keyframe.prototype, "left", { |
| 36 value: '100px', | 31 value: '100px', |
| 37 enumerable: 'true'}); | 32 enumerable: 'true'}); |
| 38 var keyframe = new Keyframe(); | 33 var keyframe = new Keyframe(); |
| 39 try { | 34 try { |
| 40 div.animate([keyframe, {top: '200px', left: '200px', height: '200px'}], 1); | 35 div.animate([keyframe, {top: '200px'}], 1); |
| 41 } catch (e) { | 36 } catch (e) { |
| 42 assert_unreached("Mismatched properties - left, width or height not consider
ed on keyframe."); | 37 assert_unreached("Mismatched properties - left, width or height considered o
n first keyframe."); |
| 43 } | 38 } |
| 44 }, | 39 }, 'Only properties defined directly on keyframes are considered'); |
| 45 'inherited keyframe properties tests', | |
| 46 { | |
| 47 help: 'http://dev.w3.org/fxtf/web-animations/#dfn-procedure-for-converting-a
n-ecmascript-value-to-an-idl-keyframe-object', | |
| 48 assert: 'Only properties in Object.keys on keyframes are considered', | |
| 49 author: 'Shane Stephens' | |
| 50 }); | |
| 51 | |
| 52 | 40 |
| 53 </script> | 41 </script> |
| OLD | NEW |