Bug 1402170 - Use for...of instead of forEach for several tests in processing-a-keyframes-argument.html; r?hiro draft
authorBrian Birtles <birtles@gmail.com>
Fri, 22 Sep 2017 11:36:42 +0900
changeset 673284 aaad6b3e1082038b5dfd6df2fa38f5307cf37cc1
parent 673219 c95c8a8940539127f552f7386b9832c26cadeb99
child 673285 6a32021b3b3e2672694459ba2722cb0b10f47928
push id82519
push userbmo:bbirtles@mozilla.com
push dateMon, 02 Oct 2017 08:06:17 +0000
reviewershiro
bugs1402170
milestone58.0a1
Bug 1402170 - Use for...of instead of forEach for several tests in processing-a-keyframes-argument.html; r?hiro for...of is generally preferred over forEach since it is a little easier to read and allows using 'break' and 'continue'. Furthermore it is supported in all major browsers. (It also makes wrapping one of the long lines in this file easier.) MozReview-Commit-ID: 1BuoW0QSxaG
testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument.html
--- a/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument.html
+++ b/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument.html
@@ -52,37 +52,37 @@ function TestKeyframe(testProp) {
     get: function() { return _propAccessCount; }
   });
 }
 
 function GetTestKeyframeSequence(testProp) {
   return [ new TestKeyframe(testProp) ]
 }
 
-gNonAnimatableProps.forEach(function(prop) {
+for (const prop of gNonAnimatableProps) {
   test(function(t) {
     const testKeyframe = new TestKeyframe(prop);
 
     new KeyframeEffect(null, testKeyframe);
 
     assert_equals(testKeyframe.propAccessCount, 0, 'Accessor not called');
   }, 'non-animatable property \'' + prop + '\' is not accessed when using'
      + ' a property-indexed keyframe object');
-});
+}
 
-gNonAnimatableProps.forEach(function(prop) {
+for (const prop of gNonAnimatableProps) {
   test(function(t) {
     const testKeyframes = GetTestKeyframeSequence(prop);
 
     new KeyframeEffect(null, testKeyframes);
 
     assert_equals(testKeyframes[0].propAccessCount, 0, 'Accessor not called');
   }, 'non-animatable property \'' + prop + '\' is not accessed when using'
      + ' a keyframe sequence');
-});
+}
 
 // Test equivalent forms of property indexed and sequenced keyframe syntax
 
 function assertEquivalentKeyframeSyntax(keyframesA, keyframesB) {
   const processedKeyframesA =
     new KeyframeEffect(null, keyframesA).getKeyframes();
   const processedKeyframesB =
     new KeyframeEffect(null, keyframesB).getKeyframes();
@@ -156,21 +156,22 @@ const gEquivalentSyntaxTests = [
     },
     sequencedKeyframes: [
       {left: '0px', composite: 'add'},
       {left: '100px', composite: 'add'},
     ],
   },
 ];
 
-gEquivalentSyntaxTests.forEach(function({description, indexedKeyframes, sequencedKeyframes}) {
+for (const {description, indexedKeyframes, sequencedKeyframes} of
+     gEquivalentSyntaxTests) {
   test(function(t) {
     assertEquivalentKeyframeSyntax(indexedKeyframes, sequencedKeyframes);
-  }, 'Equivalent property indexed and sequenced keyframes: ' + description);
-});
+  }, `Equivalent property indexed and sequenced keyframes: ${description}`);
+}
 
 // Test handling of custom iterable objects.
 
 function createIterable(iterations) {
   return {
     [Symbol.iterator]() {
       let i = 0;
       return {