1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
|
<!DOCTYPE html>
<meta charset="UTF-8">
<title>border-width interpolation</title>
<link rel="help" href="https://drafts.csswg.org/css-backgrounds-3/#border-width">
<meta name="assert" content="border-width supports animation by computed value">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/interpolation-testcommon.js"></script>
<style>
.parent {
border-width: 30px;
}
.target {
width: 50px;
height: 50px;
background-color: black;
display: inline-block;
border: 2px solid orange;
margin: 18px;
border-width: 10px;
}
.expected {
background-color: green;
}
</style>
<body></body>
<script>
// As per https://bugzilla.mozilla.org/show_bug.cgi?id=137688, Firefox does not
// support getComputedStyle for shorthands. As such, we have one test for this
// which explicitly checks the shorthand variant, but most tests use one of the
// longhands instead.
function compareNotEmpty(actual, expected) {
assert_equals(actual, expected);
assert_not_equals(actual, '');
}
test_interpolation({
property: 'border-width',
from: '20px 40px 60px 80px',
to: '30px 50px 70px 90px',
comparisonFunction: compareNotEmpty,
}, [
{at: -0.3, expect: '17px 37px 57px 77px'},
{at: 0, expect: '20px 40px 60px 80px'},
{at: 0.3, expect: '23px 43px 63px 83px'},
{at: 0.6, expect: '26px 46px 66px 86px'},
{at: 1, expect: '30px 50px 70px 90px'},
{at: 1.5, expect: '35px 55px 75px 95px'}
]);
test_interpolation({
property: 'border-left-width',
from: neutralKeyframe,
to: '20px',
}, [
{at: -0.3, expect: '7px'},
{at: 0, expect: '10px'},
{at: 0.3, expect: '13px'},
{at: 0.6, expect: '16px'},
{at: 1, expect: '20px'},
{at: 1.5, expect: '25px'},
]);
test_interpolation({
property: 'border-left-width',
from: 'initial',
to: '23px',
}, [
{at: -0.3, expect: '0px'},
{at: 0, expect: '3px'},
{at: 0.3, expect: '9px'},
{at: 0.6, expect: '15px'},
{at: 1, expect: '23px'},
{at: 1.5, expect: '33px'},
]);
test_interpolation({
property: 'border-left-width',
from: 'inherit',
to: '20px',
}, [
{at: -0.3, expect: '0px'},
{at: 0, expect: '0px'},
{at: 0.3, expect: '6px'},
{at: 0.6, expect: '12px'},
{at: 1, expect: '20px'},
{at: 1.5, expect: '30px'},
]);
test_interpolation({
property: 'border-left-width',
from: 'unset',
to: '23px',
}, [
{at: -0.3, expect: '0px'},
{at: 0, expect: '3px'},
{at: 0.3, expect: '9px'},
{at: 0.6, expect: '15px'},
{at: 1, expect: '23px'},
{at: 1.5, expect: '33px'},
]);
test_interpolation({
property: 'border-left-width',
from: '0px',
to: '10px'
}, [
{at: -0.3, expect: '0px'}, // CSS border-left-width can't be negative.
{at: 0, expect: '0px'},
{at: 0.3, expect: '3px'},
{at: 0.6, expect: '6px'},
{at: 1, expect: '10px'},
{at: 1.5, expect: '15px'}
]);
test_interpolation({
property: 'border-bottom-width',
from: 'thick',
to: '15px'
}, [
{at: -2, expect: '0px'}, // CSS border-bottom-width can't be negative.
{at: -0.3, expect: '2px'},
{at: 0, expect: '5px'},
{at: 0.3, expect: '8px'},
{at: 0.6, expect: '11px'},
{at: 1, expect: '15px'},
{at: 1.5, expect: '20px'}
]);
test_interpolation({
property: 'border-left-width',
from: 'medium',
to: '13px'
}, [
{at: -2, expect: '0px'}, // CSS border-left-width can't be negative.
{at: -0.25, expect: '0.5px'},
{at: 0, expect: '3px'},
{at: 0.3, expect: '6px'},
{at: 0.6, expect: '9px'},
{at: 1, expect: '13px'},
{at: 1.5, expect: '18px'}
]);
test_interpolation({
property: 'border-right-width',
from: 'thin',
to: '11px'
}, [
{at: -2, expect: '0px'}, // CSS border-right-width can't be negative.
{at: -0.3, expect: '0px'}, // CSS border-right-width can't be negative.
{at: 0, expect: '1px'},
{at: 0.3, expect: '4px'},
{at: 0.6, expect: '7px'},
{at: 1, expect: '11px'},
{at: 1.5, expect: '16px'}
]);
test_interpolation({
property: 'border-top-width',
from: '15px',
to: 'thick'
}, [
{at: -2, expect: '35px'},
{at: -0.3, expect: '18px'},
{at: 0, expect: '15px'},
{at: 0.3, expect: '12px'},
{at: 0.6, expect: '9px'},
{at: 1, expect: '5px'},
{at: 1.5, expect: '0px'}
]);
</script>
|