blob: ead49ac8e07153b025db7107f6890aa38dabe727 [file] [log] [blame]
<!DOCTYPE html>
<meta charset="UTF-8">
<style>
.container {
position: relative;
width: 50px;
height: 50px;
border: black solid 2px;
display: inline-block;
margin-left: 10px;
margin-right: 10px;
background-color: white;
}
.target {
position: absolute;
width: 10px;
height: 50px;
background-color: black;
}
.replica {
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: 'left',
from: 'calc(50% - 25px)',
to: 'calc(100% - 10px)'
}, [
{at: -0.25, is: '-10px'},
{at: 0, is: '0px'},
{at: 0.25, is: '10px'},
{at: 0.5, is: '20px'},
{at: 0.75, is: '30px'},
{at: 1, is: '40px'},
{at: 1.25, is: '50px'}
]);
assertInterpolation({
property: 'text-indent',
from: 'calc(50% - 25px)',
to: 'calc(100% - 10px)'
}, [
{at: -0.25, is: 'calc(((50% - 25px) * 1.25) + ((100% - 10px) * -0.25))'},
{at: 0, is: 'calc(50% - 25px)'},
{at: 0.25, is: 'calc(((50% - 25px) * 0.75) + ((100% - 10px) * 0.25))'},
{at: 0.5, is: 'calc(((50% - 25px) * 0.5) + ((100% - 10px) * 0.5))'},
{at: 0.75, is: 'calc(((50% - 25px) * 0.25) + ((100% - 10px) * 0.75))'},
{at: 1, is: 'calc(100% - 10px)'},
{at: 1.25, is: 'calc(((50% - 25px) * -0.25) + ((100% - 10px) * 1.25))'}
]);
assertInterpolation({
property: 'text-indent',
from: '0em',
to: '100px'
}, [
{at: -0.25, is: '-25px'},
{at: 0, is: '0em'},
{at: 0.25, is: '25px'},
{at: 0.5, is: '50px'},
{at: 0.75, is: '75px'},
{at: 1, is: '100px'},
{at: 1.25, is: '125px'}
]);
assertInterpolation({
property: 'text-indent',
from: '0%',
to: '100px'
}, [
{at: -0.25, is: 'calc(0% + -25px)'},
{at: 0, is: '0%'},
{at: 0.25, is: 'calc(0% + 25px)'},
{at: 0.5, is: 'calc(0% + 50px)'},
{at: 0.75, is: 'calc(0% + 75px)'},
{at: 1, is: '100px'},
{at: 1.25, is: 'calc(0% + 125px)'}
]);
</script>
</body>