--- 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
@@ -1127,63 +1127,31 @@ const boxShadowListType = {
[ { time: 0, expected: 'rgb(0, 0, 0) 0px 0px 0px 0px, ' +
'rgb(120, 120, 120) 10px 10px 10px 0px' }]);
}, property + ': shadow');
},
};
const positionType = {
testInterpolation: function(property, setup) {
- test(function(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 position');
-
- test(function(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 position of rem');
+ lengthPairType.testInterpolation(property, setup);
test(function(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');
},
testAddition: function(property, setup) {
- test(function(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: 'add' });
- testAnimationSamples(animation, idlName, [{ time: 0, expected: '20px 20px' }]);
- }, property + ': position');
-
- test(function(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: 'add' });
- testAnimationSamples(animation, idlName, [{ time: 0, expected: '20px 20px' }]);
- }, property + ': position of rem');
+ lengthPairType.testAddition(property, setup);
test(function(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: 'add' });
testAnimationSamples(