Bug 1466031 - Use for ... of instead of forEach in a few places in dom/animation/test/css-animations/; r=hiro
authorBrian Birtles <birtles@gmail.com>
Mon, 04 Jun 2018 10:20:54 +0900
changeset 421145 2337de0fc6d6aed827feb6495bfa4dbc33140dae
parent 421144 814a885cf046a3bfb3ac253684b5df1b11b4dc05
child 421146 e4926e77c345206dfc64b2101ca30df7ba76353e
push id34089
push userdluca@mozilla.com
push dateMon, 04 Jun 2018 18:11:55 +0000
treeherdermozilla-central@d8f180ab7492 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershiro
bugs1466031
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1466031 - Use for ... of instead of forEach in a few places in dom/animation/test/css-animations/; r=hiro
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';