blob: dccb20484e9c7e35f5205c9d9e53b29a16c0e900 [file] [log] [blame]
<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.parent {
width: 100px;
overflow: visible;
}
.target {
background-color: black;
width: 10px;
height: 10px;
}
.expected {
background-color: green;
}
</style>
<body>
<template id="target-template">
<div class="container">
<div class="target"></div>
</div>
</template>
<script src="resources/interpolation-test.js"></script>
<script>
assertInterpolation({
property: 'width',
from: neutralKeyframe,
to: '40px',
}, [
{at: -0.3, is: '1px'},
{at: 0, is: '10px'},
{at: 0.3, is: '19px'},
{at: 0.6, is: '28px'},
{at: 1, is: '40px'},
{at: 1.5, is: '55px'},
]);
assertNoInterpolation({
property: 'width',
from: 'initial',
to: '40px',
});
assertInterpolation({
property: 'width',
from: 'inherit',
to: '40px',
}, [
{at: -0.3, is: '118px'},
{at: 0, is: '100px'},
{at: 0.3, is: '82px'},
{at: 0.6, is: '64px'},
{at: 1, is: '40px'},
{at: 1.5, is: '10px'},
]);
assertNoInterpolation({
property: 'width',
from: 'unset',
to: '40px',
});
assertInterpolation({
property: 'width',
from: '0px',
to: '100px',
}, [
{at: -0.3, is: '0px'}, // CSS width can't be negative.
{at: 0, is: '0px'},
{at: 0.3, is: '30px'},
{at: 0.6, is: '60px'},
{at: 1, is: '100px'},
{at: 1.5, is: '150px'}
]);
assertInterpolation({
property: 'width',
from: '10px',
to: '100%'
}, [
{at: -0.3, is: '0px'}, // CSS width can't be negative.
{at: 0, is: '10px'},
{at: 0.3, is: '37px'},
{at: 0.6, is: '64px'},
{at: 1, is: '100px'},
{at: 1.5, is: '145px'}
]);
</script>
</body>