blob: 4fbd3cf59382b7883b59eabde2506c695cb0afae [file] [log] [blame]
<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.parent {
--length: 30px;
}
.target {
--length: 10px;
font-size: 20px;
}
</style>
<body>
<script src="../interpolation/resources/interpolation-test.js"></script>
<script>
CSS.registerProperty({
name: '--length',
syntax: '<length>',
initialValue: '40px',
inherits: false,
});
assertInterpolation({
property: '--length',
from: neutralKeyframe,
to: '20px',
}, [
{at: -0.3, is: '7px'},
{at: 0, is: '10px'},
{at: 0.5, is: '15px'},
{at: 1, is: '20px'},
{at: 1.5, is: '25px'},
]);
assertInterpolation({
property: '--length',
from: 'initial',
to: '20px',
}, [
{at: -0.3, is: '46px'},
{at: 0, is: '40px'},
{at: 0.5, is: '30px'},
{at: 1, is: '20px'},
{at: 1.5, is: '10px'},
]);
assertInterpolation({
property: '--length',
from: 'inherit',
to: '20px',
}, [
{at: -0.3, is: '33px'},
{at: 0, is: '30px'},
{at: 0.5, is: '25px'},
{at: 1, is: '20px'},
{at: 1.5, is: '15px'},
]);
assertInterpolation({
property: '--length',
from: 'unset',
to: '20px',
}, [
{at: -0.3, is: '46px'},
{at: 0, is: '40px'},
{at: 0.5, is: '30px'},
{at: 1, is: '20px'},
{at: 1.5, is: '10px'},
]);
assertInterpolation({
property: '--length',
from: '-10px',
to: '10px',
}, [
{at: -0.3, is: '-16px'},
{at: 0, is: '-10px'},
{at: 0.5, is: '0px'},
{at: 1, is: '10px'},
{at: 1.5, is: '20px'}
]);
assertInterpolation({
property: '--length',
from: '10em',
to: '20em',
}, [
{at: -0.3, is: '140px'},
{at: 0, is: '200px'},
{at: 0.5, is: '300px'},
{at: 1, is: '400px'},
{at: 1.5, is: '500px'}
]);
assertInterpolation({
property: '--length',
from: '10em',
to: '100px',
}, [
{at: -0.3, is: '230px'},
{at: 0, is: '200px'},
{at: 0.5, is: '150px'},
{at: 1, is: '100px'},
{at: 1.5, is: '50px'}
]);
</script>
</body>