blob: 93bc02b81ab8a5ce9d1271913c2397b64536c551 [file] [log] [blame]
<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.parent {
--number-list: 30 300;
}
.target {
--number-list: 10 100;
}
</style>
<body>
<script src="../interpolation/resources/interpolation-test.js"></script>
<script>
CSS.registerProperty({
name: '--number-list',
syntax: '<number>+',
initialValue: '40 400',
inherits: false,
});
assertInterpolation({
property: '--number-list',
from: 'initial',
to: '20 200',
}, [
{at: -0.3, is: '46 460'},
{at: 0, is: '40 400'},
{at: 0.5, is: '30 300'},
{at: 1, is: '20 200'},
{at: 1.5, is: '10 100'},
]);
assertInterpolation({
property: '--number-list',
from: 'inherit',
to: '20 200',
}, [
{at: -0.3, is: '33 330'},
{at: 0, is: '30 300'},
{at: 0.5, is: '25 250'},
{at: 1, is: '20 200'},
{at: 1.5, is: '15 150'},
]);
assertInterpolation({
property: '--number-list',
from: 'unset',
to: '20 200',
}, [
{at: -0.3, is: '46 460'},
{at: 0, is: '40 400'},
{at: 0.5, is: '30 300'},
{at: 1, is: '20 200'},
{at: 1.5, is: '10 100'},
]);
assertInterpolation({
property: '--number-list',
from: '-10 -100',
to: '10 100',
}, [
{at: -0.3, is: '-16 -160'},
{at: 0, is: '-10 -100'},
{at: 0.5, is: '0 0'},
{at: 1, is: '10 100'},
{at: 1.5, is: '20 200'}
]);
assertInterpolation({
property: '--number-list',
from: '10',
to: '100',
}, [
{at: -0.3, is: '-17'},
{at: 0, is: '10'},
{at: 0.5, is: '55'},
{at: 1, is: '100'},
{at: 1.5, is: '145'}
]);
// Composition and neutralKeyframe tests assume that composite:add means
// component-wise addition, which may or may not be the behavior we want.
// https://github.com/w3c/css-houdini-drafts/issues/799
assertInterpolation({
property: '--number-list',
from: neutralKeyframe,
to: '20 200',
}, [
{at: -0.3, is: '7 70'},
{at: 0, is: '10 100'},
{at: 0.5, is: '15 150'},
{at: 1, is: '20 200'},
{at: 1.5, is: '25 250'},
]);
assertComposition({
property: '--number-list',
underlying: '50 60',
addFrom: '10 140',
addTo: '110 40',
}, [
{at: -0.3, is: '30 230'},
{at: 0, is: '60 200'},
{at: 0.5, is: '110 150'},
{at: 1, is: '160 100'},
{at: 1.5, is: '210 50'},
]);
assertComposition({
property: '--number-list',
underlying: '50 60',
addFrom: '10 140',
replaceTo: '110 40',
}, [
{at: -0.3, is: '45 248'},
{at: 0, is: '60 200'},
{at: 0.5, is: '85 120'},
{at: 1, is: '110 40'},
{at: 1.5, is: '135 -40'},
]);
</script>
</body>