Bug 1466031 - Use for ... of instead of forEach in a few places in dom/animation/test/css-animations/; r?hiro draft
authorBrian Birtles <birtles@gmail.com>
Fri, 01 Jun 2018 15:46:40 +0900
changeset 802574 9747627af3f7a1859d21fddf2bb0ffa0a68801ed
parent 802573 48214f60a81a0c01f9ce8f9f33279d3ba1395952
child 802575 e18a393e2522fa23bd4eb5e2c717fe81ebc456bd
push id111920
push userbmo:bbirtles@mozilla.com
push dateFri, 01 Jun 2018 07:32:08 +0000
reviewershiro
bugs1466031
milestone62.0a1
Bug 1466031 - Use for ... of instead of forEach in a few places in dom/animation/test/css-animations/; r?hiro MozReview-Commit-ID: AO8wYFekhpc
dom/animation/test/css-animations/test_animation-computed-timing.html
dom/animation/test/css-animations/test_document-get-animations.html
dom/animation/test/css-animations/test_event-order.html
dom/animation/test/css-animations/test_keyframeeffect-getkeyframes.html
--- a/dom/animation/test/css-animations/test_animation-computed-timing.html
+++ b/dom/animation/test/css-animations/test_animation-computed-timing.html
@@ -294,31 +294,31 @@ test(t => {
 
 
 // --------------------
 // progress
 // Note: Default timing function is linear.
 // --------------------
 
 test(t => {
-  [{fill: '',          progress: [ null, null ]},
-   {fill: 'none',      progress: [ null, null ]},
-   {fill: 'forwards',  progress: [ null, 1.0 ]},
-   {fill: 'backwards', progress: [ 0.0, null ]},
-   {fill: 'both',      progress: [ 0.0, 1.0 ]}]
-  .forEach(test => {
+  const tests = [{ fill: '',          progress: [ null, null ] },
+                 { fill: 'none',      progress: [ null, null ] },
+                 { fill: 'forwards',  progress: [ null, 1.0 ] },
+                 { fill: 'backwards', progress: [ 0.0, null ] },
+                 { fill: 'both',      progress: [ 0.0, 1.0 ] }];
+  for (const test of tests) {
     const div =
       addDiv(t, {style: 'animation: moveAnimation 100s 10s ' + test.fill});
     const anim = div.getAnimations()[0];
     assert_true(anim.effect.getComputedTiming().progress === test.progress[0],
                 'initial progress with "' + test.fill + '" fill');
     anim.finish();
     assert_true(anim.effect.getComputedTiming().progress === test.progress[1],
                 'finished progress with "' + test.fill + '" fill');
-  });
+  }
 }, 'progress of an animation with different fill modes');
 
 test(t => {
   const div = addDiv(t, {style: 'animation: moveAnimation 10s 10 both'});
   const anim = div.getAnimations()[0];
 
   assert_equals(anim.effect.getComputedTiming().progress, 0.0,
                 'Initial value of progress');
--- a/dom/animation/test/css-animations/test_document-get-animations.html
+++ b/dom/animation/test/css-animations/test_document-get-animations.html
@@ -256,19 +256,19 @@ test(t => {
   //       parent
   //     ::before,
   //     ::after
   //        |
   //       child
   const parent = addDiv(t, { 'id': 'parent' });
   const child = addDiv(t);
   parent.appendChild(child);
-  [parent, child].forEach((div) => {
+  for (const div of [parent, child]) {
     div.setAttribute('style', 'animation: animBottom 10s');
-  });
+  }
 
   const anims = document.getAnimations();
   assert_equals(anims.length, 4,
                 'CSS animations on both pseudo-elements and elements ' +
                 'are returned');
   assert_equals(anims[0].effect.target, parent,
                 'The animation targeting the parent element comes first');
   assert_equals(anims[1].effect.target.type, '::before',
--- a/dom/animation/test/css-animations/test_event-order.html
+++ b/dom/animation/test/css-animations/test_event-order.html
@@ -37,23 +37,23 @@ events (${expectedEvents.map(event => ev
     assert_equals(expectedEvents[i][2], actualEvent.elapsedTime,
                   'Event\'s elapsed time should match');
   });
 };
 
 const setupAnimation = (t, animationStyle, receiveEvents) => {
   const div = addDiv(t, { style: "animation: " + animationStyle });
 
-  ['start', 'iteration', 'end'].forEach(name => {
+  for (const name of ['start', 'iteration', 'end']) {
     div['onanimation' + name] = evt => {
     receiveEvents.push({ type:        evt.type,
                          target:      evt.target,
                          elapsedTime: evt.elapsedTime });
     };
-  });
+  }
 
   const watcher = new EventWatcher(t, div, [ 'animationstart',
                                              'animationiteration',
                                              'animationend' ]);
 
   const animation = div.getAnimations()[0];
 
   return [animation, watcher, div];
--- a/dom/animation/test/css-animations/test_keyframeeffect-getkeyframes.html
+++ b/dom/animation/test/css-animations/test_keyframeeffect-getkeyframes.html
@@ -233,29 +233,29 @@ test(t => {
 
   for (let i = 0; i < frames.length; i++) {
     assert_frames_equal(frames[i], expected[i], "ComputedKeyframe #" + i);
   }
 }, 'KeyframeEffect.getKeyframes() returns expected frames for a simple'
    + ' animation');
 
 test(t => {
-  kTimingFunctionValues.forEach(function(easing) {
+  for (const easing of kTimingFunctionValues) {
     const div = addDiv(t);
 
     div.style.animation = 'anim-simple-three 100s ' + easing;
     const frames = getKeyframes(div);
 
     assert_equals(frames.length, 3, "number of frames");
 
     for (let i = 0; i < frames.length; i++) {
       assert_equals(frames[i].easing, easing,
                     "value for 'easing' on ComputedKeyframe #" + i);
     }
-  });
+  }
 }, 'KeyframeEffect.getKeyframes() returns frames with expected easing'
    + ' values, when the easing comes from animation-timing-function on the'
    + ' element');
 
 test(t => {
   const div = addDiv(t);
 
   div.style.animation = 'anim-simple-timing 100s';