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
--- 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 {