--- a/testing/web-platform/tests/web-animations/README.md
+++ b/testing/web-platform/tests/web-animations/README.md
@@ -46,34 +46,34 @@ Guidelines for writing tests
elsewhere other than waiting for the corresponding promise to
complete).
* Try to keep tests as simple and focused as possible.
e.g.
```javascript
- test(function(t) {
+ test(t => {
const animation = createDiv(t).animate(null);
assert_class_string(animation, 'Animation', 'Returned object is an Animation');
}, 'Element.animate() creates an Animation object');
```
```javascript
- test(function(t) {
- assert_throws({ name: 'TypeError' }, function() {
+ test(t => {
+ assert_throws({ name: 'TypeError' }, () => {
createDiv(t).animate(null, -1);
});
}, 'Setting a negative duration throws a TypeError');
```
```javascript
- promise_test(function(t) {
+ promise_test(t => {
const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
assert_greater_than(animation.startTime, 0, 'startTime when running');
});
}, 'startTime is resolved when running');
```
If you're generating complex test loops and factoring out utility functions
that affect the logic of the test (other than, say, simple assertion utility
functions), you're probably doing it wrong.
--- a/testing/web-platform/tests/web-animations/animation-model/animation-types/accumulation-per-property.html
+++ b/testing/web-platform/tests/web-animations/animation-model/animation-types/accumulation-per-property.html
@@ -19,32 +19,32 @@ html {
for (var property in gCSSProperties) {
if (!isSupported(property)) {
continue;
}
var animationTypes = gCSSProperties[property].types;
var setupFunction = gCSSProperties[property].setup;
- animationTypes.forEach(function(animationType) {
+ animationTypes.forEach(animationType => {
var typeObject;
var animationTypeString;
if (typeof animationType === 'string') {
typeObject = types[animationType];
animationTypeString = animationType;
} else if (typeof animationType === 'object' &&
animationType.type && typeof animationType.type === 'string') {
typeObject = types[animationType.type];
animationTypeString = animationType.type;
}
// First, test that the animation type object has 'testAccumulation'.
// We use test() function here so that we can continue the remainder tests
// even if this test fails.
- test(function(t) {
+ test(t => {
assert_own_property(typeObject, 'testAccumulation', animationTypeString +
' should have testAccumulation property');
assert_equals(typeof typeObject.testAccumulation, 'function',
'testAccumulation method should be a function');
}, property + ' (type: ' + animationTypeString +
') has testAccumulation function');
if (typeObject.testAccumulation &&
--- a/testing/web-platform/tests/web-animations/animation-model/animation-types/addition-per-property.html
+++ b/testing/web-platform/tests/web-animations/animation-model/animation-types/addition-per-property.html
@@ -19,32 +19,32 @@ html {
for (var property in gCSSProperties) {
if (!isSupported(property)) {
continue;
}
var animationTypes = gCSSProperties[property].types;
var setupFunction = gCSSProperties[property].setup;
- animationTypes.forEach(function(animationType) {
+ animationTypes.forEach(animationType => {
var typeObject;
var animationTypeString;
if (typeof animationType === 'string') {
typeObject = types[animationType];
animationTypeString = animationType;
} else if (typeof animationType === 'object' &&
animationType.type && typeof animationType.type === 'string') {
typeObject = types[animationType.type];
animationTypeString = animationType.type;
}
// First, test that the animation type object has 'testAddition'.
// We use test() function here so that we can continue the remainder tests
// even if this test fails.
- test(function(t) {
+ test(t => {
assert_own_property(typeObject, 'testAddition', animationTypeString +
' should have testAddition property');
assert_equals(typeof typeObject.testAddition, 'function',
'testAddition method should be a function');
}, property + ' (type: ' + animationTypeString +
') has testAddition function');
if (typeObject.testAddition &&
--- a/testing/web-platform/tests/web-animations/animation-model/animation-types/discrete.html
+++ b/testing/web-platform/tests/web-animations/animation-model/animation-types/discrete.html
@@ -5,17 +5,17 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ fontStyle: [ 'normal', 'italic' ] },
{ duration: 1000, fill: 'forwards' });
assert_equals(getComputedStyle(div).fontStyle, 'normal',
'Animation produces \'from\' value at start of interval');
anim.currentTime = anim.effect.getComputedTiming().duration / 2 - 1;
@@ -26,17 +26,17 @@ test(function(t) {
assert_equals(getComputedStyle(div).fontStyle, 'italic',
'Animation produces \'to\' value at exact middle of'
+ ' the interval');
anim.finish();
assert_equals(getComputedStyle(div).fontStyle, 'italic',
'Animation produces \'to\' value during forwards fill');
}, 'Test animating discrete values');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var originalHeight = getComputedStyle(div).height;
var anim = div.animate({ height: [ 'auto', '200px' ] },
{ duration: 1000, fill: 'forwards' });
assert_equals(getComputedStyle(div).height, originalHeight,
'Animation produces \'from\' value at start of interval');
@@ -48,17 +48,17 @@ test(function(t) {
assert_equals(getComputedStyle(div).height, '200px',
'Animation produces \'to\' value at exact middle of'
+ ' the interval');
anim.finish();
assert_equals(getComputedStyle(div).height, '200px',
'Animation produces \'to\' value during forwards fill');
}, 'Test discrete animation is used when interpolation fails');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var originalHeight = getComputedStyle(div).height;
var anim = div.animate({ height: [ 'auto',
'200px',
'300px',
'auto',
'400px' ] },
@@ -78,17 +78,17 @@ test(function(t) {
assert_equals(getComputedStyle(div).height, originalHeight,
'Third non-interpolable pair uses discrete interpolation');
anim.currentTime += 250;
assert_equals(getComputedStyle(div).height, '400px',
'Fourth non-interpolable pair uses discrete interpolation');
}, 'Test discrete animation is used only for pairs of values that cannot'
+ ' be interpolated');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var originalHeight = getComputedStyle(div).height;
// Easing: http://cubic-bezier.com/#.68,0,1,.01
// With this curve, we don't reach the 50% point until about 95% of
// the time has expired.
var anim = div.animate({ fontStyle: [ 'normal', 'italic' ] },
{ duration: 1000, fill: 'forwards',
@@ -102,17 +102,17 @@ test(function(t) {
+ ' time');
anim.currentTime = 960;
assert_equals(getComputedStyle(div).fontStyle, 'italic',
'Animation produces \'to\' value at 96% of the iteration'
+ ' time');
}, 'Test the 50% switch point for discrete animation is based on the'
+ ' effect easing');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var originalHeight = getComputedStyle(div).height;
// Easing: http://cubic-bezier.com/#.68,0,1,.01
// With this curve, we don't reach the 50% point until about 95% of
// the time has expired.
var anim = div.animate([ { fontStyle: 'normal',
easing: 'cubic-bezier(0.68,0,1,0.01)' },
--- a/testing/web-platform/tests/web-animations/animation-model/animation-types/interpolation-per-property.html
+++ b/testing/web-platform/tests/web-animations/animation-model/animation-types/interpolation-per-property.html
@@ -19,32 +19,32 @@ html {
for (var property in gCSSProperties) {
if (!isSupported(property)) {
continue;
}
var animationTypes = gCSSProperties[property].types;
var setupFunction = gCSSProperties[property].setup;
- animationTypes.forEach(function(animationType) {
+ animationTypes.forEach(animationType => {
var typeObject;
var animationTypeString;
if (typeof animationType === 'string') {
typeObject = types[animationType];
animationTypeString = animationType;
} else if (typeof animationType === 'object' &&
animationType.type && typeof animationType.type === 'string') {
typeObject = types[animationType.type];
animationTypeString = animationType.type;
}
// First, test that the animation type object has 'testInterpolation'.
// We use test() function() here so that we can continue the remainder tests
// even if this test fails.
- test(function(t) {
+ test(t => {
assert_own_property(typeObject, 'testInterpolation', animationTypeString +
' should have testInterpolation property');
assert_equals(typeof typeObject.testInterpolation, 'function',
'testInterpolation method should be a function');
}, property + ' (type: ' + animationTypeString +
') has testInterpolation function');
if (typeObject.testInterpolation &&
--- a/testing/web-platform/tests/web-animations/animation-model/animation-types/property-types.js
+++ b/testing/web-platform/tests/web-animations/animation-model/animation-types/property-types.js
@@ -1,43 +1,43 @@
const discreteType = {
- testInterpolation: function(property, setup, options) {
- options.forEach(function(keyframes) {
+ testInterpolation: (property, setup, options) => {
+ options.forEach(keyframes => {
var [ from, to ] = keyframes;
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: [from, to] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 0, expected: from.toLowerCase() },
{ time: 499, expected: from.toLowerCase() },
{ time: 500, expected: to.toLowerCase() },
{ time: 1000, expected: to.toLowerCase() }]);
}, property + ' uses discrete animation when animating between "'
+ from + '" and "' + to + '" with linear easing');
- test(function(t) {
+ test(t => {
// Easing: http://cubic-bezier.com/#.68,0,1,.01
// With this curve, we don't reach the 50% point until about 95% of
// the time has expired.
var idlName = propertyToIDL(property);
var keyframes = {};
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: [from, to] },
{ duration: 1000, fill: 'both',
easing: 'cubic-bezier(0.68,0,1,0.01)' });
testAnimationSamples(animation, idlName,
[{ time: 0, expected: from.toLowerCase() },
{ time: 940, expected: from.toLowerCase() },
{ time: 960, expected: to.toLowerCase() }]);
}, property + ' uses discrete animation when animating between "'
+ from + '" and "' + to + '" with effect easing');
- test(function(t) {
+ test(t => {
// Easing: http://cubic-bezier.com/#.68,0,1,.01
// With this curve, we don't reach the 50% point until about 95% of
// the time has expired.
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: [from, to],
easing: 'cubic-bezier(0.68,0,1,0.01)' },
{ duration: 1000, fill: 'both' });
@@ -45,30 +45,30 @@ const discreteType = {
[{ time: 0, expected: from.toLowerCase() },
{ time: 940, expected: from.toLowerCase() },
{ time: 960, expected: to.toLowerCase() }]);
}, property + ' uses discrete animation when animating between "'
+ from + '" and "' + to + '" with keyframe easing');
});
},
- testAdditionOrAccumulation: function(property, setup, options, composite) {
- options.forEach(function(keyframes) {
+ testAdditionOrAccumulation: (property, setup, options, composite) => {
+ options.forEach(keyframes => {
var [ from, to ] = keyframes;
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.animate({ [idlName]: [from, from] }, 1000);
var animation = target.animate({ [idlName]: [to, to] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName,
[{ time: 0, expected: to.toLowerCase() }]);
}, property + ': "' + to + '" onto "' + from + '"');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.animate({ [idlName]: [to, to] }, 1000);
var animation = target.animate({ [idlName]: [from, from] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName,
[{ time: 0, expected: from.toLowerCase() }]);
}, property + ': "' + from + '" onto "' + to + '"');
@@ -80,47 +80,47 @@ const discreteType = {
},
testAccumulation: function(property, setup, options) {
this.testAdditionOrAccumulation(property, setup, options, 'accumulate');
},
};
const lengthType = {
- testInterpolation: function(property, setup) {
- test(function(t) {
+ testInterpolation: (property, setup) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['10px', '50px'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 500, expected: '30px' }]);
}, property + ' supports animating as a length');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['1rem', '5rem'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 500, expected: '30px' }]);
}, property + ' supports animating as a length of rem');
},
- testAdditionOrAccumulation: function(property, setup, composite) {
- test(function(t) {
+ testAdditionOrAccumulation: (property, setup, composite) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = '10px';
var animation = target.animate({ [idlName]: ['10px', '50px'] },
{ duration: 1000, composite: composite});
testAnimationSamples(animation, idlName, [{ time: 0, expected: '20px' }]);
}, property + ': length');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = '1rem';
var animation = target.animate({ [idlName]: ['1rem', '5rem'] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName, [{ time: 0, expected: '20px' }]);
}, property + ': length of rem');
},
@@ -130,47 +130,47 @@ const lengthType = {
},
testAccumulation: function(property, setup) {
this.testAdditionOrAccumulation(property, setup, 'accumulate');
},
};
const lengthPairType = {
- testInterpolation: function(property, setup) {
- test(function(t) {
+ testInterpolation: (property, setup) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['10px 10px', '50px 50px'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 500, expected: '30px 30px' }]);
}, property + ' supports animating as a length pair');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['1rem 1rem', '5rem 5rem'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 500, expected: '30px 30px' }]);
}, property + ' supports animating as a length pair of rem');
},
- testAdditionOrAccumulation: function(property, setup, composite) {
- test(function(t) {
+ testAdditionOrAccumulation: (property, setup, composite) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = '10px 10px';
var animation = target.animate({ [idlName]: ['10px 10px', '50px 50px'] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName, [{ time: 0, expected: '20px 20px' }]);
}, property + ': length pair');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = '1rem 1rem';
var animation = target.animate({ [idlName]: ['1rem 1rem', '5rem 5rem'] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName, [{ time: 0, expected: '20px 20px' }]);
}, property + ': length pair of rem');
},
@@ -180,29 +180,29 @@ const lengthPairType = {
},
testAccumulation: function(property, setup) {
this.testAdditionOrAccumulation(property, setup, 'accumulate');
},
};
const percentageType = {
- testInterpolation: function(property, setup) {
- test(function(t) {
+ testInterpolation: (property, setup) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['10%', '50%'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 500, expected: '30%' }]);
}, property + ' supports animating as a percentage');
},
- testAdditionOrAccumulation: function(property, setup, composite) {
- test(function(t) {
+ testAdditionOrAccumulation: (property, setup, composite) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = '60%';
var animation = target.animate({ [idlName]: ['70%', '100%'] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName, [{ time: 0, expected: '130%' }]);
}, property + ': percentage');
},
@@ -212,29 +212,29 @@ const percentageType = {
},
testAccumulation: function(property, setup) {
this.testAdditionOrAccumulation(property, setup, 'accumulate');
},
};
const integerType = {
- testInterpolation: function(property, setup) {
- test(function(t) {
+ testInterpolation: (property, setup) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: [-2, 2] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 500, expected: '0' }]);
}, property + ' supports animating as an integer');
},
- testAdditionOrAccumulation: function(property, setup, composite) {
- test(function(t) {
+ testAdditionOrAccumulation: (property, setup, composite) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = -1;
var animation = target.animate({ [idlName]: [-2, 2] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName,
[{ time: 0, expected: '-3' }]);
}, property + ': integer');
@@ -245,29 +245,29 @@ const integerType = {
},
testAccumulation: function(property, setup) {
this.testAdditionOrAccumulation(property, setup, 'accumulate');
},
};
const positiveIntegerType = {
- testInterpolation: function(property, setup) {
- test(function(t) {
+ testInterpolation: (property, setup) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: [1, 3] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[ { time: 500, expected: '2' } ]);
}, property + ' supports animating as a positive integer');
},
- testAdditionOrAccumulation: function(property, setup, composite) {
- test(function(t) {
+ testAdditionOrAccumulation: (property, setup, composite) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 1;
var animation = target.animate({ [idlName]: [2, 5] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName,
[{ time: 0, expected: '3' }]);
}, property + ': positive integer');
@@ -278,142 +278,142 @@ const positiveIntegerType = {
},
testAccumulation: function(property, setup) {
this.testAdditionOrAccumulation(property, setup, 'accumulate');
},
};
const lengthPercentageOrCalcType = {
- testInterpolation: function(property, setup) {
+ testInterpolation: (property, setup) => {
lengthType.testInterpolation(property, setup);
percentageType.testInterpolation(property, setup);
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['10px', '20%'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 500, expected: 'calc(5px + 10%)' }]);
}, property + ' supports animating as combination units "px" and "%"');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['10%', '2em'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 500, expected: 'calc(10px + 5%)' }]);
}, property + ' supports animating as combination units "%" and "em"');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['1em', '2rem'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 500, expected: '15px' }]);
}, property + ' supports animating as combination units "em" and "rem"');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['10px', 'calc(1em + 20%)'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 500, expected: 'calc(10px + 10%)' }]);
}, property + ' supports animating as combination units "px" and "calc"');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate(
{ [idlName]: ['calc(10px + 10%)', 'calc(1em + 1rem + 20%)'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 500,
expected: 'calc(15px + 15%)' }]);
}, property + ' supports animating as a calc');
},
- testAdditionOrAccumulation: function(property, setup, composite) {
+ testAdditionOrAccumulation: (property, setup, composite) => {
lengthType.testAddition(property, setup);
percentageType.testAddition(property, setup);
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = '10px';
var animation = target.animate({ [idlName]: ['10%', '50%'] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName,
[{ time: 0, expected: 'calc(10px + 10%)' }]);
}, property + ': units "%" onto "px"');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = '10%';
var animation = target.animate({ [idlName]: ['10px', '50px'] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName,
[{ time: 0, expected: 'calc(10px + 10%)' }]);
}, property + ': units "px" onto "%"');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = '10%';
var animation = target.animate({ [idlName]: ['2rem', '5rem'] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName,
[{ time: 0, expected: 'calc(20px + 10%)' }]);
}, property + ': units "rem" onto "%"');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = '2rem';
var animation = target.animate({ [idlName]: ['10%', '50%'] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName,
[{ time: 0, expected: 'calc(20px + 10%)' }]);
}, property + ': units "%" onto "rem"');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = '2em';
var animation = target.animate({ [idlName]: ['2rem', '5rem'] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName, [{ time: 0, expected: '40px' }]);
}, property + ': units "rem" onto "em"');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = '2rem';
var animation = target.animate({ [idlName]: ['2em', '5em'] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName, [{ time: 0, expected: '40px' }]);
}, property + ': units "em" onto "rem"');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = '10px';
var animation = target.animate({ [idlName]: ['calc(2em + 20%)',
'calc(5rem + 50%)'] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName,
[{ time: 0, expected: 'calc(30px + 20%)' }]);
}, property + ': units "calc" onto "px"');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'calc(10px + 10%)';
var animation = target.animate({ [idlName]: ['calc(20px + 20%)',
'calc(2em + 3rem + 40%)'] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName,
[{ time: 0, expected: 'calc(30px + 30%)' }]);
@@ -425,29 +425,29 @@ const lengthPercentageOrCalcType = {
},
testAccumulation: function(property, setup) {
this.testAdditionOrAccumulation(property, setup, 'accumulate');
},
};
const positiveNumberType = {
- testInterpolation: function(property, setup) {
- test(function(t) {
+ testInterpolation: (property, setup) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: [1.1, 1.5] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 500, expected: '1.3' }]);
}, property + ' supports animating as a positive number');
},
- testAdditionOrAccumulation: function(property, setup, composite) {
- test(function(t) {
+ testAdditionOrAccumulation: (property, setup, composite) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 1.1;
var animation = target.animate({ [idlName]: [1.1, 1.5] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName, [{ time: 0, expected: '2.2' }]);
}, property + ': positive number');
},
@@ -458,38 +458,38 @@ const positiveNumberType = {
testAccumulation: function(property, setup) {
this.testAdditionOrAccumulation(property, setup, 'accumulate');
},
};
// Test using float values in the range [0, 1]
const opacityType = {
- testInterpolation: function(property, setup) {
- test(function(t) {
+ testInterpolation: (property, setup) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: [0.3, 0.8] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 500, expected: '0.55' }]);
}, property + ' supports animating as a [0, 1] number');
},
- testAdditionOrAccumulation: function(property, setup, composite) {
- test(function(t) {
+ testAdditionOrAccumulation: (property, setup, composite) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 0.3;
var animation = target.animate({ [idlName]: [0.3, 0.8] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName, [{ time: 0, expected: '0.6' }]);
}, property + ': [0, 1] number');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 0.8;
var animation = target.animate({ [idlName]: [0.3, 0.8] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName, [{ time: 0, expected: '1' }]);
}, property + ': [0, 1] number (clamped)');
},
@@ -499,55 +499,55 @@ const opacityType = {
},
testAccumulation: function(property, setup) {
this.testAdditionOrAccumulation(property, setup, 'accumulate');
},
};
const visibilityType = {
- testInterpolation: function(property, setup) {
- test(function(t) {
+ testInterpolation: (property, setup) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['visible', 'hidden'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 0, expected: 'visible' },
{ time: 999, expected: 'visible' },
{ time: 1000, expected: 'hidden' }]);
}, property + ' uses visibility animation when animating '
+ 'from "visible" to "hidden"');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['hidden', 'visible'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 0, expected: 'hidden' },
{ time: 1, expected: 'visible' },
{ time: 1000, expected: 'visible' }]);
}, property + ' uses visibility animation when animating '
+ 'from "hidden" to "visible"');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['hidden', 'collapse'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 0, expected: 'hidden' },
{ time: 499, expected: 'hidden' },
{ time: 500, expected: 'collapse' },
{ time: 1000, expected: 'collapse' }]);
}, property + ' uses visibility animation when animating '
+ 'from "hidden" to "collapse"');
- test(function(t) {
+ test(t => {
// Easing: http://cubic-bezier.com/#.68,-.55,.26,1.55
// With this curve, the value is less than 0 till about 34%
// also more than 1 since about 63%
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation =
target.animate({ [idlName]: ['visible', 'hidden'] },
{ duration: 1000, fill: 'both',
@@ -559,30 +559,30 @@ const visibilityType = {
{ time: 340, expected: 'visible' },
{ time: 620, expected: 'visible' },
{ time: 630, expected: 'hidden' },
{ time: 1000, expected: 'hidden' }]);
}, property + ' uses visibility animation when animating '
+ 'from "visible" to "hidden" with easeInOutBack easing');
},
- testAdditionOrAccumulation: function(property, setup, composite) {
- test(function(t) {
+ testAdditionOrAccumulation: (property, setup, composite) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'visible';
var animation = target.animate({ [idlName]: ['visible', 'hidden'] },
{ duration: 1000, fill: 'both',
composite: composite });
testAnimationSamples(animation, idlName,
[{ time: 0, expected: 'visible' },
{ time: 1000, expected: 'visible' }]);
}, property + ': onto "visible"');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'hidden';
var animation = target.animate({ [idlName]: ['hidden', 'visible'] },
{ duration: 1000, fill: 'both',
composite: composite });
testAnimationSamples(animation, idlName,
[{ time: 0, expected: 'hidden' },
@@ -595,138 +595,138 @@ const visibilityType = {
},
testAccumulation: function(property, setup) {
this.testAdditionOrAccumulation(property, setup, 'accumulate');
},
};
const colorType = {
- testInterpolation: function(property, setup) {
- test(function(t) {
+ testInterpolation: (property, setup) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['rgb(255, 0, 0)',
'rgb(0, 0, 255)'] },
1000);
testAnimationSamples(animation, idlName,
[{ time: 500, expected: 'rgb(128, 0, 128)' }]);
}, property + ' supports animating as color of rgb()');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['#ff0000', '#0000ff'] },
1000);
testAnimationSamples(animation, idlName,
[{ time: 500, expected: 'rgb(128, 0, 128)' }]);
}, property + ' supports animating as color of #RGB');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['hsl(0, 100%, 50%)',
'hsl(240, 100%, 50%)'] },
1000);
testAnimationSamples(animation, idlName,
[{ time: 500, expected: 'rgb(128, 0, 128)' }]);
}, property + ' supports animating as color of hsl()');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['#ff000066', '#0000ffcc'] },
1000);
// R: 255 * (0.4 * 0.5) / 0.6 = 85
// G: 255 * (0.8 * 0.5) / 0.6 = 170
testAnimationSamples(animation, idlName,
[{ time: 500, expected: 'rgba(85, 0, 170, 0.6)' }]);
}, property + ' supports animating as color of #RGBa');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['rgba(255, 0, 0, 0.4)',
'rgba(0, 0, 255, 0.8)'] },
1000);
testAnimationSamples(animation, idlName, // Same as above.
[{ time: 500, expected: 'rgba(85, 0, 170, 0.6)' }]);
}, property + ' supports animating as color of rgba()');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['hsla(0, 100%, 50%, 0.4)',
'hsla(240, 100%, 50%, 0.8)'] },
1000);
testAnimationSamples(animation, idlName, // Same as above.
[{ time: 500, expected: 'rgba(85, 0, 170, 0.6)' }]);
}, property + ' supports animating as color of hsla()');
},
- testAdditionOrAccumulation: function(property, setup, composite) {
- test(function(t) {
+ testAdditionOrAccumulation: (property, setup, composite) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'rgb(128, 128, 128)';
var animation = target.animate({ [idlName]: ['rgb(255, 0, 0)',
'rgb(0, 0, 255)'] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName,
[{ time: 0, expected: 'rgb(255, 128, 128)' },
// The value at 50% is interpolated
// from 'rgb(128+255, 128, 128)'
// to 'rgb(128, 128, 128+255)'.
{ time: 500, expected: 'rgb(255, 128, 255)' }]);
}, property + ' supports animating as color of rgb() with overflowed ' +
'from and to values');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'rgb(128, 128, 128)';
var animation = target.animate({ [idlName]: ['#ff0000', '#0000ff'] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName,
[{ time: 0, expected: 'rgb(255, 128, 128)' }]);
}, property + ' supports animating as color of #RGB');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'rgb(128, 128, 128)';
var animation = target.animate({ [idlName]: ['hsl(0, 100%, 50%)',
'hsl(240, 100%, 50%)'] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName,
[{ time: 0, expected: 'rgb(255, 128, 128)' }]);
}, property + ' supports animating as color of hsl()');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'rgb(128, 128, 128)';
var animation = target.animate({ [idlName]: ['#ff000066', '#0000ffcc'] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName,
[{ time: 0, expected: 'rgb(230, 128, 128)' }]);
}, property + ' supports animating as color of #RGBa');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'rgb(128, 128, 128)';
var animation = target.animate({ [idlName]: ['rgba(255, 0, 0, 0.4)',
'rgba(0, 0, 255, 0.8)'] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName, // Same as above.
[{ time: 0, expected: 'rgb(230, 128, 128)' }]);
}, property + ' supports animating as color of rgba()');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'rgb(128, 128, 128)';
var animation = target.animate({ [idlName]: ['hsla(0, 100%, 50%, 0.4)',
'hsla(240, 100%, 50%, 0.8)'] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName, // Same as above.
[{ time: 0, expected: 'rgb(230, 128, 128)' }]);
@@ -738,222 +738,222 @@ const colorType = {
},
testAccumulation: function(property, setup) {
this.testAdditionOrAccumulation(property, setup, 'accumulate');
},
};
const transformListType = {
- testInterpolation: function(property, setup) {
- test(function(t) {
+ testInterpolation: (property, setup) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['translate(200px, -200px)',
'translate(400px, 400px)'] },
1000);
testAnimationSampleMatrices(animation, idlName,
[{ time: 500, expected: [ 1, 0, 0, 1, 300, 100 ] }]);
}, property + ': translate');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['rotate(45deg)',
'rotate(135deg)'] },
1000);
testAnimationSampleMatrices(animation, idlName,
[{ time: 500, expected: [ Math.cos(Math.PI / 2),
Math.sin(Math.PI / 2),
-Math.sin(Math.PI / 2),
Math.cos(Math.PI / 2),
0, 0] }]);
}, property + ': rotate');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['scale(3)', 'scale(5)'] },
1000);
testAnimationSampleMatrices(animation, idlName,
[{ time: 500, expected: [ 4, 0, 0, 4, 0, 0 ] }]);
}, property + ': scale');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['skew(30deg, 60deg)',
'skew(60deg, 30deg)'] },
1000);
testAnimationSampleMatrices(animation, idlName,
[{ time: 500, expected: [ 1, Math.tan(Math.PI / 4),
Math.tan(Math.PI / 4), 1,
0, 0] }]);
}, property + ': skew');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation =
target.animate({ [idlName]: ['translateX(100px) rotate(45deg)',
'translateX(200px) rotate(135deg)'] },
1000);
testAnimationSampleMatrices(animation, idlName,
[{ time: 500, expected: [ Math.cos(Math.PI / 2),
Math.sin(Math.PI / 2),
-Math.sin(Math.PI / 2),
Math.cos(Math.PI / 2),
150, 0 ] }]);
}, property + ': rotate and translate');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation =
target.animate({ [idlName]: ['rotate(45deg) translateX(100px)',
'rotate(135deg) translateX(200px)'] },
1000);
testAnimationSampleMatrices(animation, idlName,
[{ time: 500, expected: [ Math.cos(Math.PI / 2),
Math.sin(Math.PI / 2),
-Math.sin(Math.PI / 2),
Math.cos(Math.PI / 2),
150 * Math.cos(Math.PI / 2),
150 * Math.sin(Math.PI / 2) ] }]);
}, property + ': translate and rotate');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = // matrix(0, 1, -1, 0, 0, 100)
target.animate({ [idlName]: ['rotate(90deg) translateX(100px)',
// matrix(-1, 0, 0, -1, 200, 0)
'translateX(200px) rotate(180deg)'] },
1000);
testAnimationSampleMatrices(animation, idlName,
[{ time: 500, expected: [ Math.cos(Math.PI * 3 / 4),
Math.sin(Math.PI * 3 / 4),
-Math.sin(Math.PI * 3 / 4),
Math.cos(Math.PI * 3 / 4),
100, 50 ] }]);
}, property + ': mismatch order of translate and rotate');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = // Same matrices as above.
target.animate({ [idlName]: [ 'matrix(0, 1, -1, 0, 0, 100)',
'matrix(-1, 0, 0, -1, 200, 0)' ] },
1000);
testAnimationSampleMatrices(animation, idlName,
[{ time: 500, expected: [ Math.cos(Math.PI * 3 / 4),
Math.sin(Math.PI * 3 / 4),
-Math.sin(Math.PI * 3 / 4),
Math.cos(Math.PI * 3 / 4),
100, 50 ] }]);
}, property + ': matrix');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation =
target.animate({ [idlName]: [ 'rotate3d(1, 1, 0, 0deg)',
'rotate3d(1, 1, 0, 90deg)'] },
1000);
testAnimationSampleMatrices(animation, idlName,
[{ time: 500, expected: rotate3dToMatrix(1, 1, 0, Math.PI / 4) }]);
}, property + ': rotate3d');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
// To calculate expected matrices easily, generate input matrices from
// rotate3d.
var from = rotate3dToMatrix3d(1, 1, 0, Math.PI / 4);
var to = rotate3dToMatrix3d(1, 1, 0, Math.PI * 3 / 4);
var animation =
target.animate({ [idlName]: [ from, to ] }, 1000);
testAnimationSampleMatrices(animation, idlName,
[{ time: 500, expected: rotate3dToMatrix(1, 1, 0, Math.PI * 2 / 4) }]);
}, property + ': matrix3d');
// This test aims for forcing the two mismatched transforms to be
// decomposed into matrix3d before interpolation. Therefore, we not only
// test the interpolation, but also test the 3D matrix decomposition.
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation =
target.animate({ [idlName]: ['scale(0.3)',
// scale(0.5) translateZ(1px)
'matrix3d(0.5, 0, 0, 0, 0, 0.5, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1)'] },
1000);
testAnimationSampleMatrices(animation, idlName,
[{ time: 500, expected: [ 0.4, 0, 0, 0,
0, 0.4, 0, 0,
0, 0, 1, 0,
0, 0, 0.5, 1] }]);
}, property + ': mismatched 3D transforms');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation =
target.animate({ [idlName]: ['rotateY(60deg)', 'none' ] }, 1000);
testAnimationSampleMatrices(animation, idlName,
// rotateY(30deg) == rotate3D(0, 1, 0, 30deg)
[{ time: 500, expected: rotate3dToMatrix(0, 1, 0, Math.PI / 6) }]);
}, property + ': rotateY');
// Following tests aim for test the fallback discrete interpolation behavior
// for non-invertible matrices. The non-invertible matrix that we use is the
- // singuler matrix, matrix(1, 1, 0, 0, 0, 100).
- test(function(t) {
+ // singular matrix, matrix(1, 1, 0, 0, 0, 100).
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation =
target.animate({ [idlName]: ['matrix(-1, 0, 0, -1, 200, 0)',
'matrix( 1, 1, 0, 0, 0, 100)'] },
{ duration: 1000, fill: 'both' });
testAnimationSampleMatrices(animation, idlName,
[ { time: 0, expected: [ -1, 0, 0, -1, 200, 0 ] },
{ time: 499, expected: [ -1, 0, 0, -1, 200, 0 ] },
{ time: 500, expected: [ 1, 1, 0, 0, 0, 100 ] },
{ time: 1000, expected: [ 1, 1, 0, 0, 0, 100 ] }]);
}, property + ': non-invertible matrices');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = // matrix(0, -1, 1, 0, 250, 0)
target.animate({ [idlName]: ['translate(50px) matrix(-1, 0, 0, -1, 200, 0) rotate(90deg)',
// matrix(-1, -1, 0, 0, 100, 100)
'translate(100px) matrix( 1, 1, 0, 0, 0, 100) rotate(180deg)'] },
{ duration: 1000, fill: 'both' });
testAnimationSampleMatrices(animation, idlName,
[ { time: 0, expected: [ 0, -1, 1, 0, 250, 0 ] },
{ time: 499, expected: [ 0, -1, 1, 0, 250, 0 ] },
{ time: 500, expected: [ -1, -1, 0, 0, 100, 100 ] },
{ time: 1000, expected: [ -1, -1, 0, 0, 100, 100 ] }]);
}, property + ': non-invertible matrices in matched transform lists');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = // matrix(-2, 0, 0, -2, 250, 0)
target.animate({ [idlName]: ['translate(50px) matrix(-1, 0, 0, -1, 200, 0) scale(2)',
// matrix(1, 1, 1, 1, 100, 100)
'translate(100px) matrix( 1, 1, 0, 0, 0, 100) skew(45deg)'] },
{ duration: 1000, fill: 'both' });
@@ -961,30 +961,30 @@ const transformListType = {
[ { time: 0, expected: [ -2, 0, 0, -2, 250, 0 ] },
{ time: 499, expected: [ -2, 0, 0, -2, 250, 0 ] },
{ time: 500, expected: [ 1, 1, 1, 1, 100, 100 ] },
{ time: 1000, expected: [ 1, 1, 1, 1, 100, 100 ] }]);
}, property + ': non-invertible matrices in mismatched transform lists');
},
testAddition: function(property, setup) {
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'translateX(100px)';
var animation = target.animate({ [idlName]: ['translateX(-200px)',
'translateX(500px)'] },
{ duration: 1000, fill: 'both',
composite: 'add' });
testAnimationSampleMatrices(animation, idlName,
[ { time: 0, expected: [ 1, 0, 0, 1, -100, 0 ] },
{ time: 1000, expected: [ 1, 0, 0, 1, 600, 0 ] }]);
}, property + ': translate');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'rotate(45deg)';
var animation = target.animate({ [idlName]: ['rotate(-90deg)',
'rotate(90deg)'] },
{ duration: 1000, fill: 'both',
composite: 'add' });
@@ -996,30 +996,30 @@ const transformListType = {
0, 0] },
{ time: 1000, expected: [ Math.cos(Math.PI * 3 / 4),
Math.sin(Math.PI * 3 / 4),
-Math.sin(Math.PI * 3 / 4),
Math.cos(Math.PI * 3 / 4),
0, 0] }]);
}, property + ': rotate');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'scale(2)';
var animation = target.animate({ [idlName]: ['scale(-3)', 'scale(5)'] },
{ duration: 1000, fill: 'both',
composite: 'add' });
testAnimationSampleMatrices(animation, idlName,
[{ time: 0, expected: [ -6, 0, 0, -6, 0, 0 ] }, // scale(-3) scale(2)
{ time: 1000, expected: [ 10, 0, 0, 10, 0, 0 ] }]); // scale(5) scale(2)
}, property + ': scale');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
// matrix(1, tan(10deg), tan(10deg), 1)
target.style[idlName] = 'skew(10deg, 10deg)';
var animation = // matrix(1, tan(20deg), tan(-30deg), 1)
target.animate({ [idlName]: ['skew(-30deg, 20deg)',
// matrix(1, tan(-30deg), tan(20deg), 1)
'skew(20deg, -30deg)'] },
@@ -1047,77 +1047,77 @@ const transformListType = {
0, 0] },
{ time: 1000, expected: [ 1 + Math.tan(Math.PI/18) * Math.tan(-Math.PI/6),
Math.tan(Math.PI/18) + Math.tan(-Math.PI/6),
Math.tan(Math.PI/9) + Math.tan(Math.PI/18),
1 + Math.tan(Math.PI/18) * Math.tan(Math.PI/9),
0, 0] }]);
}, property + ': skew');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
// matrix(1, 0, 0, 1, 100, 0)
target.style[idlName] = 'translateX(100px)';
var animation = // matrix(0, 1, -1, 0, 0, 0)
target.animate({ [idlName]: ['rotate(90deg)',
// matrix(-1, 0, 0, -1, 0, 0)
'rotate(180deg)'] },
{ duration: 1000, fill: 'both', composite: 'add' });
testAnimationSampleMatrices(animation, idlName,
[{ time: 0, expected: [ 0, 1, -1, 0, 100, 0 ] },
{ time: 1000, expected: [ -1, 0, 0, -1, 100, 0 ] }]);
}, property + ': rotate on translate');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
// matrix(0, 1, -1, 0, 0, 0)
target.style[idlName] = 'rotate(90deg)';
var animation = // matrix(1, 0, 0, 1, 100, 0)
target.animate({ [idlName]: ['translateX(100px)',
// matrix(1, 0, 0, 1, 200, 0)
'translateX(200px)'] },
{ duration: 1000, fill: 'both', composite: 'add' });
testAnimationSampleMatrices(animation, idlName,
[{ time: 0, expected: [ 0, 1, -1, 0, 0, 100 ] },
{ time: 1000, expected: [ 0, 1, -1, 0, 0, 200 ] }]);
}, property + ': translate on rotate');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'matrix(0, 1, -1, 0, 0, 0)';
var animation = // Same matrices as above.
target.animate({ [idlName]: [ 'matrix(1, 0, 0, 1, 100, 0)',
'matrix(1, 0, 0, 1, 200, 0)' ] },
{ duration: 1000, fill: 'both', composite: 'add' });
testAnimationSampleMatrices(animation, idlName,
[{ time: 0, expected: [ 0, 1, -1, 0, 0, 100 ] },
{ time: 1000, expected: [ 0, 1, -1, 0, 0, 200 ] }]);
}, property + ': matrix');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'rotate3d(1, 1, 0, 45deg)';
var animation =
target.animate({ [idlName]: [ 'rotate3d(1, 1, 0, -90deg)',
'rotate3d(1, 1, 0, 90deg)'] },
{ duration: 1000, fill: 'both', composite: 'add' });
testAnimationSampleMatrices(animation, idlName,
[{ time: 0, expected: rotate3dToMatrix(1, 1, 0, -Math.PI / 4) },
{ time: 1000, expected: rotate3dToMatrix(1, 1, 0, 3 * Math.PI / 4) }]);
}, property + ': rotate3d');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
// To calculate expected matrices easily, generate input matrices from
// rotate3d.
target.style[idlName] = rotate3dToMatrix3d(1, 1, 0, Math.PI / 4);
var from = rotate3dToMatrix3d(1, 1, 0, -Math.PI / 2);
var to = rotate3dToMatrix3d(1, 1, 0, Math.PI / 2);
var animation =
@@ -1128,77 +1128,77 @@ const transformListType = {
[{ time: 0, expected: rotate3dToMatrix(1, 1, 0, -Math.PI / 4) },
{ time: 1000, expected: rotate3dToMatrix(1, 1, 0, 3 * Math.PI / 4) }]);
}, property + ': matrix3d');
// Following tests aim for test the addition behavior for non-invertible
// matrices. Note that the addition for non-invertible matrices should be
// the same, just like addition for invertible matrices. With these tests,
// we can assure that addition never behaves as discrete. The non-invertible
- // matrix that we use is the singuler matrix, matrix(1, 1, 0, 0, 0, 100).
- test(function(t) {
+ // matrix that we use is the singular matrix, matrix(1, 1, 0, 0, 0, 100).
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'translateX(50px)';
var animation =
target.animate({ [idlName]: ['matrix(-1, 0, 0, -1, 200, 0)',
'matrix( 1, 1, 0, 0, 0, 100)'] },
{ duration: 1000, fill: 'both', composite: 'add' });
testAnimationSampleMatrices(animation, idlName,
[ { time: 0, expected: [ -1, 0, 0, -1, 250, 0 ] },
{ time: 1000, expected: [ 1, 1, 0, 0, 50, 100 ] }]);
}, property + ': non-invertible matrices');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'translateX(50px)';
var animation = // matrix(0, -1, 1, 0, 200, 0)
target.animate({ [idlName]: ['matrix(-1, 0, 0, -1, 200, 0) rotate(90deg)',
// matrix(-1, -1, 0, 0, 0, 100)
'matrix( 1, 1, 0, 0, 0, 100) rotate(180deg)'] },
{ duration: 1000, fill: 'both', composite: 'add' });
testAnimationSampleMatrices(animation, idlName,
[ { time: 0, expected: [ 0, -1, 1, 0, 250, 0 ] },
{ time: 1000, expected: [ -1, -1, 0, 0, 50, 100 ] }]);
}, property + ': non-invertible matrices in matched transform lists');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'translateX(50px)';
var animation = // matrix(-2, 0, 0, -2, 200, 0)
target.animate({ [idlName]: ['matrix(-1, 0, 0, -1, 200, 0) scale(2)',
// matrix(1, 1, 1, 1, 0, 100)
'matrix( 1, 1, 0, 0, 0, 100) skew(45deg)'] },
{ duration: 1000, fill: 'both', composite: 'add' });
testAnimationSampleMatrices(animation, idlName,
[ { time: 0, expected: [ -2, 0, 0, -2, 250, 0 ] },
{ time: 1000, expected: [ 1, 1, 1, 1, 50, 100 ] }]);
}, property + ': non-invertible matrices in mismatched transform lists');
},
testAccumulation: function(property, setup) {
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'translateX(100px)';
var animation = target.animate({ [idlName]: ['translateX(-200px)',
'translateX(500px)'] },
{ duration: 1000, fill: 'both',
composite: 'accumulate' });
testAnimationSampleMatrices(animation, idlName,
[ { time: 0, expected: [ 1, 0, 0, 1, -100, 0 ] },
{ time: 1000, expected: [ 1, 0, 0, 1, 600, 0 ] }]);
}, property + ': translate');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'rotate(45deg)';
var animation = target.animate({ [idlName]: ['rotate(-90deg)',
'rotate(90deg)'] },
{ duration: 1000, fill: 'both',
composite: 'accumulate' });
@@ -1210,32 +1210,32 @@ const transformListType = {
0, 0] },
{ time: 1000, expected: [ Math.cos(Math.PI * 3 / 4),
Math.sin(Math.PI * 3 / 4),
-Math.sin(Math.PI * 3 / 4),
Math.cos(Math.PI * 3 / 4),
0, 0] }]);
}, property + ': rotate');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'scale(2)';
var animation = target.animate({ [idlName]: ['scale(-3)', 'scale(5)'] },
{ duration: 1000, fill: 'both',
composite: 'accumulate' });
testAnimationSampleMatrices(animation, idlName,
// scale((2 - 1) + (-3 - 1) + 1)
[{ time: 0, expected: [ -2, 0, 0, -2, 0, 0 ] },
// scale((2 - 1) + (5 - 1) + 1)
{ time: 1000, expected: [ 6, 0, 0, 6, 0, 0 ] }]);
}, property + ': scale');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
// matrix(1, tan(10deg), tan(10deg), 1)
target.style[idlName] = 'skew(10deg, 10deg)';
var animation = // matrix(1, tan(20deg), tan(-30deg), 1)
target.animate({ [idlName]: ['skew(-30deg, 20deg)',
// matrix(1, tan(-30deg), tan(20deg), 1)
'skew(20deg, -30deg)'] },
@@ -1245,94 +1245,94 @@ const transformListType = {
[{ time: 0, expected: [ 1, Math.tan(Math.PI/6),
Math.tan(-Math.PI/9), 1,
0, 0] },
{ time: 1000, expected: [ 1, Math.tan(-Math.PI/9),
Math.tan(Math.PI/6), 1,
0, 0] }]);
}, property + ': skew');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
// matrix(1, 0, 0, 1, 100, 0)
target.style[idlName] = 'translateX(100px)';
var animation = // matrix(0, 1, -1, 0, 0, 0)
target.animate({ [idlName]: ['rotate(90deg)',
// matrix(-1, 0, 0, -1, 0, 0)
'rotate(180deg)'] },
{ duration: 1000, fill: 'both', composite: 'accumulate' });
testAnimationSampleMatrices(animation, idlName,
[{ time: 0, expected: [ 0, 1, -1, 0, 100, 0 ] },
{ time: 1000, expected: [ -1, 0, 0, -1, 100, 0 ] }]);
}, property + ': rotate on translate');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
// matrix(0, 1, -1, 0, 0, 0)
target.style[idlName] = 'rotate(90deg)';
var animation = // matrix(1, 0, 0, 1, 100, 0)
target.animate({ [idlName]: ['translateX(100px)',
// matrix(1, 0, 0, 1, 200, 0)
'translateX(200px)'] },
{ duration: 1000, fill: 'both', composite: 'accumulate' });
testAnimationSampleMatrices(animation, idlName,
[{ time: 0, expected: [ 0, 1, -1, 0, 100, 0 ] },
{ time: 1000, expected: [ 0, 1, -1, 0, 200, 0 ] }]);
}, property + ': translate on rotate');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'matrix(0, 1, -1, 0, 0, 0)';
var animation = // Same matrices as above.
target.animate({ [idlName]: [ 'matrix(1, 0, 0, 1, 100, 0)',
'matrix(1, 0, 0, 1, 200, 0)' ] },
{ duration: 1000, fill: 'both', composite: 'accumulate' });
testAnimationSampleMatrices(animation, idlName,
[{ time: 0, expected: [ 0, 1, -1, 0, 100, 0 ] },
{ time: 1000, expected: [ 0, 1, -1, 0, 200, 0 ] }]);
}, property + ': matrix');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'rotate3d(1, 1, 0, 45deg)';
var animation =
target.animate({ [idlName]: [ 'rotate3d(1, 1, 0, -90deg)',
'rotate3d(1, 1, 0, 90deg)'] },
{ duration: 1000, fill: 'both', composite: 'accumulate' });
testAnimationSampleMatrices(animation, idlName,
[{ time: 0, expected: rotate3dToMatrix(1, 1, 0, -Math.PI / 4) },
{ time: 1000, expected: rotate3dToMatrix(1, 1, 0, 3 * Math.PI / 4) }]);
}, property + ': rotate3d');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
// To calculate expected matrices easily, generate input matrices from
// rotate3d.
target.style[idlName] = rotate3dToMatrix3d(1, 1, 0, Math.PI / 4);
var from = rotate3dToMatrix3d(1, 1, 0, -Math.PI / 2);
var to = rotate3dToMatrix3d(1, 1, 0, Math.PI / 2);
var animation =
target.animate({ [idlName]: [ from, to ] },
{ duration: 1000, fill: 'both', composite: 'accumulate' });
testAnimationSampleMatrices(animation, idlName,
[{ time: 0, expected: rotate3dToMatrix(1, 1, 0, -Math.PI / 4) },
{ time: 1000, expected: rotate3dToMatrix(1, 1, 0, 3 * Math.PI / 4) }]);
}, property + ': matrix3d');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var matrixArray = [ 1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 1, 1 ];
target.style[idlName] = createMatrixFromArray(matrixArray);
@@ -1342,85 +1342,85 @@ const transformListType = {
testAnimationSampleMatrices(animation, idlName,
[{ time: 0, expected: matrixArray },
{ time: 1000, expected: matrixArray }]);
}, property + ': none');
// Following tests aim for test the fallback discrete accumulation behavior
// for non-invertible matrices. The non-invertible matrix that we use is the
- // singuler matrix, matrix(1, 1, 0, 0, 0, 100).
- test(function(t) {
+ // singular matrix, matrix(1, 1, 0, 0, 0, 100).
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.animate({ [idlName]: ['matrix(-1, 0, 0, -1, 200, 0)',
'matrix(-1, 0, 0, -1, 200, 0)'] }, 1000);
var animation = target.animate({ [idlName]: ['matrix( 1, 1, 0, 0, 0, 100)',
'matrix( 1, 1, 0, 0, 0, 100)'] },
{ duration: 1000, composite: 'accumulate' });
testAnimationSampleMatrices(animation, idlName,
[{ time: 0, expected: [ 1, 1, 0, 0, 0, 100 ] }]);
}, property + ': non-invertible matrices (non-invertible onto invertible)');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.animate({ [idlName]: ['matrix( 1, 1, 0, 0, 0, 100)',
'matrix( 1, 1, 0, 0, 0, 100)'] }, 1000);
var animation = target.animate({ [idlName]: ['matrix(-1, 0, 0, -1, 200, 0)',
'matrix(-1, 0, 0, -1, 200, 0)'] },
{ duration: 1000, composite: 'accumulate' });
testAnimationSampleMatrices(animation, idlName,
[{ time: 0, expected: [ -1, 0, 0, -1, 200, 0 ] }]);
}, property + ': non-invertible matrices (invertible onto non-invertible)');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
// matrix(0, -1, 1, 0, 250, 0)
target.animate({ [idlName]: ['translate(50px) matrix(-1, 0, 0, -1, 200, 0) rotate(90deg)',
'translate(50px) matrix(-1, 0, 0, -1, 200, 0) rotate(90deg)'] }, 1000);
var animation = // matrix(-1, -1, 0, 0, 100, 100)
target.animate({ [idlName]: ['translate(100px) matrix( 1, 1, 0, 0, 0, 100) rotate(180deg)',
'translate(100px) matrix( 1, 1, 0, 0, 0, 100) rotate(180deg)'] },
{ duration: 1000, composite: 'accumulate' });
testAnimationSampleMatrices(animation, idlName,
[{ time: 0, expected: [ -1, -1, 0, 0, 100, 100 ] }]);
}, property + ': non-invertible matrices in matched transform lists (non-invertible onto invertible)');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
// matrix(-1, -1, 0, 0, 100, 100)
target.animate({ [idlName]: ['translate(100px) matrix(1, 1, 0, 0, 0, 100) rotate(180deg)',
'translate(100px) matrix(1, 1, 0, 0, 0, 100) rotate(180deg)'] }, 1000);
var animation = // matrix(0, -1, 1, 0, 250, 0)
target.animate({ [idlName]: ['translate(50px) matrix(-1, 0, 0, -1, 200, 0) rotate(90deg)',
'translate(50px) matrix(-1, 0, 0, -1, 200, 0) rotate(90deg)'] },
{ duration: 1000, composite: 'accumulate' });
testAnimationSampleMatrices(animation, idlName,
[{ time: 0, expected: [ 0, -1, 1, 0, 250, 0 ] }]);
}, property + ': non-invertible matrices in matched transform lists (invertible onto non-invertible)');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
// matrix(-2, 0, 0, -2, 250, 0)
target.animate({ [idlName]: ['translate(50px) matrix(-1, 0, 0, -1, 200, 0) scale(2)',
'translate(50px) matrix(-1, 0, 0, -1, 200, 0) scale(2)'] }, 1000);
var animation = // matrix(1, 1, 1, 1, 100, 100)
target.animate({ [idlName]: ['translate(100px) matrix(1, 1, 0, 0, 0, 100) skew(45deg)',
'translate(100px) matrix(1, 1, 0, 0, 0, 100) skew(45deg)'] },
{ duration: 1000, composite: 'accumulate' });
testAnimationSampleMatrices(animation, idlName,
[{ time: 0, expected: [ 1, 1, 1, 1, 100, 100 ] }]);
}, property + ': non-invertible matrices in mismatched transform lists' +
' (non-invertible onto invertible)');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
// matrix(1, 1, 1, 1, 100, 100)
target.animate({ [idlName]: ['translate(100px) matrix(1, 1, 0, 0, 0, 100) skew(45deg)',
'translate(100px) matrix(1, 1, 0, 0, 0, 100) skew(45deg)'] }, 1000);
var animation = // matrix(-2, 0, 0, -2, 250, 0)
target.animate({ [idlName]: ['translate(50px) matrix(-1, 0, 0, -1, 200, 0) scale(2)',
'translate(50px) matrix(-1, 0, 0, -1, 200, 0) scale(2)'] },
@@ -1428,67 +1428,67 @@ const transformListType = {
testAnimationSampleMatrices(animation, idlName,
[{ time: 0, expected: [ -2, 0, 0, -2, 250, 0 ] }]);
}, property + ': non-invertible matrices in mismatched transform lists' +
' (invertible onto non-invertible)');
},
};
const filterListType = {
- testInterpolation: function(property, setup) {
- test(function(t) {
+ testInterpolation: (property, setup) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]:
['blur(10px)', 'blur(50px)'] },
1000);
testAnimationSamples(animation, idlName,
[{ time: 500, expected: 'blur(30px)' }]);
}, property + ': blur function' );
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['hue-rotate(0deg)',
'hue-rotate(100deg)'] },
1000);
testAnimationSamples(animation, idlName,
[{ time: 500, expected: 'hue-rotate(50deg)' }]);
}, property + ': hue-rotate function with same unit(deg)' );
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['hue-rotate(10deg)',
'hue-rotate(100rad)'] },
1000);
// 10deg = 0.1745rad.
testAnimationSamples(animation, idlName,
[{ time: 500, expected: 'hue-rotate(50.0873rad)' }]);
}, property + ': hue-rotate function with different unit(deg -> rad)');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate(
{ [idlName]:
['drop-shadow(10px 10px 10px rgba(255, 0, 0, 0.4))',
'drop-shadow(50px 50px 50px rgba(0, 0, 255, 0.8))'] },
1000);
testAnimationSamples(
animation, idlName,
[{ time: 500,
expected: 'drop-shadow(rgba(85, 0, 170, 0.6) 30px 30px 30px)' }]);
}, property + ': drop-shadow function' );
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate(
{ [idlName]:
['brightness(0.1) contrast(0.1) grayscale(0.1) invert(0.1) ' +
'opacity(0.1) saturate(0.1) sepia(0.1)',
'brightness(0.5) contrast(0.5) grayscale(0.5) invert(0.5) ' +
'opacity(0.5) saturate(0.5) sepia(0.5)'] },
@@ -1496,17 +1496,17 @@ const filterListType = {
testAnimationSamples(animation, idlName,
[{ time: 500,
expected: 'brightness(0.3) contrast(0.3) grayscale(0.3) ' +
'invert(0.3) opacity(0.3) saturate(0.3) sepia(0.3)' }]);
}, property + ': percentage or numeric-specifiable functions' +
'(number value)');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate(
{ [idlName]:
['brightness(10%) contrast(10%) grayscale(10%) invert(10%) ' +
'opacity(10%) saturate(10%) sepia(10%)',
'brightness(50%) contrast(50%) grayscale(50%) invert(50%) ' +
'opacity(50%) saturate(50%) sepia(50%)'] },
@@ -1514,51 +1514,51 @@ const filterListType = {
testAnimationSamples(animation, idlName,
[{ time: 500,
expected: 'brightness(0.3) contrast(0.3) grayscale(0.3) ' +
'invert(0.3) opacity(0.3) saturate(0.3) sepia(0.3)' }]);
}, property + ': percentage or numeric-specifiable functions' +
'(percentage value)');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate(
{ [idlName]:
// To make missing filter-function-lists, specified the grayscale.
['grayscale(0)',
'grayscale(1) brightness(0) contrast(0) opacity(0) saturate(0)' ]},
1000);
testAnimationSamples(animation, idlName,
[{ time: 500,
expected: 'grayscale(0.5) brightness(0.5) contrast(0.5) ' +
'opacity(0.5) saturate(0.5)' }]);
}, property + ': interpolate different length of filter-function-list ' +
' with function which lacuna value is 1');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate(
{ [idlName]:
// To make missing filter-function-lists, specified the opacity.
['opoacity(1)',
'opacity(0) grayscale(1) invert(1) sepia(1) blur(10px)'] },
1000);
testAnimationSamples(animation, idlName,
[{ time: 500,
expected:
'opacity(0.5) grayscale(0.5) invert(0.5) sepia(0.5) blur(5px)' }]);
}, property + ': interpolate different length of filter-function-list ' +
' with function which lacuna value is 0');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style.color = "rgba(255, 0, 0, 0.4)";
var animation = target.animate(
{ [idlName]:
['blur(0px)',
'blur(10px) drop-shadow(10px 10px 10px rgba(0, 0, 255, 0.8))'] },
1000);
@@ -1566,353 +1566,353 @@ const filterListType = {
testAnimationSamples(animation, idlName,
[{ time: 500,
// The lacuna value of drop-shadow's color is taken from
// the color property.
expected: 'blur(5px) drop-shadow(rgba(85, 0, 170, 0.6) 5px 5px 5px' }]);
}, property + ': interpolate different length of filter-function-list ' +
'with drop-shadow function');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['none', 'blur(10px)'] },
1000);
testAnimationSamples(animation, idlName,
[{ time: 500, expected: 'blur(5px)' }]);
}, property + ': interpolate from none');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate(
{ [idlName]:
['blur(0px) url(\"#f1\")',
'blur(10px) url(\"#f2\")']},
1000);
testAnimationSamples(animation, idlName,
[{ time: 499, expected: 'blur(0px) url(\"#f1\")' },
{ time: 500, expected: 'blur(10px) url(\"#f2\")' }]);
}, property + ': url function (interpoalte as discrete)');
},
testAddition: function(property, setup) {
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'blur(10px)';
var animation = target.animate({ [idlName]: ['blur(20px)',
'blur(50px)'] },
{ duration: 1000, composite: 'add' });
testAnimationSamples(animation, idlName,
[ { time: 0, expected: 'blur(10px) blur(20px)' }]);
}, property + ': blur on blur');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'blur(10px)';
var animation = target.animate({ [idlName]: ['brightness(80%)',
'brightness(40%)'] },
{ duration: 1000, composite: 'add' });
testAnimationSamples(animation, idlName,
[ { time: 0, expected: 'blur(10px) brightness(0.8)' }]);
}, property + ': different filter functions');
},
testAccumulation: function(property, setup) {
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'blur(10px) brightness(0.3)';
var animation = target.animate({ [idlName]: ['blur(20px) brightness(0.1)',
'blur(20px) brightness(0.1)'] },
{ duration: 1000, composite: 'accumulate' });
// brightness(0.1) onto brightness(0.3) means
// brightness((0.1 - 1.0) + (0.3 - 1.0) + 1.0). The result of this formula
// is brightness(-0.6) that means brightness(0.0).
testAnimationSamples(animation, idlName,
[ { time: 0, expected: 'blur(30px) brightness(0)' }]);
}, property + ': same ordered filter functions');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'blur(10px) brightness(1.3)';
var animation = target.animate({ [idlName]: ['brightness(1.2) blur(20px)',
'brightness(1.2) blur(20px)'] },
{ duration: 1000, composite: 'accumulate' });
// Mismatched ordered functions can't be accumulated.
testAnimationSamples(animation, idlName,
[ { time: 0, expected: 'brightness(1.2) blur(20px)' }]);
}, property + ': mismatched ordered filter functions');
},
};
const textShadowListType = {
- testInterpolation: function(property, setup) {
- test(function(t) {
+ testInterpolation: (property, setup) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation =
target.animate({ [idlName]: [ 'none',
'rgb(100, 100, 100) 10px 10px 10px'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
// Premultiplied
[{ time: 500, expected: 'rgba(100, 100, 100, 0.5) 5px 5px 5px' }]);
}, property + ': from none to other');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation =
target.animate({ [idlName]: [ 'rgb(100, 100, 100) 10px 10px 10px',
'none' ] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
// Premultiplied
[{ time: 500, expected: 'rgba(100, 100, 100, 0.5) 5px 5px 5px' }]);
}, property + ': from other to none');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation =
target.animate({ [idlName]: [ 'rgb(0, 0, 0) 0px 0px 0px',
'rgb(100, 100, 100) 10px 10px 10px'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 500, expected: 'rgb(50, 50, 50) 5px 5px 5px' }]);
}, property + ': single shadow');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation =
target.animate({ [idlName]: [ 'rgb(0, 0, 0) 0px 0px 0px, '
+ 'rgb(200, 200, 200) 20px 20px 20px',
'rgb(100, 100, 100) 10px 10px 10px, '
+ 'rgb(100, 100, 100) 10px 10px 10px'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 500, expected: 'rgb(50, 50, 50) 5px 5px 5px, '
+ 'rgb(150, 150, 150) 15px 15px 15px' }]);
}, property + ': shadow list');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation =
target.animate({ [idlName]: [ 'rgb(200, 200, 200) 20px 20px 20px',
'rgb(100, 100, 100) 10px 10px 10px, '
+ 'rgb(100, 100, 100) 10px 10px 10px'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 500, expected: 'rgb(150, 150, 150) 15px 15px 15px, '
+ 'rgba(100, 100, 100, 0.5) 5px 5px 5px' }]);
}, property + ': mismatched list length (from longer to shorter)');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation =
target.animate({ [idlName]: [ 'rgb(100, 100, 100) 10px 10px 10px, '
+ 'rgb(100, 100, 100) 10px 10px 10px',
'rgb(200, 200, 200) 20px 20px 20px'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 500, expected: 'rgb(150, 150, 150) 15px 15px 15px, '
+ 'rgba(100, 100, 100, 0.5) 5px 5px 5px' }]);
}, property + ': mismatched list length (from shorter to longer)');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style.color = 'rgb(0, 255, 0)';
var animation =
target.animate({ [idlName]: [ 'currentcolor 0px 0px 0px',
'currentcolor 10px 10px 10px'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 500, expected: 'rgb(0, 255, 0) 5px 5px 5px' }]);
}, property + ': with currentcolor');
},
testAddition: function(property, setup) {
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'rgb(0, 0, 0) 0px 0px 0px';
var animation =
target.animate({ [idlName]: [ 'rgb(120, 120, 120) 10px 10px 10px',
'rgb(120, 120, 120) 10px 10px 10px'] },
{ duration: 1000, composite: 'add' });
testAnimationSamples(animation, idlName,
[ { time: 0, expected: 'rgb(0, 0, 0) 0px 0px 0px, ' +
'rgb(120, 120, 120) 10px 10px 10px' }]);
}, property + ': shadow');
},
testAccumulation: function(property, setup) {
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'rgb(120, 120, 120) 10px 10px 10px';
var animation =
target.animate({ [idlName]: [ 'rgb(120, 120, 120) 10px 10px 10px',
'rgb(120, 120, 120) 10px 10px 10px'] },
{ duration: 1000, composite: 'accumulate' });
testAnimationSamples(animation, idlName,
[ { time: 0, expected: 'rgb(240, 240, 240) 20px 20px 20px' }]);
}, property + ': shadow');
},
};
const boxShadowListType = {
- testInterpolation: function(property, setup) {
- test(function(t) {
+ testInterpolation: (property, setup) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation =
target.animate({ [idlName]: [ 'none',
'rgb(100, 100, 100) 10px 10px 10px 0px'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
// Premultiplied
[{ time: 500, expected: 'rgba(100, 100, 100, 0.5) 5px 5px 5px 0px' }]);
}, property + ': from none to other');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation =
target.animate({ [idlName]: [ 'rgb(100, 100, 100) 10px 10px 10px 0px',
'none' ] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
// Premultiplied
[{ time: 500, expected: 'rgba(100, 100, 100, 0.5) 5px 5px 5px 0px' }]);
}, property + ': from other to none');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation =
target.animate({ [idlName]: [ 'rgb(0, 0, 0) 0px 0px 0px 0px',
'rgb(100, 100, 100) 10px 10px 10px 0px'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 500, expected: 'rgb(50, 50, 50) 5px 5px 5px 0px' }]);
}, property + ': single shadow');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation =
target.animate({ [idlName]: [ 'rgb(0, 0, 0) 0px 0px 0px 0px, '
+ 'rgb(200, 200, 200) 20px 20px 20px 20px',
'rgb(100, 100, 100) 10px 10px 10px 0px, '
+ 'rgb(100, 100, 100) 10px 10px 10px 0px'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 500, expected: 'rgb(50, 50, 50) 5px 5px 5px 0px, '
+ 'rgb(150, 150, 150) 15px 15px 15px 10px' }]);
}, property + ': shadow list');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation =
target.animate({ [idlName]: [ 'rgb(200, 200, 200) 20px 20px 20px 20px',
'rgb(100, 100, 100) 10px 10px 10px 0px, '
+ 'rgb(100, 100, 100) 10px 10px 10px 0px'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 500, expected: 'rgb(150, 150, 150) 15px 15px 15px 10px, '
+ 'rgba(100, 100, 100, 0.5) 5px 5px 5px 0px' }]);
}, property + ': mismatched list length (from shorter to longer)');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation =
target.animate({ [idlName]: [ 'rgb(100, 100, 100) 10px 10px 10px 0px, '
+ 'rgb(100, 100, 100) 10px 10px 10px 0px',
'rgb(200, 200, 200) 20px 20px 20px 20px']},
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 500, expected: 'rgb(150, 150, 150) 15px 15px 15px 10px, '
+ 'rgba(100, 100, 100, 0.5) 5px 5px 5px 0px' }]);
}, property + ': mismatched list length (from longer to shorter)');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style.color = 'rgb(0, 255, 0)';
var animation =
target.animate({ [idlName]: [ 'currentcolor 0px 0px 0px 0px',
'currentcolor 10px 10px 10px 10px'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 500, expected: 'rgb(0, 255, 0) 5px 5px 5px 5px' }]);
}, property + ': with currentcolor');
},
testAddition: function(property, setup) {
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'rgb(0, 0, 0) 0px 0px 0px 0px';
var animation =
target.animate({ [idlName]: [ 'rgb(120, 120, 120) 10px 10px 10px 0px',
'rgb(120, 120, 120) 10px 10px 10px 0px'] },
{ duration: 1000, composite: 'add' });
testAnimationSamples(animation, idlName,
[ { time: 0, expected: 'rgb(0, 0, 0) 0px 0px 0px 0px, ' +
'rgb(120, 120, 120) 10px 10px 10px 0px' }]);
}, property + ': shadow');
},
testAccumulation: function(property, setup) {
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'rgb(120, 120, 120) 10px 10px 10px 10px';
var animation =
target.animate({ [idlName]: [ 'rgb(120, 120, 120) 10px 10px 10px 10px',
'rgb(120, 120, 120) 10px 10px 10px 10px'] },
{ duration: 1000, composite: 'accumulate' });
testAnimationSamples(animation, idlName,
[ { time: 0, expected: 'rgb(240, 240, 240) 20px 20px 20px 20px' }]);
}, property + ': shadow');
},
};
const positionType = {
- testInterpolation: function(property, setup) {
+ testInterpolation: (property, setup) => {
lengthPairType.testInterpolation(property, setup);
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]: ['10% 10%', '50% 50%'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(
animation, idlName,
[{ time: 500, expected: calcFromPercentage(idlName, '30% 30%') }]);
}, property + ' supports animating as a position of percent');
},
- testAdditionOrAccumulation: function(property, setup, composite) {
+ testAdditionOrAccumulation: (property, setup, composite) => {
lengthPairType.testAddition(property, setup);
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = '60% 60%';
var animation = target.animate({ [idlName]: ['70% 70%', '100% 100%'] },
{ duration: 1000, composite: composite });
testAnimationSamples(
animation, idlName,
[{ time: 0, expected: calcFromPercentage(idlName, '130% 130%') }]);
@@ -1924,32 +1924,32 @@ const positionType = {
},
testAccumulation: function(property, setup) {
this.testAdditionOrAccumulation(property, setup, 'accumulate');
},
};
const rectType = {
- testInterpolation: function(property, setup) {
- test(function(t) {
+ testInterpolation: (property, setup) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]:
['rect(10px, 10px, 10px, 10px)',
'rect(50px, 50px, 50px, 50px)'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(
animation, idlName,
[{ time: 500, expected: 'rect(30px, 30px, 30px, 30px)' }]);
}, property + ' supports animating as a rect');
},
- testAdditionOrAccumulation: function(property, setup, composite) {
- test(function(t) {
+ testAdditionOrAccumulation: (property, setup, composite) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'rect(100px, 100px, 100px, 100px)';
var animation = target.animate({ [idlName]:
['rect(10px, 10px, 10px, 10px)',
'rect(10px, 10px, 10px, 10px)'] },
{ duration: 1000, composite: composite });
testAnimationSamples(
@@ -1964,33 +1964,33 @@ const rectType = {
testAccumulation: function(property, setup) {
this.testAdditionOrAccumulation(property, setup, 'accumulate');
},
}
// stroke-dasharray: none | [ <length> | <percentage> | <number> ]*
const dasharrayType = {
- testInterpolation: function(property, setup) {
+ testInterpolation: (property, setup) => {
percentageType.testInterpolation(property, setup);
positiveNumberType.testInterpolation(property, setup);
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]:
['8, 16, 4',
'4, 8, 12, 16'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(
animation, idlName,
[{ time: 500, expected: '6, 12, 8, 12, 10, 6, 10, 16, 4, 8, 14, 10' }]);
}, property + ' supports animating as a dasharray (mismatched length)');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation = target.animate({ [idlName]:
['2, 50%, 6, 10',
'6, 30%, 2, 2'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(
animation, idlName,
@@ -1998,18 +1998,18 @@ const dasharrayType = {
}, property + ' supports animating as a dasharray (mixed number and percentage)');
},
// Note that stroke-dasharray is neither additive nor cumulative, so we should
// write this additive test case that animating value replaces underlying
// values.
// See https://www.w3.org/TR/SVG2/painting.html#StrokeDashing.
- testAdditionOrAccumulation: function(property, setup, composite) {
- test(function(t) {
+ testAdditionOrAccumulation: (property, setup, composite) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = '6, 30%, 2px';
var animation = target.animate({ [idlName]:
['1, 2, 3, 4, 5',
'6, 7, 8, 9, 10'] },
{ duration: 1000, composite: composite });
testAnimationSamples(
@@ -2023,41 +2023,41 @@ const dasharrayType = {
},
testAccumulation: function(property, setup) {
this.testAdditionOrAccumulation(property, setup, 'accumulate');
},
}
const fontStretchType = {
- testInterpolation: function(property, setup) {
- test(function(t) {
+ testInterpolation: (property, setup) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation =
target.animate({ [idlName]: ['ultra-condensed', 'extra-condensed'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 499, expected: 'ultra-condensed' },
{ time: 500, expected: 'extra-condensed' }]);
}, property + ' supports animating as a font-stretch (adjacent values)');
- test(function(t) {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
var animation =
target.animate({ [idlName]: ['ultra-condensed', 'condensed'] },
{ duration: 1000, fill: 'both' });
testAnimationSamples(animation, idlName,
[{ time: 500, expected: 'extra-condensed' }]);
}, property + ' supports animating as a font-stretch (between value)');
},
- testAdditionOrAccumulation: function(property, setup, composite) {
- test(function(t) {
+ testAdditionOrAccumulation: (property, setup, composite) => {
+ test(t => {
var idlName = propertyToIDL(property);
var target = createTestElement(t, setup);
target.style[idlName] = 'condensed';
var animation =
target.animate({ [idlName]: ['expanded', 'ultra-expanded'] },
{ duration: 1000, composite: composite });
testAnimationSamples(animation, idlName,
[{ time: 0, expected: 'normal' },
--- a/testing/web-platform/tests/web-animations/animation-model/animation-types/visibility.html
+++ b/testing/web-platform/tests/web-animations/animation-model/animation-types/visibility.html
@@ -8,17 +8,17 @@
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<div id="target"></div>
<script>
'use strict';
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ visibility: ['hidden','visible'] },
{ duration: 100 * MS_PER_SEC, fill: 'both' });
anim.currentTime = 0;
assert_equals(getComputedStyle(div).visibility, 'hidden',
'Visibility when progress = 0');
@@ -27,17 +27,17 @@ test(function(t) {
'Visibility when progress > 0 due to linear easing');
anim.finish();
assert_equals(getComputedStyle(div).visibility, 'visible',
'Visibility when progress = 1');
}, 'Visibility clamping behavior');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ visibility: ['hidden', 'visible'] },
{ duration: 100 * MS_PER_SEC, fill: 'both',
easing: 'cubic-bezier(0.25, -0.6, 0, 0.5)' });
anim.currentTime = 0;
assert_equals(getComputedStyle(div).visibility, 'hidden',
'Visibility when progress = 0');
--- a/testing/web-platform/tests/web-animations/animation-model/combining-effects/effect-composition.html
+++ b/testing/web-platform/tests/web-animations/animation-model/combining-effects/effect-composition.html
@@ -4,74 +4,74 @@
<link rel="help" href="https://w3c.github.io/web-animations/#effect-composition">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="../../testcommon.js"></script>
<div id="log"></div>
<script>
'use strict';
-[ 'accumulate', 'add' ].forEach(function(composite) {
- test(function(t) {
+[ 'accumulate', 'add' ].forEach(composite => {
+ test(t => {
var div = createDiv(t);
div.style.marginLeft = '10px';
var anim =
div.animate({ marginLeft: ['0px', '10px'], composite }, 100);
anim.currentTime = 50;
assert_equals(getComputedStyle(div).marginLeft, '15px',
'Animated margin-left style at 50%');
}, composite + ' onto the base value');
- test(function(t) {
+ test(t => {
var div = createDiv(t);
var anims = [];
anims.push(div.animate({ marginLeft: ['10px', '20px'],
composite: 'replace' },
100));
anims.push(div.animate({ marginLeft: ['0px', '10px'],
composite },
100));
- anims.forEach(function(anim) {
+ anims.forEach(anim => {
anim.currentTime = 50;
});
assert_equals(getComputedStyle(div).marginLeft, '20px',
'Animated style at 50%');
}, composite + ' onto an underlying animation value');
- test(function(t) {
+ test(t => {
var div = createDiv(t);
div.style.marginLeft = '10px';
var anim =
div.animate([{ marginLeft: '10px', composite },
{ marginLeft: '30px', composite: 'replace' }],
100);
anim.currentTime = 50;
assert_equals(getComputedStyle(div).marginLeft, '25px',
'Animated style at 50%');
}, 'Composite when mixing ' + composite + ' and replace');
- test(function(t) {
+ test(t => {
var div = createDiv(t);
div.style.marginLeft = '10px';
var anim =
div.animate([{ marginLeft: '10px', composite: 'replace' },
{ marginLeft: '20px' }],
{ duration: 100 , composite });
anim.currentTime = 50;
assert_equals(getComputedStyle(div).marginLeft, '20px',
'Animated style at 50%');
}, composite + ' specified on a keyframe overrides the composite mode of ' +
'the effect');
- test(function(t) {
+ test(t => {
var div = createDiv(t);
div.style.marginLeft = '10px';
var anim =
div.animate([{ marginLeft: '10px', composite: 'replace' },
{ marginLeft: '20px' }],
100);
anim.effect.composite = composite;
--- a/testing/web-platform/tests/web-animations/animation-model/keyframe-effects/effect-value-context.html
+++ b/testing/web-platform/tests/web-animations/animation-model/keyframe-effects/effect-value-context.html
@@ -4,89 +4,89 @@
<link rel="help" href="https://w3c.github.io/web-animations/#calculating-computed-keyframes">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
-test(function(t) {
+test(t => {
var div = createDiv(t);
div.style.fontSize = '10px';
var animation = div.animate([ { marginLeft: '10em' },
{ marginLeft: '20em' } ], 1000);
animation.currentTime = 500;
assert_equals(getComputedStyle(div).marginLeft, '150px',
'Effect value before updating font-size');
div.style.fontSize = '20px';
assert_equals(getComputedStyle(div).marginLeft, '300px',
'Effect value after updating font-size');
}, 'Effect values reflect changes to font-size on element');
-test(function(t) {
+test(t => {
var parentDiv = createDiv(t);
var div = createDiv(t);
parentDiv.appendChild(div);
parentDiv.style.fontSize = '10px';
var animation = div.animate([ { marginLeft: '10em' },
{ marginLeft: '20em' } ], 1000);
animation.currentTime = 500;
assert_equals(getComputedStyle(div).marginLeft, '150px',
'Effect value before updating font-size on parent element');
parentDiv.style.fontSize = '20px';
assert_equals(getComputedStyle(div).marginLeft, '300px',
'Effect value after updating font-size on parent element');
}, 'Effect values reflect changes to font-size on parent element');
-promise_test(function(t) {
+promise_test(t => {
var parentDiv = createDiv(t);
var div = createDiv(t);
parentDiv.appendChild(div);
parentDiv.style.fontSize = '10px';
var animation = div.animate([ { marginLeft: '10em' },
{ marginLeft: '20em' } ], 1000);
animation.pause();
animation.currentTime = 500;
parentDiv.style.fontSize = '20px';
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
assert_equals(getComputedStyle(div).marginLeft, '300px',
'Effect value after updating font-size on parent element');
});
}, 'Effect values reflect changes to font-size when computed style is not'
+ ' immediately flushed');
-promise_test(function(t) {
+promise_test(t => {
var divWith10pxFontSize = createDiv(t);
divWith10pxFontSize.style.fontSize = '10px';
var divWith20pxFontSize = createDiv(t);
divWith20pxFontSize.style.fontSize = '20px';
var div = createDiv(t);
div.remove(); // Detach
var animation = div.animate([ { marginLeft: '10em' },
{ marginLeft: '20em' } ], 1000);
animation.pause();
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
animation.currentTime = 500;
divWith10pxFontSize.appendChild(div);
assert_equals(getComputedStyle(div).marginLeft, '150px',
'Effect value after attaching to font-size:10px parent');
divWith20pxFontSize.appendChild(div);
assert_equals(getComputedStyle(div).marginLeft, '300px',
'Effect value after attaching to font-size:20px parent');
});
}, 'Effect values reflect changes to font-size from reparenting');
-test(function(t) {
+test(t => {
var divA = createDiv(t);
divA.style.fontSize = '10px';
var divB = createDiv(t);
divB.style.fontSize = '20px';
var animation = divA.animate([ { marginLeft: '10em' },
{ marginLeft: '20em' } ], 1000);
--- a/testing/web-platform/tests/web-animations/animation-model/keyframe-effects/effect-value-overlapping-keyframes.html
+++ b/testing/web-platform/tests/web-animations/animation-model/keyframe-effects/effect-value-overlapping-keyframes.html
@@ -6,17 +6,17 @@
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<div id="target"></div>
<script>
'use strict';
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate([ { offset: 0, opacity: 0 },
{ offset: 0, opacity: 0.1 },
{ offset: 0, opacity: 0.2 },
{ offset: 1, opacity: 0.8 },
{ offset: 1, opacity: 0.9 },
{ offset: 1, opacity: 1 } ],
{ duration: 1000,
@@ -42,17 +42,17 @@ test(function(t) {
+ ' offset should be used');
anim.finish();
assert_equals(getComputedStyle(div).opacity, '1',
'When progress is equal to 1.0, the last keyframe with a 1'
+ ' offset should be used');
}, 'Overlapping keyframes at 0 and 1 use the appropriate value when the'
+ ' progress is outside the range [0, 1]');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate([ { offset: 0, opacity: 0 },
{ offset: 0.5, opacity: 0.3 },
{ offset: 0.5, opacity: 0.5 },
{ offset: 0.5, opacity: 0.7 },
{ offset: 1, opacity: 1 } ], 1000);
anim.currentTime = 250;
assert_equals(getComputedStyle(div).opacity, '0.15',
--- a/testing/web-platform/tests/web-animations/animation-model/keyframe-effects/effect-value-transformed-distance.html
+++ b/testing/web-platform/tests/web-animations/animation-model/keyframe-effects/effect-value-transformed-distance.html
@@ -9,17 +9,17 @@
<body>
<div id="log"></div>
<script>
'use strict';
// Test that applying easing to keyframes is applied as expected
gEasingTests.forEach(params => {
- test(function(t) {
+ test(t => {
const target = createDiv(t);
const anim = target.animate([ { width: '0px' },
// We put the easing on the second keyframe
// so we can test that it is only applied
// to the specified keyframe.
{ width: '100px', easing: params.easing },
{ width: '200px' } ],
{ duration: 2000,
@@ -42,17 +42,17 @@ gEasingTests.forEach(params => {
});
// Test that a linear-equivalent cubic-bezier easing applied to a keyframe does
// not alter (including clamping) the result.
gEasingTests.forEach(params => {
const linearEquivalentEasings = [ 'cubic-bezier(0, 0, 0, 0)',
'cubic-bezier(1, 1, 1, 1)' ];
- test(function(t) {
+ test(t => {
linearEquivalentEasings.forEach(linearEquivalentEasing => {
const timing = { duration: 1000,
fill: 'forwards',
easing: params.easing };
const linearTarget = createDiv(t);
const linearAnim = linearTarget.animate([ { width: '0px' },
{ width: '100px' } ],
--- a/testing/web-platform/tests/web-animations/interfaces/Animatable/animate.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Animatable/animate.html
@@ -11,182 +11,182 @@
<body>
<div id="log"></div>
<iframe width="10" height="10" id="iframe"></iframe>
<script>
'use strict';
// Tests on Element
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate(null);
assert_class_string(anim, 'Animation', 'Returned object is an Animation');
}, 'Element.animate() creates an Animation object');
-test(function(t) {
+test(t => {
var iframe = window.frames[0];
var div = createDiv(t, iframe.document);
var anim = Element.prototype.animate.call(div, null);
assert_equals(Object.getPrototypeOf(anim), iframe.Animation.prototype,
'The prototype of the created Animation is that defined on'
+ ' the relevant global for the target element');
assert_not_equals(Object.getPrototypeOf(anim), Animation.prototype,
'The prototype of the created Animation is NOT that of'
+ ' the current global');
}, 'Element.animate() creates an Animation object in the relevant realm of'
+ ' the target element');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = Element.prototype.animate.call(div, null);
assert_class_string(anim.effect, 'KeyframeEffect',
'Returned Animation has a KeyframeEffect');
}, 'Element.animate() creates an Animation object with a KeyframeEffect');
-test(function(t) {
+test(t => {
var iframe = window.frames[0];
var div = createDiv(t, iframe.document);
var anim = Element.prototype.animate.call(div, null);
assert_equals(Object.getPrototypeOf(anim.effect),
iframe.KeyframeEffect.prototype,
'The prototype of the created KeyframeEffect is that defined on'
+ ' the relevant global for the target element');
assert_not_equals(Object.getPrototypeOf(anim.effect),
KeyframeEffect.prototype,
'The prototype of the created KeyframeEffect is NOT that of'
+ ' the current global');
}, 'Element.animate() creates an Animation object with a KeyframeEffect'
+ ' that is created in the relevant realm of the target element');
-test(function(t) {
+test(t => {
var iframe = window.frames[0];
var div = createDiv(t, iframe.document);
var anim = div.animate(null);
assert_equals(Object.getPrototypeOf(anim.effect.timing),
iframe.AnimationEffectTiming.prototype,
'The prototype of the created AnimationEffectTiming is that'
+ ' defined on the relevant global for the target element');
assert_not_equals(Object.getPrototypeOf(anim.effect.timing),
AnimationEffectTiming.prototype,
'The prototype of the created AnimationEffectTiming is NOT'
+ ' that of the current global');
}, 'Element.animate() creates an Animation object with a KeyframeEffect'
+ ' whose AnimationEffectTiming object is created in the relevant realm'
+ ' of the target element');
-gEmptyKeyframeListTests.forEach(function(subTest) {
- test(function(t) {
+gEmptyKeyframeListTests.forEach(subTest => {
+ test(t => {
var div = createDiv(t);
var anim = div.animate(subTest, 2000);
assert_not_equals(anim, null);
}, 'Element.animate() accepts empty keyframe lists ' +
`(input: ${JSON.stringify(subTest)})`);
});
-gKeyframesTests.forEach(function(subtest) {
- test(function(t) {
+gKeyframesTests.forEach(subtest => {
+ test(t => {
var div = createDiv(t);
var anim = div.animate(subtest.input, 2000);
assert_frame_lists_equal(anim.effect.getKeyframes(), subtest.output);
}, 'Element.animate() accepts ' + subtest.desc);
});
-gInvalidKeyframesTests.forEach(function(subtest) {
- test(function(t) {
+gInvalidKeyframesTests.forEach(subtest => {
+ test(t => {
var div = createDiv(t);
- assert_throws(new TypeError, function() {
+ assert_throws(new TypeError, () => {
div.animate(subtest.input, 2000);
});
}, 'Element.animate() does not accept ' + subtest.desc);
});
gInvalidEasings.forEach(invalidEasing => {
- test(function(t) {
+ test(t => {
var div = createDiv(t);
assert_throws(new TypeError, () => {
div.animate({ easing: invalidEasing }, 2000);
});
}, `Element.animate() does not accept invalid easing: '${invalidEasing}'`);
});
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
assert_equals(anim.effect.timing.duration, 2000);
// Also check that unspecified parameters receive their default values
assert_equals(anim.effect.timing.fill, 'auto');
}, 'Element.animate() accepts a double as an options argument');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] },
{ duration: Infinity, fill: 'forwards' });
assert_equals(anim.effect.timing.duration, Infinity);
assert_equals(anim.effect.timing.fill, 'forwards');
// Also check that unspecified parameters receive their default values
assert_equals(anim.effect.timing.direction, 'normal');
}, 'Element.animate() accepts a KeyframeAnimationOptions argument');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] });
assert_equals(anim.effect.timing.duration, 'auto');
}, 'Element.animate() accepts an absent options argument');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
assert_equals(anim.id, '');
}, 'Element.animate() correctly sets the id attribute when no id is specified');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, { id: 'test' });
assert_equals(anim.id, 'test');
}, 'Element.animate() correctly sets the id attribute');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
assert_equals(anim.timeline, document.timeline);
}, 'Element.animate() correctly sets the Animation\'s timeline');
-async_test(function(t) {
+async_test(t => {
var iframe = document.createElement('iframe');
iframe.width = 10;
iframe.height = 10;
- iframe.addEventListener('load', t.step_func(function() {
+ iframe.addEventListener('load', t.step_func(() => {
var div = createDiv(t, iframe.contentDocument);
var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
assert_equals(anim.timeline, iframe.contentDocument.timeline);
iframe.remove();
t.done();
}));
document.body.appendChild(iframe);
}, 'Element.animate() correctly sets the Animation\'s timeline when ' +
'triggered on an element in a different document');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
assert_equals(anim.playState, 'pending');
}, 'Element.animate() calls play on the Animation');
// Tests on CSSPseudoElement
-test(function(t) {
+test(t => {
var pseudoTarget = createPseudo(t, 'before');
var anim = pseudoTarget.animate(null);
assert_class_string(anim, 'Animation', 'The returned object is an Animation');
}, 'CSSPseudoElement.animate() creates an Animation object');
-test(function(t) {
+test(t => {
var pseudoTarget = createPseudo(t, 'before');
var anim = pseudoTarget.animate(null);
assert_equals(anim.effect.target, pseudoTarget,
'The returned Animation targets to the correct object');
}, 'CSSPseudoElement.animate() creates an Animation object targeting ' +
'to the correct CSSPseudoElement object');
</script>
</body>
--- a/testing/web-platform/tests/web-animations/interfaces/Animatable/getAnimations.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Animatable/getAnimations.html
@@ -4,75 +4,75 @@
<link rel="help" href="https://w3c.github.io/web-animations/#dom-animatable-getanimations">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<script>
'use strict';
-test(function(t) {
+test(t => {
var div = createDiv(t);
assert_array_equals(div.getAnimations(), []);
}, 'Returns an empty array for an element with no animations');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animationA = div.animate(null, 100 * MS_PER_SEC);
var animationB = div.animate(null, 100 * MS_PER_SEC);
assert_array_equals(div.getAnimations(), [animationA, animationB]);
}, 'Returns both animations for an element with two animations');
-test(function(t) {
+test(t => {
var divA = createDiv(t);
var divB = createDiv(t);
var animationA = divA.animate(null, 100 * MS_PER_SEC);
var animationB = divB.animate(null, 100 * MS_PER_SEC);
assert_array_equals(divA.getAnimations(), [animationA], 'divA');
assert_array_equals(divB.getAnimations(), [animationB], 'divB');
}, 'Returns only the animations specific to each sibling element');
-test(function(t) {
+test(t => {
var divParent = createDiv(t);
var divChild = createDiv(t);
divParent.appendChild(divChild);
var animationParent = divParent.animate(null, 100 * MS_PER_SEC);
var animationChild = divChild.animate(null, 100 * MS_PER_SEC);
assert_array_equals(divParent.getAnimations(), [animationParent],
'divParent');
assert_array_equals(divChild.getAnimations(), [animationChild], 'divChild');
}, 'Returns only the animations specific to each parent/child element');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate(null, 100 * MS_PER_SEC);
animation.finish();
assert_array_equals(div.getAnimations(), []);
}, 'Does not return finished animations that do not fill forwards');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate(null, {
duration: 100 * MS_PER_SEC,
fill: 'forwards',
});
animation.finish();
assert_array_equals(div.getAnimations(), [animation]);
}, 'Returns finished animations that fill forwards');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate(null, {
duration: 100 * MS_PER_SEC,
delay: 100 * MS_PER_SEC,
});
assert_array_equals(div.getAnimations(), [animation]);
}, 'Returns animations in their delay phase');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate(null, 100 * MS_PER_SEC);
animation.finish();
assert_array_equals(div.getAnimations(), [],
'Animation should not be returned when it is finished');
animation.effect.timing.duration += 100 * MS_PER_SEC;
@@ -82,17 +82,17 @@ test(function(t) {
animation.effect.timing.duration = 0;
assert_array_equals(div.getAnimations(), [],
'Animation should not be returned after setting the'
+ ' duration to zero');
}, 'Returns animations based on dynamic changes to individual'
+ ' animations\' duration');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate(null, 100 * MS_PER_SEC);
animation.effect.timing.endDelay = -200 * MS_PER_SEC;
assert_array_equals(div.getAnimations(), [],
'Animation should not be returned after setting a'
+ ' negative end delay such that the end time is less'
+ ' than the current time');
@@ -100,17 +100,17 @@ test(function(t) {
animation.effect.timing.endDelay = 100 * MS_PER_SEC;
assert_array_equals(div.getAnimations(), [animation],
'Animation should be returned after setting a positive'
+ ' end delay such that the end time is more than the'
+ ' current time');
}, 'Returns animations based on dynamic changes to individual'
+ ' animations\' end delay');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate(null, 100 * MS_PER_SEC);
animation.finish();
assert_array_equals(div.getAnimations(), [],
'Animation should not be returned when it is finished');
animation.effect.timing.iterations = 10;
@@ -125,17 +125,17 @@ test(function(t) {
animation.effect.timing.iterations = Infinity;
assert_array_equals(div.getAnimations(), [animation],
'Animation should be returned after inreasing the'
+ ' number of iterations to infinity');
}, 'Returns animations based on dynamic changes to individual'
+ ' animations\' iteration count');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate(null,
{ duration: 100 * MS_PER_SEC,
delay: 50 * MS_PER_SEC,
endDelay: -50 * MS_PER_SEC });
assert_array_equals(div.getAnimations(), [animation],
'Animation should be returned at during delay phase');
--- a/testing/web-platform/tests/web-animations/interfaces/Animation/cancel.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Animation/cancel.html
@@ -5,56 +5,56 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({transform: ['translate(100px)', 'translate(100px)']},
100 * MS_PER_SEC);
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
assert_not_equals(getComputedStyle(div).transform, 'none',
'transform style is animated before cancelling');
animation.cancel();
assert_equals(getComputedStyle(div).transform, 'none',
'transform style is no longer animated after cancelling');
});
}, 'Animated style is cleared after calling Animation.cancel()');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate({marginLeft: ['100px', '200px']},
100 * MS_PER_SEC);
animation.effect.timing.easing = 'linear';
animation.cancel();
assert_equals(getComputedStyle(div).marginLeft, '0px',
'margin-left style is not animated after cancelling');
animation.currentTime = 50 * MS_PER_SEC;
assert_equals(getComputedStyle(div).marginLeft, '150px',
'margin-left style is updated when cancelled animation is'
+ ' seeked');
}, 'After cancelling an animation, it can still be seeked');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({marginLeft:['100px', '200px']},
100 * MS_PER_SEC);
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
animation.cancel();
assert_equals(getComputedStyle(div).marginLeft, '0px',
'margin-left style is not animated after cancelling');
animation.play();
assert_equals(getComputedStyle(div).marginLeft, '100px',
'margin-left style is animated after re-starting animation');
return animation.ready;
- }).then(function() {
+ }).then(() => {
assert_equals(animation.playState, 'running',
'Animation succeeds in running after being re-started');
});
}, 'After cancelling an animation, it can still be re-used');
</script>
</body>
--- a/testing/web-platform/tests/web-animations/interfaces/Animation/constructor.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Animation/constructor.html
@@ -59,51 +59,51 @@ var gTestArguments = [
{
createEffect: createEffect,
expectedTimeline: document.timeline,
expectedTimelineDescription: "document.timeline",
description: "with non-null effect and no timeline parameter"
},
];
-gTestArguments.forEach(function(args) {
- test(function(t) {
+gTestArguments.forEach(args => {
+ test(t => {
var effect = args.createEffect();
var animation = new Animation(effect, args.timeline);
assert_not_equals(animation, null,
"An animation sohuld be created");
assert_equals(animation.effect, effect,
"Animation returns the same effect passed to " +
"the Constructor");
assert_equals(animation.timeline, args.expectedTimeline,
"Animation timeline should be " + args.expectedTimelineDescription);
assert_equals(animation.playState, "idle",
"Animation.playState should be initially 'idle'");
}, "Animation can be constructed " + args.description);
});
-test(function(t) {
+test(t => {
var effect = new KeyframeEffectReadOnly(null,
{ left: ["10px", "20px"] },
{ duration: 10000,
fill: "forwards" });
var anim = new Animation(effect, document.timeline);
anim.pause();
assert_equals(effect.getComputedTiming().progress, 0.0);
anim.currentTime += 5000;
assert_equals(effect.getComputedTiming().progress, 0.5);
anim.finish();
assert_equals(effect.getComputedTiming().progress, 1.0);
}, "Animation constructed by an effect with null target runs normally");
-async_test(function(t) {
+async_test(t => {
var iframe = document.createElement('iframe');
- iframe.addEventListener('load', t.step_func(function() {
+ iframe.addEventListener('load', t.step_func(() => {
var div = createDiv(t, iframe.contentDocument);
var effect = new KeyframeEffectReadOnly(div, null, 10000);
var anim = new Animation(effect);
assert_equals(anim.timeline, document.timeline);
iframe.remove();
t.done();
}));
--- a/testing/web-platform/tests/web-animations/interfaces/Animation/effect.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Animation/effect.html
@@ -5,26 +5,26 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
"use strict";
-test(function(t) {
+test(t => {
var anim = new Animation();
assert_equals(anim.effect, null, "initial effect is null");
var newEffect = new KeyframeEffectReadOnly(createDiv(t), null);
anim.effect = newEffect;
assert_equals(anim.effect, newEffect, "new effect is set");
}, "effect is set correctly.");
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate({ left: ['100px', '100px'] },
{ fill: 'forwards' });
var effect = animation.effect;
assert_equals(getComputedStyle(div).left, '100px',
'animation is initially having an effect');
--- a/testing/web-platform/tests/web-animations/interfaces/Animation/finish.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Animation/finish.html
@@ -7,107 +7,107 @@
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
var gKeyFrames = { 'marginLeft': ['100px', '200px'] };
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate(gKeyFrames, 100 * MS_PER_SEC);
animation.playbackRate = 0;
- assert_throws({name: 'InvalidStateError'}, function() {
+ assert_throws({name: 'InvalidStateError'}, () => {
animation.finish();
});
}, 'Test exceptions when finishing non-running animation');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate(gKeyFrames,
{duration : 100 * MS_PER_SEC,
iterations : Infinity});
- assert_throws({name: 'InvalidStateError'}, function() {
+ assert_throws({name: 'InvalidStateError'}, () => {
animation.finish();
});
}, 'Test exceptions when finishing infinite animation');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate(gKeyFrames, 100 * MS_PER_SEC);
animation.finish();
assert_equals(animation.currentTime, 100 * MS_PER_SEC,
'After finishing, the currentTime should be set to the end ' +
'of the active duration');
}, 'Test finishing of animation');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate(gKeyFrames, 100 * MS_PER_SEC);
// 1s past effect end
animation.currentTime =
animation.effect.getComputedTiming().endTime + 1 * MS_PER_SEC;
animation.finish();
assert_equals(animation.currentTime, 100 * MS_PER_SEC,
'After finishing, the currentTime should be set back to the ' +
'end of the active duration');
}, 'Test finishing of animation with a current time past the effect end');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate(gKeyFrames, 100 * MS_PER_SEC);
animation.currentTime = 100 * MS_PER_SEC;
- return animation.finished.then(function() {
+ return animation.finished.then(() => {
animation.playbackRate = -1;
animation.finish();
assert_equals(animation.currentTime, 0,
'After finishing a reversed animation the currentTime ' +
'should be set to zero');
});
}, 'Test finishing of reversed animation');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate(gKeyFrames, 100 * MS_PER_SEC);
animation.currentTime = 100 * MS_PER_SEC;
- return animation.finished.then(function() {
+ return animation.finished.then(() => {
animation.playbackRate = -1;
animation.currentTime = -1000;
animation.finish();
assert_equals(animation.currentTime, 0,
'After finishing a reversed animation the currentTime ' +
'should be set back to zero');
});
}, 'Test finishing of reversed animation with a current time less than zero');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate(gKeyFrames, 100 * MS_PER_SEC);
animation.pause();
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
animation.finish();
assert_equals(animation.playState, 'finished',
'The play state of a paused animation should become ' +
'"finished" after finish() is called');
assert_times_equal(animation.startTime,
animation.timeline.currentTime - 100 * MS_PER_SEC,
'The start time of a paused animation should be set ' +
'after calling finish()');
});
}, 'Test finish() while paused');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate(gKeyFrames, 100 * MS_PER_SEC);
animation.pause();
// Update playbackRate so we can test that the calculated startTime
// respects it
animation.playbackRate = 2;
// While animation is still pause-pending call finish()
animation.finish();
@@ -116,32 +116,32 @@ test(function(t) {
'The play state of a pause-pending animation should become ' +
'"finished" after finish() is called');
assert_times_equal(animation.startTime,
animation.timeline.currentTime - 100 * MS_PER_SEC / 2,
'The start time of a pause-pending animation should ' +
'be set after calling finish()');
}, 'Test finish() while pause-pending with positive playbackRate');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate(gKeyFrames, 100 * MS_PER_SEC);
animation.pause();
animation.playbackRate = -2;
animation.finish();
assert_equals(animation.playState, 'finished',
'The play state of a pause-pending animation should become ' +
'"finished" after finish() is called');
assert_equals(animation.startTime, animation.timeline.currentTime,
'The start time of a pause-pending animation should be ' +
'set after calling finish()');
}, 'Test finish() while pause-pending with negative playbackRate');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate(gKeyFrames, 100 * MS_PER_SEC);
animation.playbackRate = 0.5;
animation.finish();
assert_equals(animation.playState, 'finished',
'The play state of a play-pending animation should become ' +
'"finished" after finish() is called');
@@ -150,96 +150,96 @@ test(function(t) {
'The start time of a play-pending animation should ' +
'be set after calling finish()');
}, 'Test finish() while play-pending');
// FIXME: Add a test for when we are play-pending without an active timeline.
// - In that case even after calling finish() we should still be pending but
// the current time should be updated
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate(gKeyFrames, 100 * MS_PER_SEC);
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
animation.pause();
animation.play();
// We are now in the unusual situation of being play-pending whilst having
// a resolved start time. Check that finish() still triggers a transition
// to the finished state immediately.
animation.finish();
assert_equals(animation.playState, 'finished',
'After aborting a pause then calling finish() the play ' +
'state of an animation should become "finished" immediately');
});
}, 'Test finish() during aborted pause');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
div.style.marginLeft = '10px';
var animation = div.animate(gKeyFrames, 100 * MS_PER_SEC);
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
animation.finish();
var marginLeft = parseFloat(getComputedStyle(div).marginLeft);
assert_equals(marginLeft, 10,
'The computed style should be reset when finish() is ' +
'called');
});
}, 'Test resetting of computed style');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate(gKeyFrames, 100 * MS_PER_SEC);
var resolvedFinished = false;
- animation.finished.then(function() {
+ animation.finished.then(() => {
resolvedFinished = true;
});
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
animation.finish();
- }).then(function() {
+ }).then(() => {
assert_true(resolvedFinished,
'Animation.finished should be resolved soon after ' +
'Animation.finish()');
});
}, 'Test finish() resolves finished promise synchronously');
-promise_test(function(t) {
+promise_test(t => {
var effect = new KeyframeEffectReadOnly(null, gKeyFrames, 100 * MS_PER_SEC);
var animation = new Animation(effect, document.timeline);
var resolvedFinished = false;
- animation.finished.then(function() {
+ animation.finished.then(() => {
resolvedFinished = true;
});
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
animation.finish();
- }).then(function() {
+ }).then(() => {
assert_true(resolvedFinished,
'Animation.finished should be resolved soon after ' +
'Animation.finish()');
});
}, 'Test finish() resolves finished promise synchronously with an animation ' +
'without a target');
-promise_test(function(t) {
+promise_test(t => {
var effect = new KeyframeEffectReadOnly(null, gKeyFrames, 100 * MS_PER_SEC);
var animation = new Animation(effect, document.timeline);
animation.play();
var resolvedFinished = false;
- animation.finished.then(function() {
+ animation.finished.then(() => {
resolvedFinished = true;
});
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
animation.currentTime = animation.effect.getComputedTiming().endTime - 1;
return waitForAnimationFrames(2);
- }).then(function() {
+ }).then(() => {
assert_true(resolvedFinished,
'Animation.finished should be resolved soon after ' +
'Animation finishes normally');
});
}, 'Test normally finished animation resolves finished promise synchronously ' +
'with an animation without a target');
</script>
--- a/testing/web-platform/tests/web-animations/interfaces/Animation/finished.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Animation/finished.html
@@ -5,415 +5,415 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
"use strict";
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
var previousFinishedPromise = animation.finished;
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
assert_equals(animation.finished, previousFinishedPromise,
'Finished promise is the same object when playing starts');
animation.pause();
assert_equals(animation.finished, previousFinishedPromise,
'Finished promise does not change when pausing');
animation.play();
assert_equals(animation.finished, previousFinishedPromise,
'Finished promise does not change when play() unpauses');
animation.currentTime = 100 * MS_PER_SEC;
return animation.finished;
- }).then(function() {
+ }).then(() => {
assert_equals(animation.finished, previousFinishedPromise,
'Finished promise is the same object when playing completes');
});
}, 'Test pausing then playing does not change the finished promise');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
var previousFinishedPromise = animation.finished;
animation.finish();
- return animation.finished.then(function() {
+ return animation.finished.then(() => {
assert_equals(animation.finished, previousFinishedPromise,
'Finished promise is the same object when playing completes');
animation.play();
assert_not_equals(animation.finished, previousFinishedPromise,
'Finished promise changes when replaying animation');
previousFinishedPromise = animation.finished;
animation.play();
assert_equals(animation.finished, previousFinishedPromise,
'Finished promise is the same after redundant play() call');
});
}, 'Test restarting a finished animation');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
var previousFinishedPromise;
animation.finish();
- return animation.finished.then(function() {
+ return animation.finished.then(() => {
previousFinishedPromise = animation.finished;
animation.playbackRate = -1;
assert_not_equals(animation.finished, previousFinishedPromise,
'Finished promise should be replaced when reversing a ' +
'finished promise');
animation.currentTime = 0;
return animation.finished;
- }).then(function() {
+ }).then(() => {
previousFinishedPromise = animation.finished;
animation.play();
assert_not_equals(animation.finished, previousFinishedPromise,
'Finished promise is replaced after play() call on ' +
'finished, reversed animation');
});
}, 'Test restarting a reversed finished animation');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
var previousFinishedPromise = animation.finished;
animation.finish();
- return animation.finished.then(function() {
+ return animation.finished.then(() => {
animation.currentTime = 100 * MS_PER_SEC + 1000;
assert_equals(animation.finished, previousFinishedPromise,
'Finished promise is unchanged jumping past end of ' +
'finished animation');
});
}, 'Test redundant finishing of animation');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
// Setup callback to run if finished promise is resolved
var finishPromiseResolved = false;
- animation.finished.then(function() {
+ animation.finished.then(() => {
finishPromiseResolved = true;
});
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
// Jump to mid-way in interval and pause
animation.currentTime = 100 * MS_PER_SEC / 2;
animation.pause();
return animation.ready;
- }).then(function() {
+ }).then(() => {
// Jump to the end
// (But don't use finish() since that should unpause as well)
animation.currentTime = 100 * MS_PER_SEC;
return waitForAnimationFrames(2);
- }).then(function() {
+ }).then(() => {
assert_false(finishPromiseResolved,
'Finished promise should not resolve when paused');
});
}, 'Finished promise does not resolve when paused');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
// Setup callback to run if finished promise is resolved
var finishPromiseResolved = false;
- animation.finished.then(function() {
+ animation.finished.then(() => {
finishPromiseResolved = true;
});
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
// Jump to mid-way in interval and pause
animation.currentTime = 100 * MS_PER_SEC / 2;
animation.pause();
// Jump to the end
animation.currentTime = 100 * MS_PER_SEC;
return waitForAnimationFrames(2);
- }).then(function() {
+ }).then(() => {
assert_false(finishPromiseResolved,
'Finished promise should not resolve when pause-pending');
});
}, 'Finished promise does not resolve when pause-pending');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
animation.finish();
- return animation.finished.then(function(resolvedAnimation) {
+ return animation.finished.then(resolvedAnimation => {
assert_equals(resolvedAnimation, animation,
'Object identity of animation passed to Promise callback'
+ ' matches the animation object owning the Promise');
});
}, 'The finished promise is fulfilled with its Animation');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
var previousFinishedPromise = animation.finished;
// Set up listeners on finished promise
- var retPromise = animation.finished.then(function() {
+ var retPromise = animation.finished.then(() => {
assert_unreached('finished promise was fulfilled');
- }).catch(function(err) {
+ }).catch(err => {
assert_equals(err.name, 'AbortError',
'finished promise is rejected with AbortError');
assert_not_equals(animation.finished, previousFinishedPromise,
'Finished promise should change after the original is ' +
'rejected');
});
animation.cancel();
return retPromise;
}, 'finished promise is rejected when an animation is cancelled by calling ' +
'cancel()');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
var previousFinishedPromise = animation.finished;
animation.finish();
- return animation.finished.then(function() {
+ return animation.finished.then(() => {
animation.cancel();
assert_not_equals(animation.finished, previousFinishedPromise,
'A new finished promise should be created when'
+ ' cancelling a finished animation');
});
}, 'cancelling an already-finished animation replaces the finished promise');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
animation.cancel();
// The spec says we still create a new finished promise and reject the old
// one even if we're already idle. That behavior might change, but for now
// test that we do that.
- var retPromise = animation.finished.catch(function(err) {
+ var retPromise = animation.finished.catch(err => {
assert_equals(err.name, 'AbortError',
'finished promise is rejected with AbortError');
});
// Redundant call to cancel();
var previousFinishedPromise = animation.finished;
animation.cancel();
assert_not_equals(animation.finished, previousFinishedPromise,
'A redundant call to cancel() should still generate a new'
+ ' finished promise');
return retPromise;
}, 'cancelling an idle animation still replaces the finished promise');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
const HALF_DUR = 100 * MS_PER_SEC / 2;
const QUARTER_DUR = 100 * MS_PER_SEC / 4;
var gotNextFrame = false;
var currentTimeBeforeShortening;
animation.currentTime = HALF_DUR;
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
currentTimeBeforeShortening = animation.currentTime;
animation.effect.timing.duration = QUARTER_DUR;
// Below we use gotNextFrame to check that shortening of the animation
// duration causes the finished promise to resolve, rather than it just
// getting resolved on the next animation frame. This relies on the fact
// that the promises are resolved as a micro-task before the next frame
// happens.
- waitForAnimationFrames(1).then(function() {
+ waitForAnimationFrames(1).then(() => {
gotNextFrame = true;
});
return animation.finished;
- }).then(function() {
+ }).then(() => {
assert_false(gotNextFrame, 'shortening of the animation duration should ' +
'resolve the finished promise');
assert_equals(animation.currentTime, currentTimeBeforeShortening,
'currentTime should be unchanged when duration shortened');
var previousFinishedPromise = animation.finished;
animation.effect.timing.duration = 100 * MS_PER_SEC;
assert_not_equals(animation.finished, previousFinishedPromise,
'Finished promise should change after lengthening the ' +
'duration causes the animation to become active');
});
}, 'Test finished promise changes for animation duration changes');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
- var retPromise = animation.ready.then(function() {
+ var retPromise = animation.ready.then(() => {
animation.playbackRate = 0;
animation.currentTime = 100 * MS_PER_SEC + 1000;
return waitForAnimationFrames(2);
});
- animation.finished.then(t.step_func(function() {
+ animation.finished.then(t.step_func(() => {
assert_unreached('finished promise should not resolve when playbackRate ' +
'is zero');
}));
return retPromise;
}, 'Test finished promise changes when playbackRate == 0');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
animation.playbackRate = -1;
return animation.finished;
});
}, 'Test finished promise resolves when reaching to the natural boundary.');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
var previousFinishedPromise = animation.finished;
animation.finish();
- return animation.finished.then(function() {
+ return animation.finished.then(() => {
animation.currentTime = 0;
assert_not_equals(animation.finished, previousFinishedPromise,
'Finished promise should change once a prior ' +
'finished promise resolved and the animation ' +
'falls out finished state');
});
}, 'Test finished promise changes when a prior finished promise resolved ' +
'and the animation falls out finished state');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
var previousFinishedPromise = animation.finished;
animation.currentTime = 100 * MS_PER_SEC;
animation.currentTime = 100 * MS_PER_SEC / 2;
assert_equals(animation.finished, previousFinishedPromise,
'No new finished promise generated when finished state ' +
'is checked asynchronously');
}, 'Test no new finished promise generated when finished state ' +
'is checked asynchronously');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
var previousFinishedPromise = animation.finished;
animation.finish();
animation.currentTime = 100 * MS_PER_SEC / 2;
assert_not_equals(animation.finished, previousFinishedPromise,
'New finished promise generated when finished state ' +
'is checked synchronously');
}, 'Test new finished promise generated when finished state ' +
'is checked synchronously');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
var resolvedFinished = false;
- animation.finished.then(function() {
+ animation.finished.then(() => {
resolvedFinished = true;
});
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
animation.finish();
animation.currentTime = 100 * MS_PER_SEC / 2;
- }).then(function() {
+ }).then(() => {
assert_true(resolvedFinished,
'Animation.finished should be resolved even if ' +
'the finished state is changed soon');
});
}, 'Test synchronous finished promise resolved even if finished state ' +
'is changed soon');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
var resolvedFinished = false;
- animation.finished.then(function() {
+ animation.finished.then(() => {
resolvedFinished = true;
});
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
animation.currentTime = 100 * MS_PER_SEC;
animation.finish();
- }).then(function() {
+ }).then(() => {
assert_true(resolvedFinished,
'Animation.finished should be resolved soon after finish() is ' +
'called even if there are other asynchronous promises just before it');
});
}, 'Test synchronous finished promise resolved even if asynchronous ' +
'finished promise happens just before synchronous promise');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
- animation.finished.then(t.step_func(function() {
+ animation.finished.then(t.step_func(() => {
assert_unreached('Animation.finished should not be resolved');
}));
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
animation.currentTime = 100 * MS_PER_SEC;
animation.currentTime = 100 * MS_PER_SEC / 2;
});
}, 'Test finished promise is not resolved when the animation ' +
'falls out finished state immediately');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
animation.currentTime = 100 * MS_PER_SEC;
- animation.finished.then(t.step_func(function() {
+ animation.finished.then(t.step_func(() => {
assert_unreached('Animation.finished should not be resolved');
}));
animation.currentTime = 0;
});
}, 'Test finished promise is not resolved once the animation ' +
'falls out finished state even though the current finished ' +
'promise is generated soon after animation state became finished');
-promise_test(function(t) {
+promise_test(t => {
var animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
var ready = false;
animation.ready.then(
- t.step_func(function() {
+ t.step_func(() => {
ready = true;
}),
t.unreached_func('Ready promise must not be rejected')
);
var testSuccess = animation.finished.then(
- t.step_func(function() {
+ t.step_func(() => {
assert_true(ready, 'Ready promise has resolved');
}),
t.unreached_func('Finished promise must not be rejected')
);
- var timeout = waitForAnimationFrames(3).then(function() {
+ var timeout = waitForAnimationFrames(3).then(() => {
return Promise.reject('Finished promise did not arrive in time');
});
animation.finish();
return Promise.race([timeout, testSuccess]);
}, 'Finished promise should be resolved after the ready promise is resolved');
-promise_test(function(t) {
+promise_test(t => {
var animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
var caught = false;
animation.ready.then(
t.unreached_func('Ready promise must not be resolved'),
- t.step_func(function() {
+ t.step_func(() => {
caught = true;
})
);
var testSuccess = animation.finished.then(
t.unreached_func('Finished promise must not be resolved'),
- t.step_func(function() {
+ t.step_func(() => {
assert_true(caught, 'Ready promise has been rejected');
})
);
- var timeout = waitForAnimationFrames(3).then(function() {
+ var timeout = waitForAnimationFrames(3).then(() => {
return Promise.reject('Finished promise was not rejected in time');
});
animation.cancel();
return Promise.race([timeout, testSuccess]);
}, 'Finished promise should be rejected after the ready promise is rejected');
</script>
--- a/testing/web-platform/tests/web-animations/interfaces/Animation/id.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Animation/id.html
@@ -5,23 +5,23 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
"use strict";
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
assert_equals(animation.id, '', 'id for Animation is initially empty');
}, 'Animation.id initial value');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
animation.id = 'anim';
assert_equals(animation.id, 'anim', 'animation.id reflects the value set');
}, 'Animation.id setter');
</script>
--- a/testing/web-platform/tests/web-animations/interfaces/Animation/oncancel.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Animation/oncancel.html
@@ -5,25 +5,25 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
"use strict";
-async_test(function(t) {
+async_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
var finishedTimelineTime;
- animation.finished.then().catch(function() {
+ animation.finished.then().catch(() => {
finishedTimelineTime = animation.timeline.currentTime;
});
- animation.oncancel = t.step_func_done(function(event) {
+ animation.oncancel = t.step_func_done(event => {
assert_equals(event.currentTime, null,
'event.currentTime should be null');
assert_equals(event.timelineTime, finishedTimelineTime,
'event.timelineTime should equal to the animation timeline ' +
'when finished promise is rejected');
});
animation.cancel();
--- a/testing/web-platform/tests/web-animations/interfaces/Animation/onfinish.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Animation/onfinish.html
@@ -5,116 +5,116 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
"use strict";
-async_test(function(t) {
+async_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
var finishedTimelineTime;
- animation.finished.then(function() {
+ animation.finished.then(() => {
finishedTimelineTime = animation.timeline.currentTime;
});
- animation.onfinish = t.step_func_done(function(event) {
+ animation.onfinish = t.step_func_done(event => {
assert_equals(event.currentTime, 0,
'event.currentTime should be zero');
assert_equals(event.timelineTime, finishedTimelineTime,
'event.timelineTime should equal to the animation timeline ' +
'when finished promise is resolved');
});
animation.playbackRate = -1;
}, 'onfinish event is fired when the currentTime < 0 and ' +
'the playbackRate < 0');
-async_test(function(t) {
+async_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
var finishedTimelineTime;
- animation.finished.then(function() {
+ animation.finished.then(() => {
finishedTimelineTime = animation.timeline.currentTime;
});
- animation.onfinish = t.step_func_done(function(event) {
+ animation.onfinish = t.step_func_done(event => {
assert_equals(event.currentTime, 100 * MS_PER_SEC,
'event.currentTime should be the effect end');
assert_equals(event.timelineTime, finishedTimelineTime,
'event.timelineTime should equal to the animation timeline ' +
'when finished promise is resolved');
});
animation.currentTime = 100 * MS_PER_SEC;
}, 'onfinish event is fired when the currentTime > 0 and ' +
'the playbackRate > 0');
-async_test(function(t) {
+async_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
var finishedTimelineTime;
- animation.finished.then(function() {
+ animation.finished.then(() => {
finishedTimelineTime = animation.timeline.currentTime;
});
- animation.onfinish = t.step_func_done(function(event) {
+ animation.onfinish = t.step_func_done(event => {
assert_equals(event.currentTime, 100 * MS_PER_SEC,
'event.currentTime should be the effect end');
assert_equals(event.timelineTime, finishedTimelineTime,
'event.timelineTime should equal to the animation timeline ' +
'when finished promise is resolved');
});
animation.finish();
}, 'onfinish event is fired when animation.finish() is called');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
- animation.onfinish = function(event) {
+ animation.onfinish = event => {
assert_unreached('onfinish event should not be fired');
};
animation.currentTime = 100 * MS_PER_SEC / 2;
animation.pause();
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
animation.currentTime = 100 * MS_PER_SEC;
return waitForAnimationFrames(2);
});
}, 'onfinish event is not fired when paused');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
- animation.onfinish = function(event) {
+ animation.onfinish = event => {
assert_unreached('onfinish event should not be fired');
};
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
animation.playbackRate = 0;
animation.currentTime = 100 * MS_PER_SEC;
return waitForAnimationFrames(2);
});
}, 'onfinish event is not fired when the playbackRate is zero');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
- animation.onfinish = function(event) {
+ animation.onfinish = event => {
assert_unreached('onfinish event should not be fired');
};
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
animation.currentTime = 100 * MS_PER_SEC;
animation.currentTime = 100 * MS_PER_SEC / 2;
return waitForAnimationFrames(2);
});
}, 'onfinish event is not fired when the animation falls out ' +
'finished state immediately');
</script>
--- a/testing/web-platform/tests/web-animations/interfaces/Animation/pause.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Animation/pause.html
@@ -5,94 +5,94 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
"use strict";
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 1000 * MS_PER_SEC);
var previousCurrentTime = animation.currentTime;
- return animation.ready.then(waitForAnimationFrames(1)).then(function() {
+ return animation.ready.then(waitForAnimationFrames(1)).then(() => {
assert_true(animation.currentTime >= previousCurrentTime,
'currentTime is initially increasing');
animation.pause();
return animation.ready;
- }).then(function() {
+ }).then(() => {
previousCurrentTime = animation.currentTime;
return waitForAnimationFrames(1);
- }).then(function() {
+ }).then(() => {
assert_equals(animation.currentTime, previousCurrentTime,
'currentTime does not increase after calling pause()');
});
}, 'pause() a running animation');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 1000 * MS_PER_SEC);
// Go to idle state then pause
animation.cancel();
animation.pause();
assert_equals(animation.currentTime, 0, 'currentTime is set to 0');
assert_equals(animation.startTime, null, 'startTime is not set');
assert_equals(animation.playState, 'pending', 'initially pause-pending');
// Check it still resolves as expected
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
assert_equals(animation.playState, 'paused',
'resolves to paused state asynchronously');
assert_equals(animation.currentTime, 0,
'keeps the initially set currentTime');
});
}, 'pause() from idle');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 1000 * MS_PER_SEC);
animation.cancel();
animation.playbackRate = -1;
animation.pause();
assert_equals(animation.currentTime, 1000 * MS_PER_SEC,
'currentTime is set to the effect end');
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
assert_equals(animation.currentTime, 1000 * MS_PER_SEC,
'keeps the initially set currentTime');
});
}, 'pause() from idle with a negative playbackRate');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate({}, {duration: 1000 * MS_PER_SEC,
iterations: Infinity});
animation.cancel();
animation.playbackRate = -1;
assert_throws('InvalidStateError',
- function () { animation.pause(); },
+ () => { animation.pause(); },
'Expect InvalidStateError exception on calling pause() ' +
'from idle with a negative playbackRate and ' +
'infinite-duration animation');
}, 'pause() from idle with a negative playbackRate and endless effect');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 1000 * MS_PER_SEC);
return animation.ready
- .then(function(animation) {
+ .then(animation => {
animation.finish();
animation.pause();
return animation.ready;
- }).then(function(animation) {
+ }).then(animation => {
assert_equals(animation.currentTime, 1000 * MS_PER_SEC,
'currentTime after pausing finished animation');
});
}, 'pause() on a finished animation');
</script>
</body>
--- a/testing/web-platform/tests/web-animations/interfaces/Animation/play.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Animation/play.html
@@ -5,29 +5,29 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({ transform: ['none', 'translate(10px)']},
{ duration : 100 * MS_PER_SEC,
iterations : Infinity});
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
// Seek to a time outside the active range so that play() will have to
// snap back to the start
animation.currentTime = -5 * MS_PER_SEC;
animation.playbackRate = -1;
assert_throws('InvalidStateError',
- function () { animation.play(); },
+ () => { animation.play(); },
'Expected InvalidStateError exception on calling play() ' +
'with a negative playbackRate and infinite-duration ' +
'animation');
});
}, 'play() throws when seeking an infinite-duration animation played in ' +
'reverse');
</script>
--- a/testing/web-platform/tests/web-animations/interfaces/Animation/playState.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Animation/playState.html
@@ -5,46 +5,46 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
assert_equals(animation.playState, 'pending');
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
assert_equals(animation.playState, 'running');
});
}, 'Animation.playState reports \'pending\'->\'running\' when initially ' +
'played');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
animation.pause();
assert_equals(animation.playState, 'pending');
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
assert_equals(animation.playState, 'paused');
});
}, 'Animation.playState reports \'pending\'->\'paused\' when pausing');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
animation.cancel();
assert_equals(animation.playState, 'idle');
}, 'Animation.playState is \'idle\' when canceled.');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
animation.cancel();
animation.currentTime = 50 * MS_PER_SEC;
assert_equals(animation.playState, 'paused',
'After seeking an idle animation, it is effectively paused');
}, 'Animation.playState is \'paused\' after cancelling an animation, ' +
'seeking it makes it paused');
--- a/testing/web-platform/tests/web-animations/interfaces/Animation/playbackRate.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Animation/playbackRate.html
@@ -21,63 +21,63 @@ function assert_playbackrate(animation,
animation.timeline.currentTime - previousTimelineCurrentTime;
assert_approx_equals(animationCurrentTimeDifference,
timelineCurrentTimeDifference * animation.playbackRate,
accuracy,
description);
}
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate(null, 100 * MS_PER_SEC);
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
animation.currentTime = 7 * MS_PER_SEC; // ms
animation.playbackRate = 0.5;
assert_equals(animation.currentTime, 7 * MS_PER_SEC,
'Reducing Animation.playbackRate should not change the currentTime ' +
'of a playing animation');
animation.playbackRate = 2;
assert_equals(animation.currentTime, 7 * MS_PER_SEC,
'Increasing Animation.playbackRate should not change the currentTime ' +
'of a playing animation');
});
}, 'Test the initial effect of setting playbackRate on currentTime');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate(null, 100 * MS_PER_SEC);
animation.playbackRate = 2;
var previousTimelineCurrentTime;
var previousAnimationCurrentTime;
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
previousAnimationCurrentTime = animation.currentTime;
previousTimelineCurrentTime = animation.timeline.currentTime;
return waitForAnimationFrames(1);
- }).then(function() {
+ }).then(() => {
assert_playbackrate(animation,
previousAnimationCurrentTime,
previousTimelineCurrentTime,
'animation.currentTime should be 2 times faster than timeline.');
});
}, 'Test the effect of setting playbackRate on currentTime');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate(null, 100 * MS_PER_SEC);
animation.playbackRate = 2;
var previousTimelineCurrentTime;
var previousAnimationCurrentTime;
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
previousAnimationCurrentTime = animation.currentTime;
previousTimelineCurrentTime = animation.timeline.currentTime;
animation.playbackRate = 1;
return waitForAnimationFrames(1);
- }).then(function() {
+ }).then(() => {
assert_equals(animation.playbackRate, 1,
'sanity check: animation.playbackRate is still 1.');
assert_playbackrate(animation,
previousAnimationCurrentTime,
previousTimelineCurrentTime,
'animation.currentTime should be the same speed as timeline now.');
});
}, 'Test the effect of setting playbackRate while playing animation');
--- a/testing/web-platform/tests/web-animations/interfaces/Animation/ready.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Animation/ready.html
@@ -5,57 +5,57 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
"use strict";
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate(null, 100 * MS_PER_SEC);
var originalReadyPromise = animation.ready;
var pauseReadyPromise;
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
assert_equals(animation.ready, originalReadyPromise,
'Ready promise is the same object when playing completes');
animation.pause();
assert_not_equals(animation.ready, originalReadyPromise,
'A new ready promise is created when pausing');
pauseReadyPromise = animation.ready;
// Wait for the promise to fulfill since if we abort the pause the ready
// promise object is reused.
return animation.ready;
- }).then(function() {
+ }).then(() => {
animation.play();
assert_not_equals(animation.ready, pauseReadyPromise,
'A new ready promise is created when playing');
});
}, 'A new ready promise is created when play()/pause() is called');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate(null, 100 * MS_PER_SEC);
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
var promiseBeforeCallingPlay = animation.ready;
animation.play();
assert_equals(animation.ready, promiseBeforeCallingPlay,
'Ready promise has same object identity after redundant call'
+ ' to play()');
});
}, 'Redundant calls to play() do not generate new ready promise objects');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate(null, 100 * MS_PER_SEC);
- return animation.ready.then(function(resolvedAnimation) {
+ return animation.ready.then(resolvedAnimation => {
assert_equals(resolvedAnimation, animation,
'Object identity of Animation passed to Promise callback'
+ ' matches the Animation object owning the Promise');
});
}, 'The ready promise is fulfilled with its Animation');
</script>
</body>
--- a/testing/web-platform/tests/web-animations/interfaces/Animation/startTime.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Animation/startTime.html
@@ -6,50 +6,50 @@ href="https://w3c.github.io/web-animatio
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
-test(function(t) {
+test(t => {
var animation = new Animation(new KeyframeEffect(createDiv(t), null),
document.timeline);
assert_equals(animation.startTime, null, 'startTime is unresolved');
}, 'startTime of a newly created (idle) animation is unresolved');
-test(function(t) {
+test(t => {
var animation = new Animation(new KeyframeEffect(createDiv(t), null),
document.timeline);
animation.play();
assert_equals(animation.startTime, null, 'startTime is unresolved');
}, 'startTime of a play-pending animation is unresolved');
-test(function(t) {
+test(t => {
var animation = new Animation(new KeyframeEffect(createDiv(t), null),
document.timeline);
animation.pause();
assert_equals(animation.startTime, null, 'startTime is unresolved');
}, 'startTime of a pause-pending animation is unresolved');
-test(function(t) {
+test(t => {
var animation = createDiv(t).animate(null);
assert_equals(animation.startTime, null, 'startTime is unresolved');
}, 'startTime of a play-pending animation created using Element.animate'
+ ' shortcut is unresolved');
-promise_test(function(t) {
+promise_test(t => {
var animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
assert_greater_than(animation.startTime, 0, 'startTime when running');
});
}, 'startTime is resolved when running');
-test(function(t) {
+test(t => {
var animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
animation.cancel();
assert_equals(animation.startTime, null);
assert_equals(animation.currentTime, null);
}, 'startTime and currentTime are unresolved when animation is cancelled');
</script>
</body>
--- a/testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/delay.html
+++ b/testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/delay.html
@@ -5,74 +5,74 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate(null);
assert_equals(anim.effect.timing.delay, 0);
}, 'Has the default value 0');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 100);
anim.effect.timing.delay = 100;
assert_equals(anim.effect.timing.delay, 100, 'set delay 100');
assert_equals(anim.effect.getComputedTiming().delay, 100,
'getComputedTiming() after set delay 100');
}, 'Can be set to a positive number');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 100);
anim.effect.timing.delay = -100;
assert_equals(anim.effect.timing.delay, -100, 'set delay -100');
assert_equals(anim.effect.getComputedTiming().delay, -100,
'getComputedTiming() after set delay -100');
}, 'Can be set to a negative number');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 100);
anim.effect.timing.delay = 100;
assert_equals(anim.effect.getComputedTiming().progress, null);
assert_equals(anim.effect.getComputedTiming().currentIteration, null);
}, 'Can set a positive delay on an animation without a backwards fill to'
+ ' make it no longer active');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] },
{ fill: 'both',
duration: 100 });
anim.effect.timing.delay = -50;
assert_equals(anim.effect.getComputedTiming().progress, 0.5);
}, 'Can set a negative delay to seek into the active interval');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] },
{ fill: 'both',
duration: 100 });
anim.effect.timing.delay = -100;
assert_equals(anim.effect.getComputedTiming().progress, 1);
assert_equals(anim.effect.getComputedTiming().currentIteration, 0);
}, 'Can set a large negative delay to finishing an animation');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate(null);
for (let invalid of [NaN, Infinity]) {
- assert_throws({ name: 'TypeError' }, function() {
+ assert_throws({ name: 'TypeError' }, () => {
anim.effect.timing.delay = invalid;
}, 'setting ' + invalid);
- assert_throws({ name: 'TypeError' }, function() {
+ assert_throws({ name: 'TypeError' }, () => {
div.animate({}, { delay: invalid });
}, 'animate() with ' + invalid);
}
}, 'Throws when setting invalid values');
</script>
</body>
--- a/testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/direction.html
+++ b/testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/direction.html
@@ -5,94 +5,94 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate(null);
assert_equals(anim.effect.timing.direction, 'normal');
}, 'Has the default value \'normal\'');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
var directions = ['normal', 'reverse', 'alternate', 'alternate-reverse'];
- directions.forEach(function(direction) {
+ directions.forEach(direction => {
anim.effect.timing.direction = direction;
assert_equals(anim.effect.timing.direction, direction,
'set direction to ' + direction);
});
}, 'Can be set to each of the possible keywords');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate(null, { duration: 10000, direction: 'normal' });
anim.currentTime = 7000;
assert_times_equal(anim.effect.getComputedTiming().progress, 0.7,
'progress before updating direction');
anim.effect.timing.direction = 'reverse';
assert_times_equal(anim.effect.getComputedTiming().progress, 0.3,
'progress after updating direction');
}, 'Can be changed from \'normal\' to \'reverse\' while in progress');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] },
{ duration: 10000,
direction: 'normal' });
assert_equals(anim.effect.getComputedTiming().progress, 0,
'progress before updating direction');
anim.effect.timing.direction = 'reverse';
assert_equals(anim.effect.getComputedTiming().progress, 1,
'progress after updating direction');
}, 'Can be changed from \'normal\' to \'reverse\' while at start of active'
+ ' interval');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] },
{ fill: 'backwards',
duration: 10000,
delay: 10000,
direction: 'normal' });
assert_equals(anim.effect.getComputedTiming().progress, 0,
'progress before updating direction');
anim.effect.timing.direction = 'reverse';
assert_equals(anim.effect.getComputedTiming().progress, 1,
'progress after updating direction');
}, 'Can be changed from \'normal\' to \'reverse\' while filling backwards');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] },
{ iterations: 2,
duration: 10000,
direction: 'normal' });
anim.currentTime = 17000;
assert_times_equal(anim.effect.getComputedTiming().progress, 0.7,
'progress before updating direction');
anim.effect.timing.direction = 'alternate';
assert_times_equal(anim.effect.getComputedTiming().progress, 0.3,
'progress after updating direction');
}, 'Can be changed from \'normal\' to \'alternate\' while in progress');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] },
{ iterations: 2,
duration: 10000,
direction: 'alternate' });
anim.currentTime = 17000;
assert_times_equal(anim.effect.getComputedTiming().progress, 0.3,
'progress before updating direction');
--- a/testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/duration.html
+++ b/testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/duration.html
@@ -5,158 +5,158 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate(null);
assert_equals(anim.effect.timing.duration, 'auto');
}, 'Has the default value \'auto\'');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
anim.effect.timing.duration = 123.45;
assert_times_equal(anim.effect.timing.duration, 123.45,
'set duration 123.45');
assert_times_equal(anim.effect.getComputedTiming().duration, 123.45,
'getComputedTiming() after set duration 123.45');
}, 'Can be set to a double value');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
anim.effect.timing.duration = 'auto';
assert_equals(anim.effect.timing.duration, 'auto', 'set duration \'auto\'');
assert_equals(anim.effect.getComputedTiming().duration, 0,
'getComputedTiming() after set duration \'auto\'');
}, 'Can be set to the string \'auto\'');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, { duration: 'auto' });
assert_equals(anim.effect.timing.duration, 'auto', 'set duration \'auto\'');
assert_equals(anim.effect.getComputedTiming().duration, 0,
'getComputedTiming() after set duration \'auto\'');
}, 'Can be set to \'auto\' using a dictionary object');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
anim.effect.timing.duration = Infinity;
assert_equals(anim.effect.timing.duration, Infinity, 'set duration Infinity');
assert_equals(anim.effect.getComputedTiming().duration, Infinity,
'getComputedTiming() after set duration Infinity');
}, 'Can be set to Infinity');
-test(function(t) {
+test(t => {
var div = createDiv(t);
- assert_throws({ name: 'TypeError' }, function() {
+ assert_throws({ name: 'TypeError' }, () => {
div.animate({ opacity: [ 0, 1 ] }, -1);
});
}, 'animate() throws when passed a negative number');
-test(function(t) {
+test(t => {
var div = createDiv(t);
- assert_throws({ name: 'TypeError' }, function() {
+ assert_throws({ name: 'TypeError' }, () => {
div.animate({ opacity: [ 0, 1 ] }, -Infinity);
});
}, 'animate() throws when passed negative Infinity');
-test(function(t) {
+test(t => {
var div = createDiv(t);
- assert_throws({ name: 'TypeError' }, function() {
+ assert_throws({ name: 'TypeError' }, () => {
div.animate({ opacity: [ 0, 1 ] }, NaN);
});
}, 'animate() throws when passed a NaN value');
-test(function(t) {
+test(t => {
var div = createDiv(t);
- assert_throws({ name: 'TypeError' }, function() {
+ assert_throws({ name: 'TypeError' }, () => {
div.animate({ opacity: [ 0, 1 ] }, { duration: -1 });
});
}, 'animate() throws when passed a negative number using a dictionary object');
-test(function(t) {
+test(t => {
var div = createDiv(t);
- assert_throws({ name: 'TypeError' }, function() {
+ assert_throws({ name: 'TypeError' }, () => {
div.animate({ opacity: [ 0, 1 ] }, { duration: -Infinity });
});
}, 'animate() throws when passed negative Infinity using a dictionary object');
-test(function(t) {
+test(t => {
var div = createDiv(t);
- assert_throws({ name: 'TypeError' }, function() {
+ assert_throws({ name: 'TypeError' }, () => {
div.animate({ opacity: [ 0, 1 ] }, { duration: NaN });
});
}, 'animate() throws when passed a NaN value using a dictionary object');
-test(function(t) {
+test(t => {
var div = createDiv(t);
- assert_throws({ name: 'TypeError' }, function() {
+ assert_throws({ name: 'TypeError' }, () => {
div.animate({ opacity: [ 0, 1 ] }, { duration: 'abc' });
});
}, 'animate() throws when passed a string other than \'auto\' using a'
+ ' dictionary object');
-test(function(t) {
+test(t => {
var div = createDiv(t);
- assert_throws({ name: 'TypeError' }, function() {
+ assert_throws({ name: 'TypeError' }, () => {
div.animate({ opacity: [ 0, 1 ] }, { duration: '100' });
});
}, 'animate() throws when passed a string containing a number using a'
+ ' dictionary object');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
- assert_throws({ name: 'TypeError' }, function() {
+ assert_throws({ name: 'TypeError' }, () => {
anim.effect.timing.duration = -1;
});
}, 'Throws when setting a negative number');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
- assert_throws({ name: 'TypeError' }, function() {
+ assert_throws({ name: 'TypeError' }, () => {
anim.effect.timing.duration = -Infinity;
});
}, 'Throws when setting negative infinity');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
- assert_throws({ name: 'TypeError' }, function() {
+ assert_throws({ name: 'TypeError' }, () => {
anim.effect.timing.duration = NaN;
});
}, 'Throws when setting a NaN value');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
- assert_throws({ name: 'TypeError' }, function() {
+ assert_throws({ name: 'TypeError' }, () => {
anim.effect.timing.duration = 'abc';
});
}, 'Throws when setting a string other than \'auto\'');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
- assert_throws({ name: 'TypeError' }, function() {
+ assert_throws({ name: 'TypeError' }, () => {
anim.effect.timing.duration = '100';
});
}, 'Throws when setting a string containing a number');
-promise_test(function(t) {
+promise_test(t => {
var anim = createDiv(t).animate(null, 100 * MS_PER_SEC);
- return anim.ready.then(function() {
+ return anim.ready.then(() => {
var originalStartTime = anim.startTime;
var originalCurrentTime = anim.currentTime;
assert_equals(anim.effect.getComputedTiming().duration, 100 * MS_PER_SEC,
'Initial duration should be as set on KeyframeEffect');
anim.effect.timing.duration = 200 * MS_PER_SEC;
assert_equals(anim.effect.getComputedTiming().duration, 200 * MS_PER_SEC,
'Effect duration should have been updated');
@@ -164,17 +164,17 @@ promise_test(function(t) {
'startTime should be unaffected by changing effect ' +
'duration');
assert_times_equal(anim.currentTime, originalCurrentTime,
'currentTime should be unaffected by changing effect ' +
'duration');
});
}, 'Extending an effect\'s duration does not change the start or current time');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate(null, { duration: 100000, fill: 'both' });
anim.finish();
assert_equals(anim.effect.getComputedTiming().progress, 1,
'progress when animation is finished');
anim.effect.timing.duration *= 2;
assert_times_equal(anim.effect.getComputedTiming().progress, 0.5,
'progress after doubling the duration');
--- a/testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/easing.html
+++ b/testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/easing.html
@@ -6,33 +6,33 @@
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<script src="../../resources/easing-tests.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate(null);
assert_equals(anim.effect.timing.easing, 'linear');
}, 'Has the default value \'linear\'');
function assert_progress(animation, currentTime, easingFunction) {
animation.currentTime = currentTime;
var portion = currentTime / animation.effect.timing.duration;
assert_approx_equals(animation.effect.getComputedTiming().progress,
easingFunction(portion),
0.01,
'The progress of the animation should be approximately ' +
easingFunction(portion) + ' at ' + currentTime + 'ms');
}
-gEasingTests.forEach(function(options) {
- test(function(t) {
+gEasingTests.forEach(options => {
+ test(t => {
var target = createDiv(t);
var anim = target.animate([ { opacity: 0 }, { opacity: 1 } ],
{ duration: 1000 * MS_PER_SEC,
fill: 'forwards' });
anim.effect.timing.easing = options.easing;
assert_equals(anim.effect.timing.easing,
options.serialization || options.easing);
@@ -40,36 +40,36 @@ gEasingTests.forEach(function(options) {
assert_progress(anim, 0, easing);
assert_progress(anim, 250 * MS_PER_SEC, easing);
assert_progress(anim, 500 * MS_PER_SEC, easing);
assert_progress(anim, 750 * MS_PER_SEC, easing);
assert_progress(anim, 1000 * MS_PER_SEC, easing);
}, options.desc);
});
-gInvalidEasings.forEach(function(invalidEasing) {
- test(function(t) {
+gInvalidEasings.forEach(invalidEasing => {
+ test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 100 * MS_PER_SEC);
assert_throws({ name: 'TypeError' },
- function() {
+ () => {
anim.effect.timing.easing = invalidEasing;
});
}, 'Throws on invalid easing: \'' + invalidEasing + '\'');
});
gRoundtripEasings.forEach(easing => {
- test(function(t) {
+ test(t => {
const anim = createDiv(t).animate(null);
anim.effect.timing.easing = easing;
assert_equals(anim.effect.timing.easing, easing);
}, `Canonical easing '${easing}' is returned as set`);
});
-test(function(t) {
+test(t => {
var delay = 1000 * MS_PER_SEC;
var target = createDiv(t);
var anim = target.animate([ { opacity: 0 }, { opacity: 1 } ],
{ duration: 1000 * MS_PER_SEC,
fill: 'both',
delay: delay,
easing: 'steps(2, start)' });
--- a/testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/endDelay.html
+++ b/testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/endDelay.html
@@ -5,85 +5,85 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate(null);
assert_equals(anim.effect.timing.endDelay, 0);
}, 'Has the default value 0');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
anim.effect.timing.endDelay = 123.45;
assert_times_equal(anim.effect.timing.endDelay, 123.45,
'set endDelay 123.45');
assert_times_equal(anim.effect.getComputedTiming().endDelay, 123.45,
'getComputedTiming() after set endDelay 123.45');
}, 'Can be set to a positive number');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
anim.effect.timing.endDelay = -1000;
assert_equals(anim.effect.timing.endDelay, -1000, 'set endDelay -1000');
assert_equals(anim.effect.getComputedTiming().endDelay, -1000,
'getComputedTiming() after set endDelay -1000');
}, 'Can be set to a negative number');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
- assert_throws({name: "TypeError"}, function() {
+ assert_throws({name: "TypeError"}, () => {
anim.effect.timing.endDelay = Infinity;
}, 'we can not assign Infinity to timing.endDelay');
}, 'Throws when setting infinity');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
- assert_throws({name: "TypeError"}, function() {
+ assert_throws({name: "TypeError"}, () => {
anim.effect.timing.endDelay = -Infinity;
}, 'we can not assign negative Infinity to timing.endDelay');
}, 'Throws when setting negative infinity');
-async_test(function(t) {
+async_test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] },
{ duration: 100000, endDelay: 50000 });
- anim.onfinish = t.step_func(function(event) {
+ anim.onfinish = t.step_func(event => {
assert_unreached('finish event should not be fired');
});
- anim.ready.then(function() {
+ anim.ready.then(() => {
anim.currentTime = 100000;
return waitForAnimationFrames(2);
- }).then(t.step_func(function() {
+ }).then(t.step_func(() => {
t.done();
}));
}, 'finish event is not fired at the end of the active interval when the'
+ ' endDelay has not expired');
-async_test(function(t) {
+async_test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] },
{ duration: 100000, endDelay: 30000 });
- anim.ready.then(function() {
+ anim.ready.then(() => {
anim.currentTime = 110000; // during endDelay
- anim.onfinish = t.step_func(function(event) {
+ anim.onfinish = t.step_func(event => {
assert_unreached('onfinish event should not be fired during endDelay');
});
return waitForAnimationFrames(2);
- }).then(t.step_func(function() {
- anim.onfinish = t.step_func(function(event) {
+ }).then(t.step_func(() => {
+ anim.onfinish = t.step_func(event => {
t.done();
});
anim.currentTime = 130000; // after endTime
}));
}, 'finish event is fired after the endDelay has expired');
</script>
</body>
--- a/testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/fill.html
+++ b/testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/fill.html
@@ -5,23 +5,23 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate(null);
assert_equals(anim.effect.timing.fill, 'auto');
}, 'Has the default value \'auto\'');
-["none", "forwards", "backwards", "both", ].forEach(function(fill){
- test(function(t) {
+["none", "forwards", "backwards", "both", ].forEach(fill => {
+ test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 100);
anim.effect.timing.fill = fill;
assert_equals(anim.effect.timing.fill, fill, 'set fill ' + fill);
assert_equals(anim.effect.getComputedTiming().fill, fill,
'getComputedTiming() after set fill ' + fill);
}, 'Can set fill to ' + fill);
});
--- a/testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/iterationStart.html
+++ b/testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/iterationStart.html
@@ -5,68 +5,68 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate(null);
assert_equals(anim.effect.timing.iterationStart, 0);
}, 'Has the default value 0');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] },
{ iterationStart: 0.2,
iterations: 1,
fill: 'both',
duration: 100,
delay: 1 });
anim.effect.timing.iterationStart = 2.5;
assert_equals(anim.effect.getComputedTiming().progress, 0.5);
assert_equals(anim.effect.getComputedTiming().currentIteration, 2);
}, 'Changing the value updates computed timing when backwards-filling');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] },
{ iterationStart: 0.2,
iterations: 1,
fill: 'both',
duration: 100,
delay: 0 });
anim.effect.timing.iterationStart = 2.5;
assert_equals(anim.effect.getComputedTiming().progress, 0.5);
assert_equals(anim.effect.getComputedTiming().currentIteration, 2);
}, 'Changing the value updates computed timing during the active phase');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] },
{ iterationStart: 0.2,
iterations: 1,
fill: 'both',
duration: 100,
delay: 0 });
anim.finish();
anim.effect.timing.iterationStart = 2.5;
assert_equals(anim.effect.getComputedTiming().progress, 0.5);
assert_equals(anim.effect.getComputedTiming().currentIteration, 3);
}, 'Changing the value updates computed timing when forwards-filling');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate(null);
for (let invalid of [-1, NaN, Infinity]) {
- assert_throws({ name: 'TypeError' }, function() {
+ assert_throws({ name: 'TypeError' }, () => {
anim.effect.timing.iterationStart = invalid;
}, 'setting ' + invalid);
- assert_throws({ name: 'TypeError' }, function() {
+ assert_throws({ name: 'TypeError' }, () => {
div.animate({}, { iterationStart: invalid });
}, 'animate() with ' + invalid);
}
}, 'Throws when setting invalid values');
</script>
</body>
--- a/testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/iterations.html
+++ b/testing/web-platform/tests/web-animations/interfaces/AnimationEffectTiming/iterations.html
@@ -5,64 +5,64 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate(null);
assert_equals(anim.effect.timing.iterations, 1);
}, 'Has the default value 1');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
anim.effect.timing.iterations = 2;
assert_equals(anim.effect.timing.iterations, 2, 'set duration 2');
assert_equals(anim.effect.getComputedTiming().iterations, 2,
'getComputedTiming() after set iterations 2');
}, 'Can be set to a double value');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
anim.effect.timing.iterations = Infinity;
assert_equals(anim.effect.timing.iterations, Infinity, 'set duration Infinity');
assert_equals(anim.effect.getComputedTiming().iterations, Infinity,
'getComputedTiming() after set iterations Infinity');
}, 'Can be set to infinity');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
- assert_throws({ name: 'TypeError' }, function() {
+ assert_throws({ name: 'TypeError' }, () => {
anim.effect.timing.iterations = -1;
});
}, 'Throws when setting a negative number');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
- assert_throws({ name: 'TypeError' }, function() {
+ assert_throws({ name: 'TypeError' }, () => {
anim.effect.timing.iterations = -Infinity;
});
}, 'Throws when setting negative infinity');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, 2000);
- assert_throws({ name: 'TypeError' }, function() {
+ assert_throws({ name: 'TypeError' }, () => {
anim.effect.timing.iterations = NaN;
});
}, 'Throws when setting a NaN value');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate(null, { duration: 100000, fill: 'both' });
anim.finish();
assert_equals(anim.effect.getComputedTiming().progress, 1,
'progress when animation is finished');
assert_equals(anim.effect.getComputedTiming().currentIteration, 0,
--- a/testing/web-platform/tests/web-animations/interfaces/AnimationPlaybackEvent/constructor.html
+++ b/testing/web-platform/tests/web-animations/interfaces/AnimationPlaybackEvent/constructor.html
@@ -4,24 +4,24 @@
<link rel="help"
href="https://w3c.github.io/web-animations/#dom-animationplaybackevent-animationplaybackevent">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<div id="log"></div>
<script>
'use strict';
-test(function(t) {
+test(t => {
const evt = new AnimationPlaybackEvent('finish');
assert_equals(evt.type, 'finish');
assert_equals(evt.currentTime, null);
assert_equals(evt.timelineTime, null);
}, 'Event created without an event parameter has null time values');
-test(function(t) {
+test(t => {
const evt =
new AnimationPlaybackEvent('cancel', {
currentTime: -100,
timelineTime: 100,
});
assert_equals(evt.type, 'cancel');
assert_equals(evt.currentTime, -100);
assert_equals(evt.timelineTime, 100);
--- a/testing/web-platform/tests/web-animations/interfaces/Document/getAnimations.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Document/getAnimations.html
@@ -8,45 +8,45 @@
<body>
<div id="log"></div>
<div id="target"></div>
<script>
"use strict";
var gKeyFrames = { 'marginLeft': ['100px', '200px'] };
-test(function(t) {
+test(t => {
assert_equals(document.getAnimations().length, 0,
'getAnimations returns an empty sequence for a document ' +
'with no animations');
}, 'Test document.getAnimations for non-animated content');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim1 = div.animate(gKeyFrames, 100 * MS_PER_SEC);
var anim2 = div.animate(gKeyFrames, 100 * MS_PER_SEC);
assert_equals(document.getAnimations().length, 2,
'getAnimation returns running animations');
anim1.finish();
anim2.finish();
assert_equals(document.getAnimations().length, 0,
'getAnimation only returns running animations');
}, 'Test document.getAnimations for script-generated animations')
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim1 = div.animate(gKeyFrames, 100 * MS_PER_SEC);
var anim2 = div.animate(gKeyFrames, 100 * MS_PER_SEC);
assert_array_equals(document.getAnimations(),
[ anim1, anim2 ],
'getAnimations() returns running animations');
}, 'Test the order of document.getAnimations with script generated animations')
-test(function(t) {
+test(t => {
var effect = new KeyframeEffectReadOnly(null, gKeyFrames, 100 * MS_PER_SEC);
var anim = new Animation(effect, document.timeline);
anim.play();
assert_equals(document.getAnimations().length, 0,
'document.getAnimations() only returns animations targeting ' +
'elements in this document');
}, 'Test document.getAnimations with null target');
--- a/testing/web-platform/tests/web-animations/interfaces/Document/timeline.html
+++ b/testing/web-platform/tests/web-animations/interfaces/Document/timeline.html
@@ -5,17 +5,17 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<div id="log"></div>
<iframe width="10" height="10" id="iframe"></iframe>
<script>
'use strict';
-test(function() {
+test(() => {
assert_equals(document.timeline, document.timeline,
'Document.timeline returns the same object every time');
const iframe = document.getElementById('iframe');
assert_not_equals(document.timeline, iframe.contentDocument.timeline,
'Document.timeline returns a different object for each document');
assert_not_equals(iframe.contentDocument.timeline, null,
'Document.timeline on an iframe is not null');
}, 'Document.timeline returns the default document timeline');
--- a/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/composite.html
+++ b/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/composite.html
@@ -6,40 +6,40 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate(null);
assert_equals(anim.effect.composite, 'replace',
'The default value should be replace');
}, 'Default value');
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate(null);
anim.effect.composite = 'add';
assert_equals(anim.effect.composite, 'add',
'The effect composite value should be replaced');
}, 'Change composite value');
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate({ left: '10px' });
anim.effect.composite = 'add';
var keyframes = anim.effect.getKeyframes();
assert_equals(keyframes[0].composite, undefined,
'unspecified keyframe composite value should be absent even ' +
'if effect composite is set');
}, 'Unspecified keyframe composite value when setting effect composite');
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate({ left: '10px', composite: 'replace' });
anim.effect.composite = 'add';
var keyframes = anim.effect.getKeyframes();
assert_equals(keyframes[0].composite, 'replace',
'specified keyframe composite value should not be overridden ' +
'by setting effect composite');
}, 'Specified keyframe composite value when setting effect composite');
--- a/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/constructor.html
+++ b/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/constructor.html
@@ -14,125 +14,123 @@
<body>
<div id="log"></div>
<div id="target"></div>
<script>
'use strict';
const target = document.getElementById('target');
-test(function(t) {
- gEmptyKeyframeListTests.forEach(function(frames) {
+test(t => {
+ gEmptyKeyframeListTests.forEach(frames => {
assert_equals(new KeyframeEffectReadOnly(target, frames)
.getKeyframes().length,
0, 'number of frames for ' + JSON.stringify(frames));
});
}, 'A KeyframeEffectReadOnly can be constructed with no frames');
-test(function(t) {
- gEasingParsingTests.forEach(function(subtest) {
+test(t => {
+ gEasingParsingTests.forEach(subtest => {
const easing = subtest[0];
const expected = subtest[1];
const effect = new KeyframeEffectReadOnly(target, {
left: ['10px', '20px']
}, { easing: easing });
assert_equals(effect.timing.easing, expected,
`resulting easing for '${easing}'`);
});
}, 'easing values are parsed correctly when passed to the ' +
'KeyframeEffectReadOnly constructor in KeyframeEffectOptions');
-test(function(t) {
+test(t => {
gInvalidEasings.forEach(invalidEasing => {
assert_throws(new TypeError, () => {
new KeyframeEffectReadOnly(target, null, { easing: invalidEasing });
}, `TypeError is thrown for easing '${invalidEasing}'`);
});
}, 'Invalid easing values are correctly rejected when passed to the ' +
'KeyframeEffectReadOnly constructor in KeyframeEffectOptions');
-test(function(t) {
- const getKeyframe = function(composite) {
- return { left: [ '10px', '20px' ], composite: composite };
- };
- gGoodKeyframeCompositeValueTests.forEach(function(composite) {
+test(t => {
+ const getKeyframe =
+ composite => ({ left: [ '10px', '20px' ], composite: composite });
+ gGoodKeyframeCompositeValueTests.forEach(composite => {
const effect = new KeyframeEffectReadOnly(target, getKeyframe(composite));
assert_equals(effect.getKeyframes()[0].composite, composite,
`resulting composite for '${composite}'`);
});
- gBadCompositeValueTests.forEach(function(composite) {
- assert_throws(new TypeError, function() {
+ gBadCompositeValueTests.forEach(composite => {
+ assert_throws(new TypeError, () => {
new KeyframeEffectReadOnly(target, getKeyframe(composite));
});
});
}, 'composite values are parsed correctly when passed to the ' +
'KeyframeEffectReadOnly constructor in property-indexed keyframes');
-test(function(t) {
- const getKeyframes = function(composite) {
- return [
+test(t => {
+ const getKeyframes = composite =>
+ [
{ offset: 0, left: '10px', composite: composite },
{ offset: 1, left: '20px' }
];
- };
- gGoodKeyframeCompositeValueTests.forEach(function(composite) {
+ gGoodKeyframeCompositeValueTests.forEach(composite => {
const effect = new KeyframeEffectReadOnly(target, getKeyframes(composite));
assert_equals(effect.getKeyframes()[0].composite, composite,
`resulting composite for '${composite}'`);
});
- gBadCompositeValueTests.forEach(function(composite) {
- assert_throws(new TypeError, function() {
+ gBadCompositeValueTests.forEach(composite => {
+ assert_throws(new TypeError, () => {
new KeyframeEffectReadOnly(target, getKeyframes(composite));
});
});
}, 'composite values are parsed correctly when passed to the ' +
'KeyframeEffectReadOnly constructor in regular keyframes');
-test(function(t) {
- gGoodOptionsCompositeValueTests.forEach(function(composite) {
+test(t => {
+ gGoodOptionsCompositeValueTests.forEach(composite => {
const effect = new KeyframeEffectReadOnly(target, {
left: ['10px', '20px']
}, { composite: composite });
assert_equals(effect.getKeyframes()[0].composite, undefined,
`resulting composite for '${composite}'`);
});
- gBadCompositeValueTests.forEach(function(composite) {
- assert_throws(new TypeError, function() {
+ gBadCompositeValueTests.forEach(composite => {
+ assert_throws(new TypeError, () => {
new KeyframeEffectReadOnly(target, {
left: ['10px', '20px']
}, { composite: composite });
});
});
}, 'composite value is absent if the composite operation specified on the ' +
'keyframe effect is being used');
-gKeyframesTests.forEach(function(subtest) {
- test(function(t) {
+gKeyframesTests.forEach(subtest => {
+ test(t => {
const effect = new KeyframeEffectReadOnly(target, subtest.input);
assert_frame_lists_equal(effect.getKeyframes(), subtest.output);
}, `A KeyframeEffectReadOnly can be constructed with ${subtest.desc}`);
- test(function(t) {
+ test(t => {
const effect = new KeyframeEffectReadOnly(target, subtest.input);
const secondEffect =
new KeyframeEffectReadOnly(target, effect.getKeyframes());
assert_frame_lists_equal(secondEffect.getKeyframes(),
effect.getKeyframes());
}, `A KeyframeEffectReadOnly constructed with ${subtest.desc} roundtrips`);
});
-gInvalidKeyframesTests.forEach(function(subtest) {
- test(function(t) {
- assert_throws(new TypeError, function() {
+gInvalidKeyframesTests.forEach(subtest => {
+ test(t => {
+ assert_throws(new TypeError, () => {
new KeyframeEffectReadOnly(target, subtest.input);
});
}, `KeyframeEffectReadOnly constructor throws with ${subtest.desc}`);
});
-test(function(t) {
+test(t => {
const effect = new KeyframeEffectReadOnly(target,
{ left: ['10px', '20px'] });
const timing = effect.timing;
assert_equals(timing.delay, 0, 'default delay');
assert_equals(timing.endDelay, 0, 'default endDelay');
assert_equals(timing.fill, 'auto', 'default fill');
assert_equals(timing.iterations, 1.0, 'default iterations');
@@ -142,18 +140,18 @@ test(function(t) {
assert_equals(timing.easing, 'linear', 'default easing');
assert_equals(effect.composite, 'replace', 'default composite');
assert_equals(effect.iterationComposite, 'replace',
'default iterationComposite');
}, 'A KeyframeEffectReadOnly constructed without any ' +
'KeyframeEffectOptions object');
-gKeyframeEffectOptionTests.forEach(function(subtest) {
- test(function(t) {
+gKeyframeEffectOptionTests.forEach(subtest => {
+ test(t => {
const effect = new KeyframeEffectReadOnly(target,
{ left: ['10px', '20px'] },
subtest.input);
// Helper function to provide default expected values when the test does
// not supply them.
const expected = (field, defaultValue) => {
return field in subtest.expected ? subtest.expected[field] : defaultValue;
@@ -169,37 +167,37 @@ gKeyframeEffectOptionTests.forEach(funct
assert_equals(timing.duration, expected('duration', 'auto'),
'timing duration');
assert_equals(timing.direction, expected('direction', 'normal'),
'timing direction');
}, `A KeyframeEffectReadOnly constructed by ${subtest.desc}`);
});
-gInvalidKeyframeEffectOptionTests.forEach(function(subtest) {
- test(function(t) {
- assert_throws(new TypeError, function() {
+gInvalidKeyframeEffectOptionTests.forEach(subtest => {
+ test(t => {
+ assert_throws(new TypeError, () => {
new KeyframeEffectReadOnly(target,
{ left: ['10px', '20px'] },
subtest.input);
});
}, `Invalid KeyframeEffectReadOnly option by ${subtest.desc}`);
});
-test(function(t) {
+test(t => {
const effect = new KeyframeEffectReadOnly(null,
{ left: ['10px', '20px'] },
{ duration: 100 * MS_PER_SEC,
fill: 'forwards' });
assert_equals(effect.target, null,
'Effect created with null target has correct target');
}, 'A KeyframeEffectReadOnly constructed with null target');
-test(function(t) {
+test(t => {
const test_error = { name: 'test' };
- assert_throws(test_error, function() {
+ assert_throws(test_error, () => {
new KeyframeEffect(target, { get left() { throw test_error }})
});
}, 'KeyframeEffect constructor propagates exceptions generated by accessing'
+ ' the options object');
</script>
</body>
--- a/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/copy-constructor.html
+++ b/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/copy-constructor.html
@@ -8,23 +8,23 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
-test(function(t) {
+test(t => {
const effect = new KeyframeEffectReadOnly(createDiv(t), null);
const copiedEffect = new KeyframeEffectReadOnly(effect);
assert_equals(copiedEffect.target, effect.target, 'same target');
}, 'Copied KeyframeEffectReadOnly has the same target');
-test(function(t) {
+test(t => {
const effect =
new KeyframeEffectReadOnly(null,
[ { marginLeft: '0px' },
{ marginLeft: '-20px', easing: 'ease-in',
offset: 0.1 },
{ marginLeft: '100px', easing: 'ease-out' },
{ marginLeft: '50px' } ]);
@@ -47,29 +47,29 @@ test(function(t) {
`Original keyframe ${i} has a valid property value`);
assert_true(!!keyframesB[i].marginLeft,
`New keyframe ${i} has a valid property value`);
assert_equals(keyframesA[i].marginLeft, keyframesB[i].marginLeft,
`Keyframe ${i} has the same property value pair`);
}
}, 'Copied KeyframeEffectReadOnly has the same keyframes');
-test(function(t) {
+test(t => {
const effect =
new KeyframeEffectReadOnly(null, null,
{ iterationComposite: 'accumulate' });
const copiedEffect = new KeyframeEffectReadOnly(effect);
assert_equals(copiedEffect.iterationComposite, effect.iterationComposite,
'same iterationCompositeOperation');
assert_equals(copiedEffect.composite, effect.composite,
'same compositeOperation');
}, 'Copied KeyframeEffectReadOnly has the same KeyframeEffectOptions');
-test(function(t) {
+test(t => {
const effect = new KeyframeEffectReadOnly(null, null,
{ duration: 100 * MS_PER_SEC,
delay: -1 * MS_PER_SEC,
endDelay: 2 * MS_PER_SEC,
fill: 'forwards',
iterationStart: 2,
iterations: 20,
easing: 'ease-out',
@@ -85,17 +85,17 @@ test(function(t) {
assert_equals(timingA.iterationStart, timingB.iterationStart,
'same iterationStart');
assert_equals(timingA.iterations, timingB.iterations, 'same iterations');
assert_equals(timingA.duration, timingB.duration, 'same duration');
assert_equals(timingA.direction, timingB.direction, 'same direction');
assert_equals(timingA.easing, timingB.easing, 'same easing');
}, 'Copied KeyframeEffectReadOnly has the same timing content');
-test(function(t) {
+test(t => {
const effect = new KeyframeEffectReadOnly(createDiv(t), null);
assert_equals(effect.constructor.name, 'KeyframeEffectReadOnly');
assert_equals(effect.timing.constructor.name,
'AnimationEffectTimingReadOnly');
// Make a mutable copy
const copiedEffect = new KeyframeEffect(effect);
assert_equals(copiedEffect.constructor.name, 'KeyframeEffect');
--- a/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/getComputedTiming.html
+++ b/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/getComputedTiming.html
@@ -8,17 +8,17 @@
<body>
<div id="log"></div>
<div id="target"></div>
<script>
"use strict";
var target = document.getElementById("target");
-test(function(t) {
+test(t => {
var effect = new KeyframeEffectReadOnly(target,
{ left: ["10px", "20px"] });
var ct = effect.getComputedTiming();
assert_equals(ct.delay, 0, "computed delay");
assert_equals(ct.fill, "none", "computed fill");
assert_equals(ct.iterations, 1.0, "computed iterations");
assert_equals(ct.duration, 0, "computed duration");
@@ -64,25 +64,25 @@ var gGetComputedTimingTests = [
{ desc: "an auto fill",
input: { fill: "auto" },
expected: { fill: "none" } },
{ desc: "a forwards fill",
input: { fill: "forwards" },
expected: { fill: "forwards" } }
];
-gGetComputedTimingTests.forEach(function(stest) {
- test(function(t) {
+gGetComputedTimingTests.forEach(stest => {
+ test(t => {
var effect = new KeyframeEffectReadOnly(target,
{ left: ["10px", "20px"] },
stest.input);
// Helper function to provide default expected values when the test does
// not supply them.
- var expected = function(field, defaultValue) {
+ var expected = (field, defaultValue) => {
return field in stest.expected ? stest.expected[field] : defaultValue;
};
var ct = effect.getComputedTiming();
assert_equals(ct.delay, expected("delay", 0),
"computed delay");
assert_equals(ct.fill, expected("fill", "none"),
"computed fill");
@@ -137,18 +137,18 @@ var gActiveDurationTests = [
{ desc: "an infinite duration and fractional iteration count",
input: { duration: Infinity, iterations: 2.5 },
expected: Infinity },
{ desc: "an infinite duration and infinite iteration count",
input: { duration: Infinity, iterations: Infinity },
expected: Infinity },
];
-gActiveDurationTests.forEach(function(stest) {
- test(function(t) {
+gActiveDurationTests.forEach(stest => {
+ test(t => {
var effect = new KeyframeEffectReadOnly(target,
{ left: ["10px", "20px"] },
stest.input);
assert_equals(effect.getComputedTiming().activeDuration,
stest.expected);
}, "getComputedTiming().activeDuration for " + stest.desc);
@@ -189,18 +189,18 @@ var gEndTimeTests = [
"duration",
input: { duration: 1000, iterations: 2, delay: -3000 },
expected: 0 },
{ desc: "a zero duration and negative delay",
input: { duration: 0, iterations: 2, delay: -1000 },
expected: 0 }
];
-gEndTimeTests.forEach(function(stest) {
- test(function(t) {
+gEndTimeTests.forEach(stest => {
+ test(t => {
var effect = new KeyframeEffectReadOnly(target,
{ left: ["10px", "20px"] },
stest.input);
assert_equals(effect.getComputedTiming().endTime,
stest.expected);
}, "getComputedTiming().endTime for " + stest.desc);
--- a/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/iterationComposite.html
+++ b/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/iterationComposite.html
@@ -4,17 +4,17 @@
<link rel="help" href="https://w3c.github.io/web-animations/#effect-accumulation-section">
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src="../../testcommon.js"></script>
<div id="log"></div>
<script>
'use strict';
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim =
div.animate({ alignContent: ['flex-start', 'flex-end'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
@@ -24,17 +24,17 @@ test(function(t) {
anim.currentTime = anim.effect.timing.duration * 2;
assert_equals(getComputedStyle(div).alignContent, 'flex-start',
'Animated align-content style at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
assert_equals(getComputedStyle(div).alignContent, 'flex-end',
'Animated align-content style at 50s of the third iteration');
}, 'iterationComposite of discrete type animation (align-content)');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim =
div.animate({ marginLeft: ['0px', '10px'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
anim.pause();
@@ -45,17 +45,17 @@ test(function(t) {
anim.currentTime = anim.effect.timing.duration * 2;
assert_equals(getComputedStyle(div).marginLeft, '20px',
'Animated margin-left style at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
assert_equals(getComputedStyle(div).marginLeft, '25px',
'Animated margin-left style at 50s of the third iteration');
}, 'iterationComposite of <length> type animation');
-test(function(t) {
+test(t => {
var parent = createDiv(t);
parent.style.width = '100px';
var div = createDiv(t);
parent.appendChild(div);
var anim =
div.animate({ width: ['0%', '50%'] },
{ duration: 100 * MS_PER_SEC,
@@ -70,17 +70,17 @@ test(function(t) {
anim.currentTime = anim.effect.timing.duration * 2;
assert_equals(getComputedStyle(div).width, '100px',
'Animated width style at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
assert_equals(getComputedStyle(div).width, '125px',
'Animated width style at 50s of the third iteration');
}, 'iterationComposite of <percentage> type animation');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim =
div.animate({ color: ['rgb(0, 0, 0)', 'rgb(120, 120, 120)'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
anim.pause();
@@ -91,17 +91,17 @@ test(function(t) {
anim.currentTime = anim.effect.timing.duration * 2;
assert_equals(getComputedStyle(div).color, 'rgb(240, 240, 240)',
'Animated color style at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
assert_equals(getComputedStyle(div).color, 'rgb(255, 255, 255)',
'Animated color style at 50s of the third iteration');
}, 'iterationComposite of <color> type animation');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim =
div.animate({ color: ['rgb(0, 120, 0)', 'rgb(60, 60, 60)'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
anim.pause();
@@ -114,17 +114,17 @@ test(function(t) {
'Animated color style at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
// The green color is (240 + 180) / 2 = 210
assert_equals(getComputedStyle(div).color, 'rgb(150, 210, 150)',
'Animated color style at 50s of the third iteration');
}, 'iterationComposite of <color> type animation that green component is ' +
'decreasing');
-test(function(t) {
+ test(t => {
var div = createDiv(t);
var anim =
div.animate({ flexGrow: [0, 10] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
anim.pause();
@@ -135,17 +135,17 @@ test(function(t) {
anim.currentTime = anim.effect.timing.duration * 2;
assert_equals(getComputedStyle(div).flexGrow, '20',
'Animated flex-grow style at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
assert_equals(getComputedStyle(div).flexGrow, '25',
'Animated flex-grow style at 50s of the third iteration');
}, 'iterationComposite of <number> type animation');
-test(function(t) {
+test(t => {
var div = createDiv(t);
div.style.position = 'absolute';
var anim =
div.animate({ clip: ['rect(0px, 0px, 0px, 0px)',
'rect(10px, 10px, 10px, 10px)'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
@@ -158,17 +158,17 @@ test(function(t) {
anim.currentTime = anim.effect.timing.duration * 2;
assert_equals(getComputedStyle(div).clip, 'rect(20px, 20px, 20px, 20px)',
'Animated clip style at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
assert_equals(getComputedStyle(div).clip, 'rect(25px, 25px, 25px, 25px)',
'Animated clip style at 50s of the third iteration');
}, 'iterationComposite of <shape> type animation');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim =
div.animate({ width: ['calc(0vw + 0px)', 'calc(0vw + 10px)'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
anim.pause();
@@ -179,17 +179,17 @@ test(function(t) {
anim.currentTime = anim.effect.timing.duration * 2;
assert_equals(getComputedStyle(div).width, '20px',
'Animated calc width style at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
assert_equals(getComputedStyle(div).width, '25px',
'Animated calc width style at 50s of the third iteration');
}, 'iterationComposite of <calc()> value animation');
-test(function(t) {
+test(t => {
var parent = createDiv(t);
parent.style.width = '100px';
var div = createDiv(t);
parent.appendChild(div);
var anim =
div.animate({ width: ['calc(0% + 0px)', 'calc(10% + 10px)'] },
{ duration: 100 * MS_PER_SEC,
@@ -208,17 +208,17 @@ test(function(t) {
'Animated calc width style at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
assert_equals(getComputedStyle(div).width,
'50px', // (40px + 60px) / 2
'Animated calc width style at 50s of the third iteration');
}, 'iterationComposite of <calc()> value animation that the values can\'t' +
'be reduced');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim =
div.animate({ opacity: [0, 0.4] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
anim.pause();
@@ -229,17 +229,17 @@ test(function(t) {
anim.currentTime = anim.effect.timing.duration * 2;
assert_equals(getComputedStyle(div).opacity, '0.8',
'Animated opacity style at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
assert_equals(getComputedStyle(div).opacity, '1', // (0.8 + 1.2) * 0.5
'Animated opacity style at 50s of the third iteration');
}, 'iterationComposite of opacity animation');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim =
div.animate({ boxShadow: ['rgb(0, 0, 0) 0px 0px 0px 0px',
'rgb(120, 120, 120) 10px 10px 10px 0px'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
@@ -254,17 +254,17 @@ test(function(t) {
'rgb(240, 240, 240) 20px 20px 20px 0px',
'Animated box-shadow style at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
assert_equals(getComputedStyle(div).boxShadow,
'rgb(255, 255, 255) 25px 25px 25px 0px',
'Animated box-shadow style at 50s of the third iteration');
}, 'iterationComposite of box-shadow animation');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim =
div.animate({ filter: ['blur(0px)', 'blur(10px)'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
anim.pause();
@@ -275,17 +275,17 @@ test(function(t) {
anim.currentTime = anim.effect.timing.duration * 2;
assert_equals(getComputedStyle(div).filter, 'blur(20px)',
'Animated filter blur style at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
assert_equals(getComputedStyle(div).filter, 'blur(25px)',
'Animated filter blur style at 50s of the third iteration');
}, 'iterationComposite of filter blur animation');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim =
div.animate({ filter: ['brightness(1)',
'brightness(180%)'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
@@ -300,17 +300,17 @@ test(function(t) {
'brightness(2.6)', // brightness(1) + brightness(0.8) + brightness(0.8)
'Animated filter brightness style at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
assert_equals(getComputedStyle(div).filter,
'brightness(3)', // (brightness(2.6) + brightness(3.4)) * 0.5
'Animated filter brightness style at 50s of the third iteration');
}, 'iterationComposite of filter brightness for different unit animation');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim =
div.animate({ filter: ['brightness(0)',
'brightness(1)'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
@@ -325,17 +325,17 @@ test(function(t) {
'brightness(0)', // brightness(1) is an identity element, not accumulated.
'Animated filter brightness style at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
assert_equals(getComputedStyle(div).filter,
'brightness(0.5)', // brightness(1) is an identity element, not accumulated.
'Animated filter brightness style at 50s of the third iteration');
}, 'iterationComposite of filter brightness animation');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim =
div.animate({ filter: ['drop-shadow(rgb(0, 0, 0) 0px 0px 0px)',
'drop-shadow(rgb(120, 120, 120) 10px 10px 10px)'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
@@ -350,17 +350,17 @@ test(function(t) {
'drop-shadow(rgb(240, 240, 240) 20px 20px 20px)',
'Animated filter drop-shadow style at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
assert_equals(getComputedStyle(div).filter,
'drop-shadow(rgb(255, 255, 255) 25px 25px 25px)',
'Animated filter drop-shadow style at 50s of the third iteration');
}, 'iterationComposite of filter drop-shadow animation');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim =
div.animate({ filter: ['brightness(1) contrast(1)',
'brightness(2) contrast(2)'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
@@ -375,17 +375,17 @@ test(function(t) {
'brightness(3) contrast(3)',
'Animated filter list at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
assert_equals(getComputedStyle(div).filter,
'brightness(3.5) contrast(3.5)',
'Animated filter list at 50s of the third iteration');
}, 'iterationComposite of same filter list animation');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim =
div.animate({ filter: ['brightness(1) contrast(1)',
'contrast(2) brightness(2)'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
@@ -406,17 +406,17 @@ test(function(t) {
assert_equals(getComputedStyle(div).filter,
// We *can* accumulate 'contrast(2) brightness(2)' onto
// the same list 'contrast(2) brightness(2)' here.
'contrast(4) brightness(4)', // discrete
'Animated filter list at 50s of the third iteration');
}, 'iterationComposite of discrete filter list because of mismatch ' +
'of the order');
-test(function(t) {
+ test(t => {
var div = createDiv(t);
var anim =
div.animate({ filter: ['sepia(0)',
'sepia(1) contrast(2)'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
@@ -431,17 +431,17 @@ test(function(t) {
'sepia(2) contrast(3)',
'Animated filter list at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
assert_equals(getComputedStyle(div).filter,
'sepia(2.5) contrast(3.5)',
'Animated filter list at 50s of the third iteration');
}, 'iterationComposite of different length filter list animation');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim =
div.animate({ transform: ['rotate(0deg)', 'rotate(180deg)'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
anim.pause();
@@ -455,17 +455,17 @@ test(function(t) {
'matrix(1, 0, 0, 1, 0, 0)', // rotate(360deg)
'Animated transform(rotate) style at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
assert_matrix_equals(getComputedStyle(div).transform,
'matrix(0, 1, -1, 0, 0, 0)', // rotate(450deg)
'Animated transform(rotate) style at 50s of the third iteration');
}, 'iterationComposite of transform(rotate) animation');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim =
div.animate({ transform: ['scale(0)', 'scale(1)'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
anim.pause();
@@ -481,17 +481,17 @@ test(function(t) {
'Animated transform(scale) style at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
assert_matrix_equals(getComputedStyle(div).transform,
'matrix(0.5, 0, 0, 0.5, 0, 0)', // scale(0.5); scale(1) an identity
// element, not accumulated.
'Animated transform(scale) style at 50s of the third iteration');
}, 'iterationComposite of transform: [ scale(0), scale(1) ] animation');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim =
div.animate({ transform: ['scale(1)', 'scale(2)'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
anim.pause();
@@ -505,17 +505,17 @@ test(function(t) {
'matrix(3, 0, 0, 3, 0, 0)', // scale(1 + (2 -1) + (2 -1))
'Animated transform(scale) style at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
assert_matrix_equals(getComputedStyle(div).transform,
'matrix(3.5, 0, 0, 3.5, 0, 0)', // (scale(3) + scale(4)) * 0.5
'Animated transform(scale) style at 50s of the third iteration');
}, 'iterationComposite of transform: [ scale(1), scale(2) ] animation');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim =
div.animate({ transform: ['scale(0)', 'scale(2)'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
anim.pause();
@@ -529,17 +529,17 @@ test(function(t) {
'matrix(2, 0, 0, 2, 0, 0)', // (scale(0) + scale(2-1)*2)
'Animated transform(scale) style at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
assert_matrix_equals(getComputedStyle(div).transform,
'matrix(3, 0, 0, 3, 0, 0)', // (scale(2) + scale(4)) * 0.5
'Animated transform(scale) style at 50s of the third iteration');
}, 'iterationComposite of transform: scale(2) animation');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim =
div.animate({ transform: ['rotate(0deg) translateX(0px)',
'rotate(180deg) translateX(10px)'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
@@ -554,17 +554,17 @@ test(function(t) {
'matrix(1, 0, 0, 1, 20, 0)', // rotate(360deg) translateX(20px)
'Animated transform list at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
assert_matrix_equals(getComputedStyle(div).transform,
'matrix(0, 1, -1, 0, 0, 25)', // rotate(450deg) translateX(25px)
'Animated transform list at 50s of the third iteration');
}, 'iterationComposite of transform list animation');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim =
div.animate({ transform: ['matrix(2, 0, 0, 2, 0, 0)',
'matrix(3, 0, 0, 3, 30, 0)'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
@@ -583,17 +583,17 @@ test(function(t) {
assert_matrix_equals(getComputedStyle(div).transform,
// from: matrix(6, 0, 0, 6, 60, 0)
// to: matrix(7, 0, 0, 7, 90, 0)
// = scale(3) + (scale(3-1)*2) + translateX(30px)*3
'matrix(6.5, 0, 0, 6.5, 75, 0)',
'Animated transform of matrix function at 50s of the third iteration');
}, 'iterationComposite of transform of matrix function');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim =
div.animate({ transform: ['translateX(0px) scale(2)',
'scale(3) translateX(10px)'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
@@ -615,17 +615,17 @@ test(function(t) {
anim.currentTime += anim.effect.timing.duration / 2;
assert_matrix_equals(getComputedStyle(div).transform,
// Interpolate between matrix(6, 0, 0, 6, 60, 0)
// and matrix(7, 0, 0, 7, 210, 0) = scale(7) translate(30px)
'matrix(6.5, 0, 0, 6.5, 135, 0)',
'Animated transform list at 50s of the third iteration');
}, 'iterationComposite of transform list animation whose order is mismatched');
-test(function(t) {
+test(t => {
var div = createDiv(t);
// Even if each transform list does not have functions which exist in
// other pair of the list, we don't fill any missing functions at all.
var anim =
div.animate({ transform: ['translateX(0px)',
'scale(2) translateX(10px)'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
@@ -651,17 +651,17 @@ test(function(t) {
// Interpolate between matrix(3, 0, 0, 3, 40, 0)
// and matrix(4, 0, 0, 4, 120, 0) =
// scale(2 + (2-1)*2) translate(10px * 3)
'matrix(3.5, 0, 0, 3.5, 80, 0)',
'Animated transform list at 50s of the third iteration');
}, 'iterationComposite of transform list animation whose order is mismatched ' +
'because of missing functions');
-test(function(t) {
+ test(t => {
var div = createDiv(t);
var anim =
div.animate({ transform: ['none',
'translateX(10px)'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
@@ -679,17 +679,17 @@ test(function(t) {
'Animated transform list at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
assert_matrix_equals(getComputedStyle(div).transform,
// translateX(10px * 2 + none) -> translateX(10px * 2 + 10px) @ 50%
'matrix(1, 0, 0, 1, 25, 0)',
'Animated transform list at 50s of the third iteration');
}, 'iterationComposite of transform from none to translate');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim =
div.animate({ transform: ['matrix3d(1, 0, 0, 0, ' +
'0, 1, 0, 0, ' +
'0, 0, 1, 0, ' +
'0, 0, 30, 1)',
'matrix3d(1, 0, 0, 0, ' +
'0, 1, 0, 0, ' +
@@ -713,17 +713,17 @@ test(function(t) {
anim.currentTime += anim.effect.timing.duration / 2;
assert_matrix_equals(getComputedStyle(div).transform,
// from: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 130, 1)
// to: matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 150, 1)
'matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 140, 1)',
'Animated transform of matrix3d function at 50s of the third iteration');
}, 'iterationComposite of transform of matrix3d function');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim =
div.animate({ transform: ['rotate3d(1, 1, 0, 0deg)',
'rotate3d(1, 1, 0, 90deg)'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
@@ -738,17 +738,17 @@ test(function(t) {
rotate3dToMatrix3d(1, 1, 0, Math.PI), // 180deg
'Animated transform of rotate3d function at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
assert_matrix_equals(getComputedStyle(div).transform,
rotate3dToMatrix3d(1, 1, 0, 225 * Math.PI / 180), //((270 + 180) * 0.5)deg
'Animated transform of rotate3d function at 50s of the third iteration');
}, 'iterationComposite of transform of rotate3d function');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim =
div.animate({ marginLeft: ['10px', '20px'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
anim.pause();
@@ -759,17 +759,17 @@ test(function(t) {
anim.currentTime = anim.effect.timing.duration * 2;
assert_equals(getComputedStyle(div).marginLeft, '50px', // 10px + 20px + 20px
'Animated margin-left style at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
assert_equals(getComputedStyle(div).marginLeft, '55px', // (50px + 60px) * 0.5
'Animated margin-left style at 50s of the third iteration');
}, 'iterationComposite starts with non-zero value animation');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim =
div.animate({ marginLeft: ['10px', '-10px'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
anim.pause();
@@ -783,17 +783,17 @@ test(function(t) {
'-10px', // 10px + -10px + -10px
'Animated margin-left style at 0s of the third iteration');
anim.currentTime += anim.effect.timing.duration / 2;
assert_equals(getComputedStyle(div).marginLeft,
'-20px', // (-10px + -30px) * 0.5
'Animated margin-left style at 50s of the third iteration');
}, 'iterationComposite with negative final value animation');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ marginLeft: ['0px', '10px'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
anim.pause();
@@ -806,17 +806,17 @@ test(function(t) {
assert_equals(getComputedStyle(div).marginLeft, '5px',
'Animated style at 50s of the third iteration');
anim.effect.iterationComposite = 'accumulate';
assert_equals(getComputedStyle(div).marginLeft, '25px',
'Animated style at 50s of the third iteration');
}, 'interationComposite changes');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var anim = div.animate({ marginLeft: ['0px', '10px'] },
{ duration: 100 * MS_PER_SEC,
easing: 'linear',
iterations: 10,
iterationComposite: 'accumulate' });
anim.pause();
--- a/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/setKeyframes.html
+++ b/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/setKeyframes.html
@@ -10,34 +10,34 @@
<body>
<div id="log"></div>
<div id="target"></div>
<script>
'use strict';
var target = document.getElementById('target');
-test(function(t) {
- gEmptyKeyframeListTests.forEach(function(frame) {
+test(t => {
+ gEmptyKeyframeListTests.forEach(frame => {
var effect = new KeyframeEffect(target, {});
effect.setKeyframes(frame);
assert_frame_lists_equal(effect.getKeyframes(), []);
});
}, 'Keyframes can be replaced with an empty keyframe');
-gKeyframesTests.forEach(function(subtest) {
- test(function(t) {
+gKeyframesTests.forEach(subtest => {
+ test(t => {
var effect = new KeyframeEffect(target, {});
effect.setKeyframes(subtest.input);
assert_frame_lists_equal(effect.getKeyframes(), subtest.output);
}, 'Keyframes can be replaced with ' + subtest.desc);
});
-gInvalidKeyframesTests.forEach(function(subtest) {
- test(function(t) {
+gInvalidKeyframesTests.forEach(subtest => {
+ test(t => {
var effect = new KeyframeEffect(target, {});
- assert_throws(new TypeError, function() {
+ assert_throws(new TypeError, () => {
effect.setKeyframes(subtest.input);
});
}, 'KeyframeEffect constructor throws with ' + subtest.desc);
});
</script>
</body>
--- a/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/target.html
+++ b/testing/web-platform/tests/web-animations/interfaces/KeyframeEffect/target.html
@@ -8,59 +8,59 @@
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
"use strict";
var gKeyFrames = { 'marginLeft': ['0px', '100px'] };
-test(function(t) {
+test(t => {
var div = createDiv(t);
var effect = new KeyframeEffect(null, gKeyFrames, 100 * MS_PER_SEC);
effect.target = div;
var anim = new Animation(effect, document.timeline);
anim.play();
anim.currentTime = 50 * MS_PER_SEC;
assert_equals(getComputedStyle(div).marginLeft, '50px',
'Value at 50% progress');
}, 'Test setting target before constructing the associated animation');
-test(function(t) {
+test(t => {
var div = createDiv(t);
div.style.marginLeft = '10px';
var effect = new KeyframeEffect(null, gKeyFrames, 100 * MS_PER_SEC);
var anim = new Animation(effect, document.timeline);
anim.play();
anim.currentTime = 50 * MS_PER_SEC;
assert_equals(getComputedStyle(div).marginLeft, '10px',
'Value at 50% progress before setting new target');
effect.target = div;
assert_equals(getComputedStyle(div).marginLeft, '50px',
'Value at 50% progress after setting new target');
}, 'Test setting target from null to a valid target');
-test(function(t) {
+test(t => {
var div = createDiv(t);
div.style.marginLeft = '10px';
var anim = div.animate(gKeyFrames, 100 * MS_PER_SEC);
anim.currentTime = 50 * MS_PER_SEC;
assert_equals(getComputedStyle(div).marginLeft, '50px',
'Value at 50% progress before clearing the target')
anim.effect.target = null;
assert_equals(getComputedStyle(div).marginLeft, '10px',
'Value after clearing the target')
}, 'Test setting target from a valid target to null');
-test(function(t) {
+test(t => {
var a = createDiv(t);
var b = createDiv(t);
a.style.marginLeft = '10px';
b.style.marginLeft = '20px';
var anim = a.animate(gKeyFrames, 100 * MS_PER_SEC);
anim.currentTime = 50 * MS_PER_SEC;
assert_equals(getComputedStyle(a).marginLeft, '50px',
--- a/testing/web-platform/tests/web-animations/testcommon.js
+++ b/testing/web-platform/tests/web-animations/testcommon.js
@@ -15,19 +15,19 @@ var MS_PER_SEC = 1000;
// The recommended minimum precision to use for time values[1].
//
// [1] https://w3c.github.io/web-animations/#precision-of-time-values
var TIME_PRECISION = 0.0005; // ms
// Allow implementations to substitute an alternative method for comparing
// times based on their precision requirements.
if (!window.assert_times_equal) {
- window.assert_times_equal = function(actual, expected, description) {
+ window.assert_times_equal = (actual, expected, description) => {
assert_approx_equals(actual, expected, TIME_PRECISION, description);
- }
+ };
}
// creates div element, appends it to the document body and
// removes the created element during test cleanup
function createDiv(test, doc) {
return createElement(test, 'div', doc);
}
@@ -35,17 +35,17 @@ function createDiv(test, doc) {
// removes the created element during test cleanup
// if tagName is null or undefined, returns div element
function createElement(test, tagName, doc) {
if (!doc) {
doc = document;
}
var element = doc.createElement(tagName || 'div');
doc.body.appendChild(element);
- test.add_cleanup(function() {
+ test.add_cleanup(() => {
element.remove();
});
return element;
}
// Creates a style element with the specified rules, appends it to the document
// head and removes the created element during test cleanup.
// |rules| is an object. For example:
@@ -65,17 +65,17 @@ function createStyle(test, rules, doc) {
doc.head.appendChild(extraStyle);
if (rules) {
var sheet = extraStyle.sheet;
for (var selector in rules) {
sheet.insertRule(selector + '{' + rules[selector] + '}',
sheet.cssRules.length);
}
}
- test.add_cleanup(function() {
+ test.add_cleanup(() => {
extraStyle.remove();
});
}
// Create a pseudo element
function createPseudo(test, type) {
createStyle(test, { '@keyframes anim': '',
['.pseudo::' + type]: 'animation: anim 10s; ' +
@@ -88,91 +88,89 @@ function createPseudo(test, type) {
assert_equals(anim.effect.target.parentElement, div);
assert_equals(anim.effect.target.type, '::' + type);
anim.cancel();
return anim.effect.target;
}
// Cubic bezier with control points (0, 0), (x1, y1), (x2, y2), and (1, 1).
function cubicBezier(x1, y1, x2, y2) {
- function xForT(t) {
+ const xForT = t => {
var omt = 1-t;
return 3 * omt * omt * t * x1 + 3 * omt * t * t * x2 + t * t * t;
- }
+ };
- function yForT(t) {
+ const yForT = t => {
var omt = 1-t;
return 3 * omt * omt * t * y1 + 3 * omt * t * t * y2 + t * t * t;
- }
+ };
- function tForX(x) {
+ const tForX = x => {
// Binary subdivision.
var mint = 0, maxt = 1;
for (var i = 0; i < 30; ++i) {
var guesst = (mint + maxt) / 2;
var guessx = xForT(guesst);
if (x < guessx) {
maxt = guesst;
} else {
mint = guesst;
}
}
return (mint + maxt) / 2;
- }
+ };
- return function bezierClosure(x) {
+ return x => {
if (x == 0) {
return 0;
}
if (x == 1) {
return 1;
}
return yForT(tForX(x));
- }
+ };
}
function stepEnd(nsteps) {
- return function stepEndClosure(x) {
- return Math.floor(x * nsteps) / nsteps;
- }
+ return x => Math.floor(x * nsteps) / nsteps;
}
function stepStart(nsteps) {
- return function stepStartClosure(x) {
+ return x => {
var result = Math.floor(x * nsteps + 1.0) / nsteps;
return (result > 1.0) ? 1.0 : result;
- }
+ };
}
function framesTiming(nframes) {
- return function framesClosure(x) {
+ return x => {
var result = Math.floor(x * nframes) / (nframes - 1);
return (result > 1.0 && x <= 1.0) ? 1.0 : result;
- }
+ };
}
function waitForAnimationFrames(frameCount) {
- return new Promise(function(resolve, reject) {
+ return new Promise(resolve => {
function handleFrame() {
if (--frameCount <= 0) {
resolve();
} else {
window.requestAnimationFrame(handleFrame); // wait another frame
}
}
window.requestAnimationFrame(handleFrame);
});
}
// Continually calls requestAnimationFrame until |minDelay| has elapsed
// as recorded using document.timeline.currentTime (i.e. frame time not
// wall-clock time).
function waitForAnimationFramesWithDelay(minDelay) {
var startTime = document.timeline.currentTime;
- return new Promise(function(resolve) {
+ return new Promise(resolve => {
(function handleFrame() {
if (document.timeline.currentTime - startTime >= minDelay) {
resolve();
} else {
window.requestAnimationFrame(handleFrame);
}
}());
});
--- a/testing/web-platform/tests/web-animations/timing-model/animation-effects/active-time.html
+++ b/testing/web-platform/tests/web-animations/timing-model/animation-effects/active-time.html
@@ -5,138 +5,138 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
-test(function(t) {
+test(t => {
var tests = [ { fill: 'none', progress: null },
{ fill: 'backwards', progress: 0 },
{ fill: 'forwards', progress: null },
{ fill: 'both', progress: 0 } ];
- tests.forEach(function(test) {
+ tests.forEach(test => {
var anim = createDiv(t).animate(null, { delay: 1, fill: test.fill });
assert_equals(anim.effect.getComputedTiming().progress, test.progress,
'Progress in before phase when using \'' + test.fill
+ '\' fill');
});
}, 'Active time in before phase');
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate(null, 1000);
anim.currentTime = 500;
assert_times_equal(anim.effect.getComputedTiming().progress, 0.5);
}, 'Active time in active phase and no start delay is the local time');
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate(null, { duration: 1000, delay: 500 });
anim.currentTime = 1000;
assert_times_equal(anim.effect.getComputedTiming().progress, 0.5);
}, 'Active time in active phase and positive start delay is the local time'
+ ' minus the start delay');
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate(null, { duration: 1000, delay: -500 });
assert_times_equal(anim.effect.getComputedTiming().progress, 0.5);
}, 'Active time in active phase and negative start delay is the local time'
+ ' minus the start delay');
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate(null);
assert_equals(anim.effect.getComputedTiming().progress, null);
}, 'Active time in after phase with no fill is unresolved');
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate(null, { fill: 'backwards' });
assert_equals(anim.effect.getComputedTiming().progress, null);
}, 'Active time in after phase with backwards-only fill is unresolved');
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate(null, { duration: 1000,
iterations: 2.3,
delay: 500, // Should have no effect
fill: 'forwards' });
anim.finish();
assert_equals(anim.effect.getComputedTiming().currentIteration, 2);
assert_times_equal(anim.effect.getComputedTiming().progress, 0.3);
}, 'Active time in after phase with forwards fill is the active duration');
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate(null, { duration: 0,
iterations: Infinity,
fill: 'forwards' });
anim.finish();
assert_equals(anim.effect.getComputedTiming().currentIteration, Infinity);
assert_equals(anim.effect.getComputedTiming().progress, 1);
}, 'Active time in after phase with forwards fill, zero-duration, and '
+ ' infinite iteration count is the active duration');
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate(null, { duration: 1000,
iterations: 2.3,
delay: 500,
endDelay: 4000,
fill: 'forwards' });
anim.finish();
assert_equals(anim.effect.getComputedTiming().currentIteration, 2);
assert_times_equal(anim.effect.getComputedTiming().progress, 0.3);
}, 'Active time in after phase with forwards fill and positive end delay'
+ ' is the active duration');
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate(null, { duration: 1000,
iterations: 2.3,
delay: 500,
endDelay: -800,
fill: 'forwards' });
anim.finish();
assert_equals(anim.effect.getComputedTiming().currentIteration, 1);
assert_times_equal(anim.effect.getComputedTiming().progress, 0.5);
}, 'Active time in after phase with forwards fill and negative end delay'
+ ' is the active duration + end delay');
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate(null, { duration: 1000,
iterations: 2.3,
delay: 500,
endDelay: -2500,
fill: 'forwards' });
anim.finish();
assert_equals(anim.effect.getComputedTiming().currentIteration, 0);
assert_equals(anim.effect.getComputedTiming().progress, 0);
}, 'Active time in after phase with forwards fill and negative end delay'
+ ' greater in magnitude than the active duration is zero');
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate(null, { duration: 1000,
iterations: 2.3,
delay: 500,
endDelay: -4000,
fill: 'forwards' });
anim.finish();
assert_equals(anim.effect.getComputedTiming().currentIteration, 0);
assert_equals(anim.effect.getComputedTiming().progress, 0);
}, 'Active time in after phase with forwards fill and negative end delay'
+ ' greater in magnitude than the sum of the active duration and start delay'
+ ' is zero');
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate(null, { duration: 1000,
iterations: 2.3,
delay: 500,
fill: 'both' });
anim.finish();
assert_equals(anim.effect.getComputedTiming().currentIteration, 2);
assert_times_equal(anim.effect.getComputedTiming().progress, 0.3);
}, 'Active time in after phase with \'both\' fill is the active duration');
-test(function(t) {
+test(t => {
// Create an effect with a non-zero duration so we ensure we're not just
// testing the after-phase behavior.
var effect = new KeyframeEffect(null, null, 1);
assert_equals(effect.getComputedTiming().progress, null);
}, 'Active time when the local time is unresolved, is unresolved');
</script>
</body>
--- a/testing/web-platform/tests/web-animations/timing-model/animation-effects/current-iteration.html
+++ b/testing/web-platform/tests/web-animations/timing-model/animation-effects/current-iteration.html
@@ -33,21 +33,21 @@ function runTests(tests, description) {
{ before: currentTest.before,
activeBoundary: currentTest.active,
after: currentTest.after },
);
}, `${description}: ${testParams}`);
}
}
-async_test(function(t) {
+async_test(t => {
var div = createDiv(t);
var anim = div.animate({ opacity: [ 0, 1 ] }, { delay: 1 });
assert_equals(anim.effect.getComputedTiming().currentIteration, null);
- anim.finished.then(t.step_func(function() {
+ anim.finished.then(t.step_func(() => {
assert_equals(anim.effect.getComputedTiming().currentIteration, null);
t.done();
}));
}, 'Test currentIteration during before and after phase when fill is none');
// --------------------------------------------------------------------
//
--- a/testing/web-platform/tests/web-animations/timing-model/animation-effects/local-time.html
+++ b/testing/web-platform/tests/web-animations/timing-model/animation-effects/local-time.html
@@ -4,23 +4,23 @@
<link rel="help" href="https://w3c.github.io/web-animations/#local-time">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<script>
'use strict';
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate(null, 10 * MS_PER_SEC);
for (var seconds of [-1, 0, 5, 10, 20]) {
anim.currentTime = seconds * MS_PER_SEC;
assert_equals(anim.effect.getComputedTiming().localTime, seconds * MS_PER_SEC);
}
}, 'Local time is current time for animation effects associated with an animation');
-test(function(t) {
+test(t => {
var effect = new KeyframeEffect(createDiv(t), null, 10 * MS_PER_SEC);
assert_equals(effect.getComputedTiming().localTime, null);
}, 'Local time is unresolved for animation effects not associated with an animation');
</script>
</body>
--- a/testing/web-platform/tests/web-animations/timing-model/animation-effects/phases-and-states.html
+++ b/testing/web-platform/tests/web-animations/timing-model/animation-effects/phases-and-states.html
@@ -42,150 +42,150 @@ function assert_phase_at_time(animation,
: 'forwards';
assert_not_equals(animation.effect.getComputedTiming().progress, null,
'Animation effect is in ' + phase + ' phase when current'
+ ' time is ' + currentTime + 'ms'
+ ' (progress is non-null with appropriate fill mode)');
}
}
-test(function(t) {
+test(t => {
var animation = createDiv(t).animate(null, 1);
[ { currentTime: -1, phase: 'before' },
{ currentTime: 0, phase: 'active' },
{ currentTime: 1, phase: 'after' } ]
- .forEach(function(test) {
+ .forEach(test => {
assert_phase_at_time(animation, test.phase, test.currentTime);
});
}, 'Phase calculation for a simple animation effect');
-test(function(t) {
+test(t => {
var animation = createDiv(t).animate(null, { duration: 1, delay: 1 });
[ { currentTime: 0, phase: 'before' },
{ currentTime: 1, phase: 'active' },
{ currentTime: 2, phase: 'after' } ]
- .forEach(function(test) {
+ .forEach(test => {
assert_phase_at_time(animation, test.phase, test.currentTime);
});
}, 'Phase calculation for an animation effect with a positive start delay');
-test(function(t) {
+test(t => {
var animation = createDiv(t).animate(null, { duration: 1, delay: -1 });
[ { currentTime: -2, phase: 'before' },
{ currentTime: -1, phase: 'before' },
{ currentTime: 0, phase: 'after' } ]
- .forEach(function(test) {
+ .forEach(test => {
assert_phase_at_time(animation, test.phase, test.currentTime);
});
}, 'Phase calculation for an animation effect with a negative start delay');
-test(function(t) {
+test(t => {
var animation = createDiv(t).animate(null, { duration: 1, endDelay: 1 });
[ { currentTime: -1, phase: 'before' },
{ currentTime: 0, phase: 'active' },
{ currentTime: 1, phase: 'after' },
{ currentTime: 2, phase: 'after' } ]
- .forEach(function(test) {
+ .forEach(test => {
assert_phase_at_time(animation, test.phase, test.currentTime);
});
}, 'Phase calculation for an animation effect with a positive end delay');
-test(function(t) {
+test(t => {
var animation = createDiv(t).animate(null, { duration: 2, endDelay: -1 });
[ { currentTime: -1, phase: 'before' },
{ currentTime: 0, phase: 'active' },
{ currentTime: 0.9, phase: 'active' },
{ currentTime: 1, phase: 'after' } ]
- .forEach(function(test) {
+ .forEach(test => {
assert_phase_at_time(animation, test.phase, test.currentTime);
});
}, 'Phase calculation for an animation effect with a negative end delay lesser'
+ ' in magnitude than the active duration');
-test(function(t) {
+test(t => {
var animation = createDiv(t).animate(null, { duration: 1, endDelay: -1 });
[ { currentTime: -1, phase: 'before' },
{ currentTime: 0, phase: 'after' },
{ currentTime: 1, phase: 'after' } ]
- .forEach(function(test) {
+ .forEach(test => {
assert_phase_at_time(animation, test.phase, test.currentTime);
});
}, 'Phase calculation for an animation effect with a negative end delay equal'
+ ' in magnitude to the active duration');
-test(function(t) {
+test(t => {
var animation = createDiv(t).animate(null, { duration: 1, endDelay: -2 });
[ { currentTime: -2, phase: 'before' },
{ currentTime: -1, phase: 'before' },
{ currentTime: 0, phase: 'after' } ]
- .forEach(function(test) {
+ .forEach(test => {
assert_phase_at_time(animation, test.phase, test.currentTime);
});
}, 'Phase calculation for an animation effect with a negative end delay'
+ ' greater in magnitude than the active duration');
-test(function(t) {
+test(t => {
var animation = createDiv(t).animate(null, { duration: 2,
delay: 1,
endDelay: -1 });
[ { currentTime: 0, phase: 'before' },
{ currentTime: 1, phase: 'active' },
{ currentTime: 2, phase: 'after' } ]
- .forEach(function(test) {
+ .forEach(test => {
assert_phase_at_time(animation, test.phase, test.currentTime);
});
}, 'Phase calculation for an animation effect with a positive start delay'
+ ' and a negative end delay lesser in magnitude than the active duration');
-test(function(t) {
+test(t => {
var animation = createDiv(t).animate(null, { duration: 1,
delay: -1,
endDelay: -1 });
[ { currentTime: -2, phase: 'before' },
{ currentTime: -1, phase: 'before' },
{ currentTime: 0, phase: 'after' } ]
- .forEach(function(test) {
+ .forEach(test => {
assert_phase_at_time(animation, test.phase, test.currentTime);
});
}, 'Phase calculation for an animation effect with a negative start delay'
+ ' and a negative end delay equal in magnitude to the active duration');
-test(function(t) {
+test(t => {
var animation = createDiv(t).animate(null, { duration: 1,
delay: -1,
endDelay: -2 });
[ { currentTime: -3, phase: 'before' },
{ currentTime: -2, phase: 'before' },
{ currentTime: -1, phase: 'before' },
{ currentTime: 0, phase: 'after' } ]
- .forEach(function(test) {
+ .forEach(test => {
assert_phase_at_time(animation, test.phase, test.currentTime);
});
}, 'Phase calculation for an animation effect with a negative start delay'
+ ' and a negative end delay equal greater in magnitude than the active'
+ ' duration');
-test(function(t) {
+test(t => {
var animation = createDiv(t).animate(null, 1);
animation.playbackRate = -1;
[ { currentTime: -1, phase: 'before' },
{ currentTime: 0, phase: 'before' },
{ currentTime: 1, phase: 'active' },
{ currentTime: 2, phase: 'after' } ]
- .forEach(function(test) {
+ .forEach(test => {
assert_phase_at_time(animation, test.phase, test.currentTime);
});
}, 'Phase calculation for a simple animation effect with negative playback'
+ ' rate');
</script>
</body>
--- a/testing/web-platform/tests/web-animations/timing-model/animations/canceling-an-animation.html
+++ b/testing/web-platform/tests/web-animations/timing-model/animations/canceling-an-animation.html
@@ -6,57 +6,57 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
"use strict";
-promise_test(function(t) {
+promise_test(t => {
const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
const retPromise = animation.ready.then(() => {
assert_unreached('ready promise was fulfilled');
}).catch(err => {
assert_equals(err.name, 'AbortError',
'ready promise is rejected with AbortError');
});
animation.cancel();
return retPromise;
}, 'A play-pending ready promise should be rejected when the animation is'
+ ' canceled');
-promise_test(function(t) {
+promise_test(t => {
const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
return animation.ready.then(() => {
animation.pause();
// Set up listeners on pause-pending ready promise
- var retPromise = animation.ready.then(function() {
+ var retPromise = animation.ready.then(() => {
assert_unreached('ready promise was fulfilled');
}).catch(err => {
assert_equals(err.name, 'AbortError',
'ready promise is rejected with AbortError');
});
animation.cancel();
return retPromise;
});
}, 'A pause-pending ready promise should be rejected when the animation is'
+ ' canceled');
-promise_test(function(t) {
+promise_test(t => {
const animation = createDiv(t).animate(null);
animation.cancel();
- return animation.ready.then(function(p) {
+ return animation.ready.then(p => {
assert_equals(p, animation);
});
}, 'When an animation is canceled, it should create a resolved Promise');
-test(function(t) {
+test(t => {
const animation = createDiv(t).animate(null);
const promise = animation.ready;
animation.cancel();
assert_not_equals(animation.ready, promise);
}, 'The ready promise should be replaced when the animation is canceled');
</script>
</body>
--- a/testing/web-platform/tests/web-animations/timing-model/animations/current-time.html
+++ b/testing/web-platform/tests/web-animations/timing-model/animations/current-time.html
@@ -5,73 +5,72 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
-test(function(t) {
+test(t => {
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
document.timeline);
animation.play();
assert_equals(animation.currentTime, 0,
'Current time returns the hold time set when entering the play-pending ' +
'state');
}, 'The current time returns the hold time when set');
-promise_test(function(t) {
+promise_test(t => {
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
null);
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
assert_equals(animation.currentTime, null);
});
}, 'The current time is unresolved when there is no associated timeline ' +
'(and no hold time is set)');
// FIXME: Test that the current time is unresolved when we have an inactive
// timeline if we find a way of creating an inactive timeline!
-test(function(t) {
+test(t => {
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
document.timeline);
animation.startTime = null;
assert_equals(animation.currentTime, null);
}, 'The current time is unresolved when the start time is unresolved ' +
'(and no hold time is set)');
-test(function(t) {
+test(t => {
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
document.timeline);
animation.playbackRate = 2;
animation.startTime = document.timeline.currentTime - 25 * MS_PER_SEC;
var timelineTime = document.timeline.currentTime;
var startTime = animation.startTime;
var playbackRate = animation.playbackRate;
assert_times_equal(animation.currentTime,
(timelineTime - startTime) * playbackRate,
'Animation has a unresolved start time');
}, 'The current time is calculated from the timeline time, start time and ' +
'playback rate');
-promise_test(function(t) {
+promise_test(t => {
var animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
animation.playbackRate = 0;
- return animation.ready.then(function() {
- return waitForAnimationFrames(1);
- }).then(function() {
+ return animation.ready.then(() => waitForAnimationFrames(1))
+ .then(() => {
assert_times_equal(animation.currentTime, 0);
});
}, 'The current time does not progress if playback rate is 0');
</script>
</body>
--- a/testing/web-platform/tests/web-animations/timing-model/animations/finishing-an-animation.html
+++ b/testing/web-platform/tests/web-animations/timing-model/animations/finishing-an-animation.html
@@ -6,17 +6,17 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
-promise_test(function(t) {
+promise_test(t => {
const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
const promise = animation.ready;
let readyResolved = false;
animation.finish();
animation.ready.then(() => { readyResolved = true; });
return animation.finished.then(p => {
--- a/testing/web-platform/tests/web-animations/timing-model/animations/pausing-an-animation.html
+++ b/testing/web-platform/tests/web-animations/timing-model/animations/pausing-an-animation.html
@@ -6,17 +6,17 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
-promise_test(function(t) {
+promise_test(t => {
const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
const promise = animation.ready;
animation.pause();
return promise.then(p => {
assert_equals(p, animation);
assert_equals(animation.ready, promise);
assert_equals(animation.playState, 'paused');
});
--- a/testing/web-platform/tests/web-animations/timing-model/animations/playing-an-animation.html
+++ b/testing/web-platform/tests/web-animations/timing-model/animations/playing-an-animation.html
@@ -6,51 +6,51 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
-test(function(t) {
+test(t => {
var animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
animation.currentTime = 1 * MS_PER_SEC;
assert_times_equal(animation.currentTime, 1 * MS_PER_SEC);
animation.play();
assert_times_equal(animation.currentTime, 1 * MS_PER_SEC);
}, 'Playing a running animation leaves the current time unchanged');
-test(function(t) {
+test(t => {
var animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
animation.finish();
assert_times_equal(animation.currentTime, 100 * MS_PER_SEC);
animation.play();
assert_times_equal(animation.currentTime, 0);
}, 'Playing a finished animation seeks back to the start');
-test(function(t) {
+test(t => {
var animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
animation.playbackRate = -1;
animation.currentTime = 0;
assert_times_equal(animation.currentTime, 0);
animation.play();
assert_times_equal(animation.currentTime, 100 * MS_PER_SEC);
}, 'Playing a finished and reversed animation seeks to end');
-test(function(t) {
+test(t => {
const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
animation.cancel();
const promise = animation.ready;
animation.play();
assert_not_equals(animation.ready, promise);
}, 'The ready promise should be replaced if the animation is not already'
+ ' pending');
-promise_test(function(t) {
+promise_test(t => {
const animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
const promise = animation.ready;
return promise.then(p => {
assert_equals(p, animation);
assert_equals(animation.ready, promise);
});
}, 'A pending ready promise should be resolved and not replaced when the'
+ ' animation enters the running state');
--- a/testing/web-platform/tests/web-animations/timing-model/animations/reversing-an-animation.html
+++ b/testing/web-platform/tests/web-animations/timing-model/animations/reversing-an-animation.html
@@ -6,214 +6,214 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
"use strict";
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, {duration: 100 * MS_PER_SEC,
iterations: Infinity});
// Wait a frame because if currentTime is still 0 when we call
// reverse(), it will throw (per spec).
- return animation.ready.then(waitForAnimationFrames(1)).then(function() {
+ return animation.ready.then(waitForAnimationFrames(1)).then(() => {
assert_greater_than_equal(animation.currentTime, 0,
'currentTime expected to be greater than 0, one frame after starting');
animation.currentTime = 50 * MS_PER_SEC;
var previousPlaybackRate = animation.playbackRate;
animation.reverse();
assert_equals(animation.playbackRate, -previousPlaybackRate,
'playbackRate should be inverted');
});
}, 'Reversing an animation inverts the playback rate');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, {duration: 100 * MS_PER_SEC,
iterations: Infinity});
animation.currentTime = 50 * MS_PER_SEC;
animation.pause();
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
animation.reverse();
return animation.ready;
- }).then(function() {
+ }).then(() => {
assert_equals(animation.playState, 'running',
'Animation.playState should be "running" after reverse()');
});
}, 'Reversing an animation plays a pausing animation');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
animation.currentTime = 50 * MS_PER_SEC;
animation.reverse();
assert_equals(animation.currentTime, 50 * MS_PER_SEC,
'The current time should not change it is in the middle of ' +
'the animation duration');
}, 'Reversing an animation maintains the same current time');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate({}, { duration: 200 * MS_PER_SEC,
delay: -100 * MS_PER_SEC });
assert_equals(animation.playState, 'pending',
'The playState is pending before we call reverse');
animation.reverse();
assert_equals(animation.playState, 'pending',
'The playState is still pending after calling reverse');
}, 'Reversing an animation does not cause it to leave the pending state');
-promise_test(function(t) {
+promise_test(t => {
var div = createDiv(t);
var animation = div.animate({}, { duration: 200 * MS_PER_SEC,
delay: -100 * MS_PER_SEC });
var readyResolved = false;
animation.ready.then(() => { readyResolved = true; });
animation.reverse();
return Promise.resolve(() => {
assert_false(readyResolved,
'ready promise should not have been resolved yet');
});
}, 'Reversing an animation does not cause it to resolve the ready promise');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
animation.currentTime = 200 * MS_PER_SEC;
animation.reverse();
assert_equals(animation.currentTime, 100 * MS_PER_SEC,
'reverse() should start playing from the animation effect end ' +
'if the playbackRate > 0 and the currentTime > effect end');
}, 'Reversing an animation when playbackRate > 0 and currentTime > ' +
'effect end should make it play from the end');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
animation.currentTime = -200 * MS_PER_SEC;
animation.reverse();
assert_equals(animation.currentTime, 100 * MS_PER_SEC,
'reverse() should start playing from the animation effect end ' +
'if the playbackRate > 0 and the currentTime < 0');
}, 'Reversing an animation when playbackRate > 0 and currentTime < 0 ' +
'should make it play from the end');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
animation.playbackRate = -1;
animation.currentTime = -200 * MS_PER_SEC;
animation.reverse();
assert_equals(animation.currentTime, 0,
'reverse() should start playing from the start of animation time ' +
'if the playbackRate < 0 and the currentTime < 0');
}, 'Reversing an animation when playbackRate < 0 and currentTime < 0 ' +
'should make it play from the start');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
animation.playbackRate = -1;
animation.currentTime = 200 * MS_PER_SEC;
animation.reverse();
assert_equals(animation.currentTime, 0,
'reverse() should start playing from the start of animation time ' +
'if the playbackRate < 0 and the currentTime > effect end');
}, 'Reversing an animation when playbackRate < 0 and currentTime > effect ' +
'end should make it play from the start');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate({}, {duration: 100 * MS_PER_SEC,
iterations: Infinity});
animation.currentTime = -200 * MS_PER_SEC;
assert_throws('InvalidStateError',
- function () { animation.reverse(); },
+ () => { animation.reverse(); },
'reverse() should throw InvalidStateError ' +
'if the playbackRate > 0 and the currentTime < 0 ' +
'and the target effect is positive infinity');
}, 'Reversing an animation when playbackRate > 0 and currentTime < 0 ' +
'and the target effect end is positive infinity should throw an exception');
-test(function(t) {
+test(t => {
var animation = createDiv(t).animate({}, { duration: 100 * MS_PER_SEC,
iterations: Infinity });
animation.currentTime = -200 * MS_PER_SEC;
try { animation.reverse(); } catch(e) { }
assert_equals(animation.playbackRate, 1, 'playbackRate remains unchanged');
}, 'When reversing throws an exception, the playback rate remains unchanged');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate({}, {duration: 100 * MS_PER_SEC,
iterations: Infinity});
animation.currentTime = -200 * MS_PER_SEC;
animation.playbackRate = 0;
try {
animation.reverse();
} catch (e) {
assert_unreached(`Unexpected exception when calling reverse(): ${e}`);
}
}, 'Reversing animation when playbackRate = 0 and currentTime < 0 ' +
'and the target effect end is positive infinity should NOT throw an ' +
'exception');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate({}, {duration: 100 * MS_PER_SEC,
iterations: Infinity});
animation.playbackRate = -1;
animation.currentTime = -200 * MS_PER_SEC;
animation.reverse();
assert_equals(animation.currentTime, 0,
'reverse() should start playing from the start of animation time ' +
'if the playbackRate < 0 and the currentTime < 0 ' +
'and the target effect is positive infinity');
}, 'Reversing an animation when playbackRate < 0 and currentTime < 0 ' +
'and the target effect end is positive infinity should make it play ' +
'from the start');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation = div.animate({}, 100 * MS_PER_SEC);
animation.playbackRate = 0;
animation.currentTime = 50 * MS_PER_SEC;
animation.reverse();
assert_equals(animation.playbackRate, 0,
'reverse() should preserve playbackRate if the playbackRate == 0');
assert_equals(animation.currentTime, 50 * MS_PER_SEC,
'reverse() should not affect the currentTime if the playbackRate == 0');
t.done();
}, 'Reversing when when playbackRate == 0 should preserve the current ' +
'time and playback rate');
-test(function(t) {
+test(t => {
var div = createDiv(t);
var animation =
new Animation(new KeyframeEffect(div, null, 100 * MS_PER_SEC), null);
- assert_throws('InvalidStateError', function() { animation.reverse(); });
+ assert_throws('InvalidStateError', () => { animation.reverse(); });
}, 'Reversing an animation without an active timeline throws an ' +
'InvalidStateError');
</script>
</body>
--- a/testing/web-platform/tests/web-animations/timing-model/animations/set-the-animation-start-time.html
+++ b/testing/web-platform/tests/web-animations/timing-model/animations/set-the-animation-start-time.html
@@ -5,18 +5,17 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<body>
<div id="log"></div>
<script>
'use strict';
-test(function(t)
-{
+test(t => {
// It should only be possible to set *either* the start time or the current
// time for an animation that does not have an active timeline.
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
null);
assert_equals(animation.currentTime, null, 'Intial current time');
@@ -36,18 +35,17 @@ test(function(t)
animation.startTime = null;
assert_equals(animation.startTime, null,
'Setting the start time to an unresolved time succeeds');
assert_equals(animation.currentTime, null, 'The current time is unaffected');
}, 'Setting the start time of an animation without an active timeline');
-test(function(t)
-{
+test(t => {
// Setting an unresolved start time on an animation without an active
// timeline should not clear the current time.
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
null);
assert_equals(animation.currentTime, null, 'Intial current time');
@@ -61,18 +59,17 @@ test(function(t)
animation.startTime = null;
assert_equals(animation.startTime, null, 'Start time remains unresolved');
assert_equals(animation.currentTime, 1000, 'Current time is unaffected');
}, 'Setting an unresolved start time an animation without an active timeline'
+ ' does not clear the current time');
-test(function(t)
-{
+ test(t => {
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
document.timeline);
// So long as a hold time is set, querying the current time will return
// the hold time.
// Since the start time is unresolved at this point, setting the current time
@@ -88,18 +85,17 @@ test(function(t)
+ ' not the hold time');
// Sanity check
assert_equals(animation.playState, 'running',
'Animation reports it is running after setting a resolved'
+ ' start time');
}, 'Setting the start time clears the hold time');
-test(function(t)
-{
+test(t => {
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
document.timeline);
// Set up a running animation (i.e. both start time and current time
// are resolved).
animation.startTime = document.timeline.currentTime - 1000;
assert_equals(animation.playState, 'running');
@@ -110,77 +106,74 @@ test(function(t)
animation.startTime = null;
assert_times_equal(animation.currentTime, 1000,
'Hold time is set after start time is made unresolved');
assert_equals(animation.playState, 'paused',
'Animation reports it is paused after setting an unresolved'
+ ' start time');
}, 'Setting an unresolved start time sets the hold time');
-promise_test(function(t)
-{
+promise_test(t => {
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
document.timeline);
var readyPromiseCallbackCalled = false;
- animation.ready.then(function() { readyPromiseCallbackCalled = true; } );
+ animation.ready.then(() => { readyPromiseCallbackCalled = true; } );
// Put the animation in the play-pending state
animation.play();
// Sanity check
assert_equals(animation.playState, 'pending',
'Animation is in play-pending state');
// Setting the start time should resolve the 'ready' promise, i.e.
// it should schedule a microtask to run the promise callbacks.
animation.startTime = document.timeline.currentTime;
assert_false(readyPromiseCallbackCalled,
'Ready promise callback is not called synchronously');
// If we schedule another microtask then it should run immediately after
// the ready promise resolution microtask.
- return Promise.resolve().then(function() {
+ return Promise.resolve().then(() => {
assert_true(readyPromiseCallbackCalled,
'Ready promise callback called after setting startTime');
});
}, 'Setting the start time resolves a pending ready promise');
-promise_test(function(t)
-{
+promise_test(t => {
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
document.timeline);
var readyPromiseCallbackCalled = false;
- animation.ready.then(function() { readyPromiseCallbackCalled = true; } );
+ animation.ready.then(() => { readyPromiseCallbackCalled = true; } );
// Put the animation in the pause-pending state
animation.startTime = document.timeline.currentTime;
animation.pause();
// Sanity check
assert_equals(animation.playState, 'pending',
'Animation is in pause-pending state');
// Setting the start time should resolve the 'ready' promise although
// the resolution callbacks when be run in a separate microtask.
animation.startTime = null;
assert_false(readyPromiseCallbackCalled,
'Ready promise callback is not called synchronously');
- return Promise.resolve().then(function() {
+ return Promise.resolve().then(() => {
assert_true(readyPromiseCallbackCalled,
'Ready promise callback called after setting startTime');
});
}, 'Setting the start time resolves a pending pause task');
-promise_test(function(t)
-{
+promise_test(t => {
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
document.timeline);
// Set start time such that the current time is past the end time
animation.startTime = document.timeline.currentTime
- 110 * MS_PER_SEC;
assert_equals(animation.playState, 'finished',
@@ -191,17 +184,17 @@ promise_test(function(t)
assert_greater_than(animation.currentTime,
animation.effect.getComputedTiming().endTime,
'Setting the start time updated the finished state with'
+ ' the \'did seek\' flag set to true');
// Furthermore, that time should persist if we have correctly updated
// the hold time
var finishedCurrentTime = animation.currentTime;
- return waitForAnimationFrames(1).then(function() {
+ return waitForAnimationFrames(1).then(() => {
assert_equals(animation.currentTime, finishedCurrentTime,
'Current time does not change after seeking past the effect'
+ ' end time by setting the current time');
});
}, 'Setting the start time updates the finished state');
</script>
</body>
--- a/testing/web-platform/tests/web-animations/timing-model/animations/set-the-target-effect-of-an-animation.html
+++ b/testing/web-platform/tests/web-animations/timing-model/animations/set-the-target-effect-of-an-animation.html
@@ -5,81 +5,81 @@
<script src='/resources/testharness.js'></script>
<script src='/resources/testharnessreport.js'></script>
<script src='../../testcommon.js'></script>
<body>
<div id='log'></div>
<script>
'use strict';
-promise_test(function(t) {
+promise_test(t => {
var anim = createDiv(t).animate({ marginLeft: [ '0px', '100px' ] },
100 * MS_PER_SEC);
assert_equals(anim.playState, 'pending');
- var retPromise = anim.ready.then(function() {
+ var retPromise = anim.ready.then(() => {
assert_unreached('ready promise is fulfilled');
- }).catch(function(err) {
+ }).catch(err => {
assert_equals(err.name, 'AbortError',
'ready promise is rejected with AbortError');
});
anim.effect = null;
assert_equals(anim.playState, 'paused');
return retPromise;
}, 'If new effect is null and old effect is not null, we reset the pending ' +
'tasks and ready promise is rejected');
-promise_test(function(t) {
+promise_test(t => {
var anim = new Animation();
anim.pause();
assert_equals(anim.playState, 'pending');
anim.effect = new KeyframeEffectReadOnly(createDiv(t),
{ marginLeft: [ '0px', '100px' ] },
100 * MS_PER_SEC);
assert_equals(anim.playState, 'pending');
- return anim.ready.then(function() {
+ return anim.ready.then(() => {
assert_equals(anim.playState, 'paused');
});
}, 'If animation has a pending pause task, reschedule that task to run ' +
'as soon as animation is ready.');
-promise_test(function(t) {
+promise_test(t => {
var anim = new Animation();
anim.play();
assert_equals(anim.playState, 'pending');
anim.effect = new KeyframeEffectReadOnly(createDiv(t),
{ marginLeft: [ '0px', '100px' ] },
100 * MS_PER_SEC);
assert_equals(anim.playState, 'pending');
- return anim.ready.then(function() {
+ return anim.ready.then(() => {
assert_equals(anim.playState, 'running');
});
}, 'If animation has a pending play task, reschedule that task to run ' +
'as soon as animation is ready to play new effect.');
-promise_test(function(t) {
+promise_test(t => {
var animA = createDiv(t).animate({ marginLeft: [ '0px', '100px' ] },
100 * MS_PER_SEC);
var animB = new Animation();
- return animA.ready.then(function() {
+ return animA.ready.then(() => {
animB.effect = animA.effect;
assert_equals(animA.effect, null);
assert_equals(animA.playState, 'finished');
});
}, 'When setting the effect of an animation to the effect of an existing ' +
'animation, the existing animation\'s target effect should be set to null.');
-test(function(t) {
+test(t => {
var animA = createDiv(t).animate({ marginLeft: [ '0px', '100px' ] },
100 * MS_PER_SEC);
var animB = new Animation();
var effect = animA.effect;
animA.currentTime = 50 * MS_PER_SEC;
animB.currentTime = 20 * MS_PER_SEC;
assert_equals(effect.getComputedTiming().progress, 0.5,
'Original timing comes from first animation');
--- a/testing/web-platform/tests/web-animations/timing-model/animations/set-the-timeline-of-an-animation.html
+++ b/testing/web-platform/tests/web-animations/timing-model/animations/set-the-timeline-of-an-animation.html
@@ -11,266 +11,266 @@
'use strict';
// ---------------------------------------------------------------------
//
// Tests from no timeline to timeline
//
// ---------------------------------------------------------------------
-test(function(t) {
+test(t => {
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
null);
animation.currentTime = 50 * MS_PER_SEC;
assert_equals(animation.playState, 'paused');
animation.timeline = document.timeline;
assert_equals(animation.playState, 'paused');
assert_times_equal(animation.currentTime, 50 * MS_PER_SEC);
}, 'After setting timeline on paused animation it is still paused');
-test(function(t) {
+test(t => {
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
null);
animation.currentTime = 200 * MS_PER_SEC;
assert_equals(animation.playState, 'paused');
animation.timeline = document.timeline;
assert_equals(animation.playState, 'paused');
assert_times_equal(animation.currentTime, 200 * MS_PER_SEC);
}, 'After setting timeline on animation paused outside active interval'
+ ' it is still paused');
-test(function(t) {
+test(t => {
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
null);
assert_equals(animation.playState, 'idle');
animation.timeline = document.timeline;
assert_equals(animation.playState, 'idle');
}, 'After setting timeline on an idle animation without a start time'
+ ' it is still idle');
-test(function(t) {
+test(t => {
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
null);
animation.startTime = document.timeline.currentTime;
assert_equals(animation.playState, 'idle');
animation.timeline = document.timeline;
assert_equals(animation.playState, 'running');
}, 'After setting timeline on an idle animation with a start time'
+ ' it is running');
-test(function(t) {
+test(t => {
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
null);
animation.startTime = document.timeline.currentTime - 200 * MS_PER_SEC;
assert_equals(animation.playState, 'idle');
animation.timeline = document.timeline;
assert_equals(animation.playState, 'finished');
}, 'After setting timeline on an idle animation with a sufficiently ancient'
+ ' start time it is finished');
-test(function(t) {
+test(t => {
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
null);
animation.play();
assert_equals(animation.playState, 'pending');
animation.timeline = document.timeline;
assert_equals(animation.playState, 'pending');
}, 'After setting timeline on a play-pending animation it is still pending');
-promise_test(function(t) {
+promise_test(t => {
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
null);
animation.play();
assert_equals(animation.playState, 'pending');
animation.timeline = document.timeline;
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
assert_equals(animation.playState, 'running');
});
}, 'After setting timeline on a play-pending animation it begins playing'
+ ' after pending');
-test(function(t) {
+test(t => {
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
null);
animation.startTime = document.timeline.currentTime;
animation.pause();
animation.timeline = null;
assert_equals(animation.playState, 'pending');
animation.timeline = document.timeline;
assert_equals(animation.playState, 'pending');
}, 'After setting timeline on a pause-pending animation it is still pending');
-promise_test(function(t) {
+promise_test(t => {
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
null);
animation.startTime = document.timeline.currentTime;
animation.pause();
animation.timeline = null;
assert_equals(animation.playState, 'pending');
animation.timeline = document.timeline;
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
assert_equals(animation.playState, 'paused');
});
}, 'After setting timeline on a pause-pending animation it becomes paused'
+ ' after pending');
// ---------------------------------------------------------------------
//
// Tests from timeline to no timeline
//
// ---------------------------------------------------------------------
-test(function(t) {
+test(t => {
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
document.timeline);
animation.currentTime = 50 * MS_PER_SEC;
assert_equals(animation.playState, 'paused');
animation.timeline = null;
assert_equals(animation.playState, 'paused');
assert_times_equal(animation.currentTime, 50 * MS_PER_SEC);
}, 'After clearing timeline on paused animation it is still paused');
-test(function(t) {
+test(t => {
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
document.timeline);
var initialStartTime = document.timeline.currentTime - 200 * MS_PER_SEC;
animation.startTime = initialStartTime;
assert_equals(animation.playState, 'finished');
animation.timeline = null;
assert_equals(animation.playState, 'idle');
assert_times_equal(animation.startTime, initialStartTime);
}, 'After clearing timeline on finished animation it is idle');
-test(function(t) {
+test(t => {
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
document.timeline);
var initialStartTime = document.timeline.currentTime - 50 * MS_PER_SEC;
animation.startTime = initialStartTime;
assert_equals(animation.playState, 'running');
animation.timeline = null;
assert_equals(animation.playState, 'idle');
assert_times_equal(animation.startTime, initialStartTime);
}, 'After clearing timeline on running animation it is idle');
-test(function(t) {
+test(t => {
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
document.timeline);
assert_equals(animation.playState, 'idle');
animation.timeline = null;
assert_equals(animation.playState, 'idle');
assert_equals(animation.startTime, null);
}, 'After clearing timeline on idle animation it is still idle');
-test(function(t) {
+test(t => {
var animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
assert_equals(animation.playState, 'pending');
animation.timeline = null;
assert_equals(animation.playState, 'pending');
}, 'After clearing timeline on play-pending animation it is still pending');
-promise_test(function(t) {
+promise_test(t => {
var animation = createDiv(t).animate(null, 100 * MS_PER_SEC);
assert_equals(animation.playState, 'pending');
animation.timeline = null;
animation.timeline = document.timeline;
assert_equals(animation.playState, 'pending');
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
assert_equals(animation.playState, 'running');
});
}, 'After clearing and re-setting timeline on play-pending animation it'
+ ' begins to play');
-test(function(t) {
+test(t => {
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
document.timeline);
animation.startTime = document.timeline.currentTime;
animation.pause();
assert_equals(animation.playState, 'pending');
animation.timeline = null;
assert_equals(animation.playState, 'pending');
}, 'After clearing timeline on a pause-pending animation it is still pending');
-promise_test(function(t) {
+promise_test(t => {
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
document.timeline);
animation.startTime = document.timeline.currentTime;
animation.pause();
assert_equals(animation.playState, 'pending');
animation.timeline = null;
animation.timeline = document.timeline;
assert_equals(animation.playState, 'pending');
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
assert_equals(animation.playState, 'paused');
});
}, 'After clearing and re-setting timeline on a pause-pending animation it'
+ ' becomes paused');
-promise_test(function(t) {
+promise_test(t => {
var animation =
new Animation(new KeyframeEffect(createDiv(t), null, 100 * MS_PER_SEC),
document.timeline);
var initialStartTime = document.timeline.currentTime - 50 * MS_PER_SEC;
animation.startTime = initialStartTime;
animation.pause();
animation.play();
animation.timeline = null;
animation.timeline = document.timeline;
assert_equals(animation.playState, 'pending');
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
assert_equals(animation.playState, 'running');
assert_times_equal(animation.startTime, initialStartTime);
});
}, 'After clearing and re-setting timeline on an animation in the middle of'
+ ' an aborted pause, it continues playing using the same start time');
</script>
</body>
--- a/testing/web-platform/tests/web-animations/timing-model/animations/updating-the-finished-state.html
+++ b/testing/web-platform/tests/web-animations/timing-model/animations/updating-the-finished-state.html
@@ -15,154 +15,154 @@
// TESTS FOR UPDATING THE HOLD TIME
//
// --------------------------------------------------------------------
// CASE 1: playback rate > 0 and current time >= target effect end
// (Also the start time is resolved and there is pending task)
// Did seek = false
-promise_test(function(t) {
+promise_test(t => {
var anim = createDiv(t).animate(null, 100 * MS_PER_SEC);
// Here and in the following tests we wait until ready resolves as
// otherwise we don't have a resolved start time. We test the case
// where the start time is unresolved in a subsequent test.
- return anim.ready.then(function() {
+ return anim.ready.then(() => {
// Seek to 1ms before the target end and then wait 1ms
anim.currentTime = 100 * MS_PER_SEC - 1;
return waitForAnimationFramesWithDelay(1);
- }).then(function() {
+ }).then(() => {
assert_equals(anim.currentTime, 100 * MS_PER_SEC,
'Hold time is set to target end clamping current time');
});
}, 'Updating the finished state when playing past end');
// Did seek = true
-promise_test(function(t) {
+promise_test(t => {
var anim = createDiv(t).animate(null, 100 * MS_PER_SEC);
- return anim.ready.then(function() {
+ return anim.ready.then(() => {
anim.currentTime = 200 * MS_PER_SEC;
return waitForAnimationFrames(1);
- }).then(function() {
+ }).then(() => {
assert_equals(anim.currentTime, 200 * MS_PER_SEC,
'Hold time is set so current time should NOT change');
});
}, 'Updating the finished state when seeking past end');
// Test current time == target end
//
// We can't really write a test for current time == target end with
// did seek = false since that would imply setting up an animation where
// the next animation frame time happens to exactly align with the target end.
//
// Fortunately, we don't need to test that case since even if the implementation
// fails to set the hold time on such a tick, it should be mostly unobservable
// (on the subsequent tick the hold time will be set to the same value anyway).
// Did seek = true
-promise_test(function(t) {
+promise_test(t => {
var anim = createDiv(t).animate(null, 100 * MS_PER_SEC);
- return anim.ready.then(function() {
+ return anim.ready.then(() => {
anim.currentTime = 100 * MS_PER_SEC;
return waitForAnimationFrames(1);
- }).then(function() {
+ }).then(() => {
assert_equals(anim.currentTime, 100 * MS_PER_SEC,
'Hold time is set so current time should NOT change');
});
}, 'Updating the finished state when seeking exactly to end');
// CASE 2: playback rate < 0 and current time <= 0
// (Also the start time is resolved and there is pending task)
// Did seek = false
-promise_test(function(t) {
+promise_test(t => {
var anim = createDiv(t).animate(null, 100 * MS_PER_SEC);
anim.playbackRate = -1;
anim.play(); // Make sure animation is not initially finished
- return anim.ready.then(function() {
+ return anim.ready.then(() => {
// Seek to 1ms before 0 and then wait 1ms
anim.currentTime = 1;
return waitForAnimationFramesWithDelay(1);
- }).then(function() {
+ }).then(() => {
assert_equals(anim.currentTime, 0 * MS_PER_SEC,
'Hold time is set to zero clamping current time');
});
}, 'Updating the finished state when playing in reverse past zero');
// Did seek = true
-promise_test(function(t) {
+promise_test(t => {
var anim = createDiv(t).animate(null, 100 * MS_PER_SEC);
anim.playbackRate = -1;
anim.play();
- return anim.ready.then(function() {
+ return anim.ready.then(() => {
anim.currentTime = -100 * MS_PER_SEC;
return waitForAnimationFrames(1);
- }).then(function() {
+ }).then(() => {
assert_equals(anim.currentTime, -100 * MS_PER_SEC,
'Hold time is set so current time should NOT change');
});
}, 'Updating the finished state when seeking a reversed animation past zero');
// As before, it's difficult to test current time == 0 for did seek = false but
// it doesn't really matter.
// Did seek = true
-promise_test(function(t) {
+promise_test(t => {
var anim = createDiv(t).animate(null, 100 * MS_PER_SEC);
anim.playbackRate = -1;
anim.play();
- return anim.ready.then(function() {
+ return anim.ready.then(() => {
anim.currentTime = 0;
return waitForAnimationFrames(1);
- }).then(function() {
+ }).then(() => {
assert_equals(anim.currentTime, 0 * MS_PER_SEC,
'Hold time is set so current time should NOT change');
});
}, 'Updating the finished state when seeking a reversed animation exactly'
+ ' to zero');
// CASE 3: playback rate > 0 and current time < target end OR
// playback rate < 0 and current time > 0
// (Also the start time is resolved and there is pending task)
// Did seek = false; playback rate > 0
-promise_test(function(t) {
+promise_test(t => {
var anim = createDiv(t).animate(null, 100 * MS_PER_SEC);
// We want to test that the hold time is cleared so first we need to
// put the animation in a state where the hold time is set.
anim.finish();
- return anim.ready.then(function() {
+ return anim.ready.then(() => {
assert_equals(anim.currentTime, 100 * MS_PER_SEC,
'Hold time is initially set');
// Then extend the duration so that the hold time is cleared and on
// the next tick the current time will increase.
anim.effect.timing.duration *= 2;
return waitForAnimationFrames(1);
- }).then(function() {
+ }).then(() => {
assert_greater_than(anim.currentTime, 100 * MS_PER_SEC,
'Hold time is not set so current time should increase');
});
}, 'Updating the finished state when playing before end');
// Did seek = true; playback rate > 0
-promise_test(function(t) {
+promise_test(t => {
var anim = createDiv(t).animate(null, 100 * MS_PER_SEC);
anim.finish();
- return anim.ready.then(function() {
+ return anim.ready.then(() => {
anim.currentTime = 50 * MS_PER_SEC;
// When did seek = true, updating the finished state: (i) updates
// the animation's start time and (ii) clears the hold time.
// We can test both by checking that the currentTime is initially
// updated and then increases.
assert_equals(anim.currentTime, 50 * MS_PER_SEC, 'Start time is updated');
return waitForAnimationFrames(1);
- }).then(function() {
+ }).then(() => {
assert_greater_than(anim.currentTime, 50 * MS_PER_SEC,
'Hold time is not set so current time should increase');
});
}, 'Updating the finished state when seeking before end');
// Did seek = false; playback rate < 0
//
// Unfortunately it is not possible to test this case. We need to have
@@ -172,99 +172,99 @@ promise_test(function(t) {
// However, the only situation where this could arrive is when we
// replace the timeline and that procedure is likely to change. For all
// other cases we either have an unresolved start time (e.g. when
// paused), we don't have a set hold time (e.g. regular playback), or
// the current time is zero (and anything that gets us out of that state
// will set did seek = true).
// Did seek = true; playback rate < 0
-promise_test(function(t) {
+promise_test(t => {
var anim = createDiv(t).animate(null, 100 * MS_PER_SEC);
anim.playbackRate = -1;
- return anim.ready.then(function() {
+ return anim.ready.then(() => {
anim.currentTime = 50 * MS_PER_SEC;
assert_equals(anim.currentTime, 50 * MS_PER_SEC, 'Start time is updated');
return waitForAnimationFrames(1);
- }).then(function() {
+ }).then(() => {
assert_less_than(anim.currentTime, 50 * MS_PER_SEC,
'Hold time is not set so current time should decrease');
});
}, 'Updating the finished state when seeking a reversed animation before end');
// CASE 4: playback rate == 0
// current time < 0
-promise_test(function(t) {
+promise_test(t => {
var anim = createDiv(t).animate(null, 100 * MS_PER_SEC);
anim.playbackRate = 0;
- return anim.ready.then(function() {
+ return anim.ready.then(() => {
anim.currentTime = -100 * MS_PER_SEC;
return waitForAnimationFrames(1);
- }).then(function() {
+ }).then(() => {
assert_equals(anim.currentTime, -100 * MS_PER_SEC,
'Hold time should not be cleared so current time should'
+ ' NOT change');
});
}, 'Updating the finished state when playback rate is zero and the'
+ ' current time is less than zero');
// current time < target end
-promise_test(function(t) {
+promise_test(t => {
var anim = createDiv(t).animate(null, 100 * MS_PER_SEC);
anim.playbackRate = 0;
- return anim.ready.then(function() {
+ return anim.ready.then(() => {
anim.currentTime = 50 * MS_PER_SEC;
return waitForAnimationFrames(1);
- }).then(function() {
+ }).then(() => {
assert_equals(anim.currentTime, 50 * MS_PER_SEC,
'Hold time should not be cleared so current time should'
+ ' NOT change');
});
}, 'Updating the finished state when playback rate is zero and the'
+ ' current time is less than end');
// current time > target end
-promise_test(function(t) {
+promise_test(t => {
var anim = createDiv(t).animate(null, 100 * MS_PER_SEC);
anim.playbackRate = 0;
- return anim.ready.then(function() {
+ return anim.ready.then(() => {
anim.currentTime = 200 * MS_PER_SEC;
return waitForAnimationFrames(1);
- }).then(function() {
+ }).then(() => {
assert_equals(anim.currentTime, 200 * MS_PER_SEC,
'Hold time should not be cleared so current time should'
+ ' NOT change');
});
}, 'Updating the finished state when playback rate is zero and the'
+ ' current time is greater than end');
// CASE 5: current time unresolved
-promise_test(function(t) {
+promise_test(t => {
var anim = createDiv(t).animate(null, 100 * MS_PER_SEC);
anim.cancel();
// Trigger a change that will cause the "update the finished state"
// procedure to run.
anim.effect.timing.duration = 200 * MS_PER_SEC;
assert_equals(anim.currentTime, null,
'The animation hold time / start time should not be updated');
// The "update the finished state" procedure is supposed to run after any
// change to timing, but just in case an implementation defers that, let's
// wait a frame and check that the hold time / start time has still not been
// updated.
- return waitForAnimationFrames(1).then(function() {
+ return waitForAnimationFrames(1).then(() => {
assert_equals(anim.currentTime, null,
'The animation hold time / start time should not be updated');
});
}, 'Updating the finished state when current time is unresolved');
// CASE 6: has a pending task
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate(null, 100 * MS_PER_SEC);
anim.cancel();
anim.currentTime = 75 * MS_PER_SEC;
anim.play();
// We now have a pending task and a resolved current time.
//
// In the next step we will adjust the timing so that the current time
// is greater than the target end. At this point the "update the finished
@@ -273,36 +273,36 @@ test(function(t) {
anim.effect.timing.duration = 50 * MS_PER_SEC;
assert_equals(anim.currentTime, 75 * MS_PER_SEC,
'Hold time should not be updated');
}, 'Updating the finished state when there is a pending task');
// CASE 7: start time unresolved
// Did seek = false
-promise_test(function(t) {
+promise_test(t => {
var anim = createDiv(t).animate(null, 100 * MS_PER_SEC);
anim.cancel();
// Make it so that only the start time is unresolved (to avoid overlapping
// with the test case where current time is unresolved)
anim.currentTime = 150 * MS_PER_SEC;
// Trigger a change that will cause the "update the finished state"
// procedure to run (did seek = false).
anim.effect.timing.duration = 200 * MS_PER_SEC;
- return waitForAnimationFrames(1).then(function() {
+ return waitForAnimationFrames(1).then(() => {
assert_equals(anim.currentTime, 150 * MS_PER_SEC,
'The animation hold time should not be updated');
assert_equals(anim.startTime, null,
'The animation start time should not be updated');
});
}, 'Updating the finished state when start time is unresolved and'
+ ' did seek = false');
// Did seek = true
-test(function(t) {
+test(t => {
var anim = createDiv(t).animate(null, 100 * MS_PER_SEC);
anim.cancel();
anim.currentTime = 150 * MS_PER_SEC;
// Trigger a change that will cause the "update the finished state"
// procedure to run.
anim.currentTime = 50 * MS_PER_SEC;
assert_equals(anim.currentTime, 50 * MS_PER_SEC,
'The animation hold time should not be updated');
@@ -313,98 +313,98 @@ test(function(t) {
// --------------------------------------------------------------------
//
// TESTS FOR RUNNING FINISH NOTIFICATION STEPS
//
// --------------------------------------------------------------------
function waitForFinishEventAndPromise(animation) {
- var eventPromise = new Promise(function(resolve) {
- animation.onfinish = function() { resolve(); }
+ var eventPromise = new Promise(resolve => {
+ animation.onfinish = resolve;
});
return Promise.all([eventPromise, animation.finished]);
}
-promise_test(function(t) {
+promise_test(t => {
var animation = createDiv(t).animate(null, 1);
animation.onfinish =
t.unreached_func('Seeking to finish should not fire finish event');
animation.finished.then(
t.unreached_func('Seeking to finish should not resolve finished promise'));
animation.currentTime = 1;
animation.currentTime = 0;
animation.pause();
return waitForAnimationFrames(3);
}, 'Finish notification steps don\'t run when the animation seeks to finish'
+ ' and then seeks back again');
-promise_test(function(t) {
+promise_test(t => {
var animation = createDiv(t).animate(null, 1);
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
return waitForFinishEventAndPromise(animation);
});
}, 'Finish notification steps run when the animation completes normally');
-promise_test(function(t) {
+promise_test(t => {
var animation = createDiv(t).animate(null, 1);
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
animation.currentTime = 10;
return waitForFinishEventAndPromise(animation);
});
}, 'Finish notification steps run when the animation seeks past finish');
-promise_test(function(t) {
+promise_test(t => {
var animation = createDiv(t).animate(null, 1);
- return animation.ready.then(function() {
+ return animation.ready.then(() => {
// Register for notifications now since once we seek away from being
// finished the 'finished' promise will be replaced.
var finishNotificationSteps = waitForFinishEventAndPromise(animation);
animation.finish();
animation.currentTime = 0;
animation.pause();
return finishNotificationSteps;
});
}, 'Finish notification steps run when the animation completes with .finish(),'
+ ' even if we then seek away');
-promise_test(function(t) {
+promise_test(t => {
var animation = createDiv(t).animate(null, 1);
var initialFinishedPromise = animation.finished;
- return animation.finished.then(function(target) {
+ return animation.finished.then(target => {
animation.currentTime = 0;
assert_not_equals(initialFinishedPromise, animation.finished);
});
}, 'Animation finished promise is replaced after seeking back to start');
-promise_test(function(t) {
+promise_test(t => {
var animation = createDiv(t).animate(null, 1);
var initialFinishedPromise = animation.finished;
- return animation.finished.then(function(target) {
+ return animation.finished.then(target => {
animation.play();
assert_not_equals(initialFinishedPromise, animation.finished);
});
}, 'Animation finished promise is replaced after replaying from start');
-async_test(function(t) {
+async_test(t => {
var animation = createDiv(t).animate(null, 1);
- animation.onfinish = function(event) {
+ animation.onfinish = event => {
animation.currentTime = 0;
- animation.onfinish = function(event) {
+ animation.onfinish = event => {
t.done();
};
};
}, 'Animation finish event is fired again after seeking back to start');
-async_test(function(t) {
+async_test(t => {
var animation = createDiv(t).animate(null, 1);
- animation.onfinish = function(event) {
+ animation.onfinish = event => {
animation.play();
- animation.onfinish = function(event) {
+ animation.onfinish = event => {
t.done();
};
};
}, 'Animation finish event is fired again after replaying from start');
</script>
</body>
--- a/testing/web-platform/tests/web-animations/timing-model/time-transformations/transformed-progress.html
+++ b/testing/web-platform/tests/web-animations/timing-model/time-transformations/transformed-progress.html
@@ -8,17 +8,17 @@
<script src="../../resources/easing-tests.js"></script>
<body>
<div id="log"></div>
<div id="target"></div>
<script>
'use strict';
gEasingTests.forEach(params => {
- test(function(t) {
+ test(t => {
const target = createDiv(t);
const anim = target.animate(null, { duration: 1000,
fill: 'forwards',
easing: params.easing });
[ 0, 250, 500, 750, 1000 ].forEach(sampleTime => {
anim.currentTime = sampleTime;
const portion = sampleTime / anim.effect.getComputedTiming().duration;
@@ -286,21 +286,21 @@ var gStepAndFramesTimingFunctionTests =
{ currentTime: 1499, progress: 1 },
{ currentTime: 1500, progress: 0 },
{ currentTime: 1999, progress: 0 },
{ currentTime: 2000, progress: 1 }
]
}
];
-gStepAndFramesTimingFunctionTests.forEach(function(options) {
- test(function(t) {
+gStepAndFramesTimingFunctionTests.forEach(options => {
+ test(t => {
var target = createDiv(t);
var animation = target.animate(null, options.effect);
- options.conditions.forEach(function(condition) {
+ options.conditions.forEach(condition => {
animation.currentTime = condition.currentTime;
assert_equals(animation.effect.getComputedTiming().progress,
condition.progress,
'Progress at ' + animation.currentTime + 'ms');
});
}, options.description);
});
--- a/testing/web-platform/tests/web-animations/timing-model/timelines/document-timelines.html
+++ b/testing/web-platform/tests/web-animations/timing-model/timelines/document-timelines.html
@@ -4,34 +4,34 @@
<link rel="help" href="https://w3c.github.io/web-animations/#document-timelines">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<div id="log"></div>
<script>
'use strict';
-async_test(function(t) {
+async_test(t => {
assert_true(document.timeline.currentTime > 0,
'The current time is initially is positive');
// document.timeline.currentTime should be set even before document
// load fires. We expect this code to be run before document load and hence
// the above assertion is sufficient.
// If the following assertion fails, this test needs to be redesigned.
assert_true(document.readyState !== 'complete',
'Test is running prior to document load');
// Test that the document timeline's current time is measured from
// navigationStart.
//
// We can't just compare document.timeline.currentTime to
// window.performance.now() because currentTime is only updated on a sample
// so we use requestAnimationFrame instead.
- window.requestAnimationFrame(function(rafTime) {
- t.step(function() {
+ window.requestAnimationFrame(rafTime => {
+ t.step(() => {
assert_equals(document.timeline.currentTime, rafTime,
'The current time matches requestAnimationFrame time');
});
t.done();
});
}, 'Document timelines report current time relative to navigationStart');
</script>
--- a/testing/web-platform/tests/web-animations/timing-model/timelines/timelines.html
+++ b/testing/web-platform/tests/web-animations/timing-model/timelines/timelines.html
@@ -4,31 +4,31 @@
<link rel="help" href="https://w3c.github.io/web-animations/#timelines">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="../../testcommon.js"></script>
<div id="log"></div>
<script>
'use strict';
-promise_test(function(t) {
+promise_test(t => {
const valueAtStart = document.timeline.currentTime;
const timeAtStart = window.performance.now();
while (window.performance.now() - timeAtStart < 50) {
// Wait 50ms
}
assert_equals(document.timeline.currentTime, valueAtStart,
'Timeline time does not change within an animation frame');
- return waitForAnimationFrames(1).then(function() {
+ return waitForAnimationFrames(1).then(() => {
assert_greater_than(document.timeline.currentTime, valueAtStart,
'Timeline time increases between animation frames');
});
}, 'Timeline time increases once per animation frame');
-async_test(function(t) {
+async_test(t => {
const iframe = document.createElement('iframe');
iframe.width = 10;
iframe.height = 10;
iframe.addEventListener('load', t.step_func(() => {
const iframeTimeline = iframe.contentDocument.timeline;
const valueAtStart = iframeTimeline.currentTime;
const timeAtStart = window.performance.now();
@@ -44,30 +44,30 @@ async_test(function(t) {
'Timeline time within an iframe increases between animation frames');
iframe.remove();
}));
}));
document.body.appendChild(iframe);
}, 'Timeline time increases once per animation frame in an iframe');
-async_test(function(t) {
+async_test(t => {
const startTime = document.timeline.currentTime;
let firstRafTime;
- requestAnimationFrame(function() {
- t.step(function() {
+ requestAnimationFrame(() => {
+ t.step(() => {
assert_greater_than_equal(document.timeline.currentTime, startTime,
'Timeline time should have progressed');
firstRafTime = document.timeline.currentTime;
});
});
- requestAnimationFrame(function() {
- t.step(function() {
+ requestAnimationFrame(() => {
+ t.step(() => {
assert_equals(document.timeline.currentTime, firstRafTime,
'Timeline time should be the same');
});
t.done();
});
}, 'Timeline time should be the same for all RAF callbacks in an animation'
+ ' frame');