--- a/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument-001.html
+++ b/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument-001.html
@@ -39,42 +39,42 @@ const gNonAnimatableProps = [
'unsupportedProperty',
'font-size', // Supported property that uses dashes
];
function TestKeyframe(testProp) {
let _propAccessCount = 0;
Object.defineProperty(this, testProp, {
- get: function() { _propAccessCount++; },
+ get: () => { _propAccessCount++; },
enumerable: true,
});
Object.defineProperty(this, 'propAccessCount', {
- get: function() { return _propAccessCount; }
+ get: () => _propAccessCount
});
}
function GetTestKeyframeSequence(testProp) {
return [ new TestKeyframe(testProp) ]
}
for (const prop of gNonAnimatableProps) {
- test(function(t) {
+ test(() => {
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');
}
for (const prop of gNonAnimatableProps) {
- test(function(t) {
+ test(() => {
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');
}
@@ -147,17 +147,17 @@ const gEquivalentSyntaxTests = [
{ left: '0px', composite: 'add' },
{ left: '100px', composite: 'add' },
],
},
];
for (const {description, indexedKeyframes, sequencedKeyframes} of
gEquivalentSyntaxTests) {
- test(function(t) {
+ test(() => {
assertEquivalentKeyframeSyntax(indexedKeyframes, sequencedKeyframes);
}, `Equivalent property-indexed and sequenced keyframes: ${description}`);
}
// Test handling of custom iterable objects.
function createIterable(iterations) {
return {
@@ -231,17 +231,17 @@ test(() => {
{ offset: null, computedOffset: 0, easing: 'linear', left: '100px' },
{ offset: 0.75, computedOffset: 0.75, easing: 'linear', left: '250px' },
{ offset: null, computedOffset: 1, easing: 'linear', left: '200px' },
]);
}, 'Keyframes are read from a custom iterator with where an offset is'
+ ' specified');
test(() => {
- assert_throws({ name: 'TypeError' }, function() {
+ assert_throws({ name: 'TypeError' }, () => {
new KeyframeEffect(null, createIterable([
{ done: false, value: { left: '100px' } },
{ done: false, value: 1234 },
{ done: false, value: { left: '200px' } },
{ done: true },
]));
});
}, 'Reading from a custom iterator that returns a non-object keyframe'
@@ -252,17 +252,17 @@ test(() => {
{ done: false, value: { left: ['100px', '200px'] } },
{ done: true },
]));
assert_frame_lists_equal(effect.getKeyframes(), [
{ offset: null, computedOffset: 1, easing: 'linear' }
]);
}, 'A list of values returned from a custom iterator should be ignored');
-test(function(t) {
+test(() => {
const keyframe = {};
Object.defineProperty(keyframe, 'width', { value: '200px' });
Object.defineProperty(keyframe, 'height', {
value: '100px',
enumerable: true,
});
assert_equals(keyframe.width, '200px', 'width of keyframe is readable');
assert_equals(keyframe.height, '100px', 'height of keyframe is readable');
@@ -270,17 +270,17 @@ test(function(t) {
const effect = new KeyframeEffect(null, [keyframe, { height: '200px' }]);
assert_frame_lists_equal(effect.getKeyframes(), [
{ offset: null, computedOffset: 0, easing: 'linear', height: '100px' },
{ offset: null, computedOffset: 1, easing: 'linear', height: '200px' },
]);
}, 'Only enumerable properties on keyframes are read');
-test(function(t) {
+test(() => {
const KeyframeParent = function() { this.width = '100px'; };
KeyframeParent.prototype = { height: '100px' };
const Keyframe = function() { this.top = '100px'; };
Keyframe.prototype = Object.create(KeyframeParent.prototype);
Object.defineProperty(Keyframe.prototype, 'left', {
value: '100px',
enumerable: true,
});
@@ -289,33 +289,33 @@ test(function(t) {
const effect = new KeyframeEffect(null, [keyframe, { top: '200px' }]);
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 keyframes are read');
-test(function(t) {
+test(() => {
const keyframes = {};
Object.defineProperty(keyframes, 'width', ['100px', '200px']);
Object.defineProperty(keyframes, 'height', {
value: ['100px', '200px'],
enumerable: true,
});
const effect = new KeyframeEffect(null, keyframes);
assert_frame_lists_equal(effect.getKeyframes(), [
{ offset: null, computedOffset: 0, easing: 'linear', height: '100px' },
{ offset: null, computedOffset: 1, easing: 'linear', height: '200px' },
]);
}, 'Only enumerable properties on property-indexed keyframes are read');
-test(function(t) {
+test(() => {
const KeyframesParent = function() { this.width = '100px'; };
KeyframesParent.prototype = { height: '100px' };
const Keyframes = function() { this.top = ['100px', '200px']; };
Keyframes.prototype = Object.create(KeyframesParent.prototype);
Object.defineProperty(Keyframes.prototype, 'left', {
value: ['100px', '200px'],
enumerable: true,
});
@@ -324,28 +324,28 @@ test(function(t) {
const effect = new KeyframeEffect(null, keyframes);
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) {
+test(() => {
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(prop); return value; }
+ get: () => { 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');
--- a/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument-002.html
+++ b/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument-002.html
@@ -7,58 +7,58 @@
<script src="../../testcommon.js"></script>
<script src="../../resources/easing-tests.js"></script>
<body>
<div id="log"></div>
<div id="target"></div>
<script>
'use strict';
-test(function() {
+test(() => {
for (const [easing, expected] of gEasingParsingTests) {
const effect = new KeyframeEffect(target, {
left: ['10px', '20px'],
easing: easing
});
assert_equals(effect.getKeyframes()[0].easing, expected,
`resulting easing for '${easing}'`);
}
}, 'easing values are parsed correctly when set on a property-indexed'
+ ' keyframe');
-test(function() {
+test(() => {
for (const [easing, expected] of gEasingParsingTests) {
const effect = new KeyframeEffect(target, [
{ offset: 0, left: '10px', easing: easing },
{ offset: 1, left: '20px' }
]);
assert_equals(effect.getKeyframes()[0].easing, expected,
`resulting easing for '${easing}'`);
}
}, 'easing values are parsed correctly when using a keyframe sequence');
-test(function() {
+test(() => {
for (const invalidEasing of gInvalidEasings) {
assert_throws(new TypeError, () => {
new KeyframeEffect(target, { easing: invalidEasing });
}, `TypeError is thrown for easing '${invalidEasing}'`);
}
}, 'Invalid easing values are correctly rejected when set on a property-'
+ 'indexed keyframe');
-test(function() {
+test(() => {
for (const invalidEasing of gInvalidEasings) {
assert_throws(new TypeError, () => {
new KeyframeEffect(target, [{ easing: invalidEasing }]);
}, `TypeError is thrown for easing '${invalidEasing}'`);
}
}, 'Invalid easing values are correctly rejected when using a keyframe'
+ ' sequence');
-test(function(t) {
+test(() => {
let propAccessCount = 0;
const keyframe = {};
const addProp = prop => {
Object.defineProperty(keyframe, prop, {
get: () => { propAccessCount++; },
enumerable: true
});
}
@@ -68,17 +68,17 @@ test(function(t) {
assert_throws({ name: 'TypeError' }, () => {
new KeyframeEffect(target, keyframe);
});
assert_equals(propAccessCount, 2,
'All properties were read before throwing the easing error');
}, 'Errors from invalid easings on a property-indexed keyframe are thrown after reading all properties');
-test(function(t) {
+test(() => {
let propAccessCount = 0;
const addProp = (keyframe, prop) => {
Object.defineProperty(keyframe, prop, {
get: () => { propAccessCount++; },
enumerable: true
});
}