Bug 1402170 - Tidy up test for property access order somewhat; r=hiro
authorBrian Birtles <birtles@gmail.com>
Fri, 22 Sep 2017 15:04:54 +0900
changeset 426714 4cc5c419823b5022fd7bab572f11f78b6e4d6cbe
parent 426713 9d2ce508c1292282527fbe2e91e37b182b1f8504
child 426715 40a7c9e5dab44f11d5a70be37cda6701d5cfe2f2
push id97
push userfmarier@mozilla.com
push dateSat, 14 Oct 2017 01:12:59 +0000
reviewershiro
bugs1402170
milestone58.0a1
Bug 1402170 - Tidy up test for property access order somewhat; r=hiro MozReview-Commit-ID: 4JFae0SqMCX
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
@@ -317,27 +317,29 @@ test(function(t) {
 
   assert_frame_lists_equal(effect.getKeyframes(), [
     {offset: null, computedOffset: 0, easing: 'linear', top: '100px'},
     {offset: null, computedOffset: 1, easing: 'linear', top: '200px'},
   ]);
 }, 'Only properties defined directly on property-indexed keyframes are read');
 
 test(function(t) {
-  var expectedOrder = ['composite', 'easing', 'offset', 'left', 'marginLeft'];
-  var actualOrder = [];
-  var kf1 = {};
-  var kf2 = { marginLeft: '10px', left: '20px', offset: 1 };
-  [ { p: 'marginLeft', v: '10px' },
-    { p: 'left',       v: '20px' },
-    { p: 'offset',     v: '0' },
-    { p: 'easing',     v: 'linear' },
-    { p: 'composite',  v: 'replace' } ].forEach(function(e) {
-    Object.defineProperty(kf1, e.p, {
+  const expectedOrder = ['composite', 'easing', 'offset', 'left', 'marginLeft'];
+  const actualOrder = [];
+  const kf1 = {};
+  for (const {prop, value} of [{ prop: 'marginLeft', value: '10px' },
+                               { prop: 'left',       value: '20px' },
+                               { prop: 'offset',     value: '0' },
+                               { prop: 'easing',     value: 'linear' },
+                               { prop: 'composite',  value: 'replace' }]) {
+    Object.defineProperty(kf1, prop, {
       enumerable: true,
-      get: function() { actualOrder.push(e.p); return e.v; }
+      get: function() { actualOrder.push(prop); return value; }
     });
-  });
+  }
+  const kf2 = { marginLeft: '10px', left: '20px', offset: 1 };
+
   new KeyframeEffect(target, [kf1, kf2]);
+
   assert_array_equals(actualOrder, expectedOrder, 'property access order');
 }, 'Properties are read in ascending order by Unicode codepoint');
 
 </script>