Bug 1402170 - Tidy up test for property access order somewhat; r?hiro draft
authorBrian Birtles <birtles@gmail.com>
Fri, 22 Sep 2017 15:04:54 +0900
changeset 673225 3e537f0e2da1682d4438a60beff5bf668b41d4ed
parent 673224 b4d33eaf8bdbed71eb56b51fdf39995ef9888a9e
child 673226 0d7f80ca9d6f0d4194420c0aae45a30b9078ec40
push id82504
push userbmo:bbirtles@mozilla.com
push dateMon, 02 Oct 2017 05:09:17 +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>