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 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>grid-template-rows interpolation</title>
<link rel="help" href="https://drafts.csswg.org/css-grid/#track-sizing">
<meta name="assert" content="grid-template-rows supports animation.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/interpolation-testcommon.js"></script>
<style>
.parent {
grid-template-rows: 10px 20px 30px;
}
</style>
</head>
<body>
<script>
'use strict';
// Distinct length of track list.
test_no_interpolation({
property: 'grid-template-rows',
from: "1fr 1fr 1fr",
to: "2fr 2fr"
});
test_no_interpolation({
property: 'grid-template-rows',
from: "10px 20px 30px",
to: "20px 30px"
});
test_no_interpolation({
property: 'grid-template-rows',
from: "1fr 1fr 1fr",
to: "none"
});
test_no_interpolation({
property: 'grid-template-rows',
from: "none",
to: "20px 30px"
});
// Exercise <explicit-track-list>
test_interpolation({
property: 'grid-template-rows',
from: "10px 20px 30px",
to: "20px 30px 40px"
}, [
{at: -1, expect: "0px 10px 20px"},
{at: 0, expect: "10px 20px 30px"},
{at: 0.4, expect: "14px 24px 34px"},
{at: 0.6, expect: "16px 26px 36px"},
{at: 1, expect: "20px 30px 40px"},
{at: 2, expect: "30px 40px 50px"}
]);
test_interpolation({
property: 'grid-template-rows',
from: "10px 20px 30px",
to: "20% 30% 40px"
}, [
{at: -1, expect: "calc(20px + -20%) calc(40px + -30%) 20px"},
{at: 0, expect: "calc(10px + 0%) calc(20px + 0%) 30px"},
{at: 0.4, expect: "calc(6px + 8%) calc(12px + 12%) 34px"},
{at: 0.6, expect: "calc(4px + 12%) calc(8px + 18%) 36px"},
{at: 1, expect: "20% 30% 40px"},
{at: 2, expect: "calc(-10px + 40%) calc(-20px + 60%) 50px"}
]);
test_interpolation({
property: 'grid-template-rows',
from: "1fr 1fr 1fr",
to: "2fr auto 2fr"
}, [
{at: -1, expect: "0fr 1fr 0fr"},
{at: 0, expect: "1fr 1fr 1fr"},
{at: 0.4, expect: "1.4fr 1fr 1.4fr"},
{at: 0.6, expect: "1.6fr auto 1.6fr"},
{at: 1, expect: "2fr auto 2fr"},
{at: 2, expect: "3fr auto 3fr"}
]);
test_interpolation({
property: 'grid-template-rows',
from: "1fr [a b] 1fr [d] 1fr",
to: "2fr [c] auto 2fr"
}, [
{at: -1, expect: "0fr [a b] 1fr [d] 0fr"},
{at: 0, expect: "1fr [a b] 1fr [d] 1fr"},
{at: 0.4, expect: "1.4fr [a b] 1fr [d] 1.4fr"},
{at: 0.6, expect: "1.6fr [c] auto 1.6fr"},
{at: 1, expect: "2fr [c] auto 2fr"},
{at: 2, expect: "3fr [c] auto 3fr"}
]);
test_interpolation({
property: 'grid-template-rows',
from: "fit-content(10px) fit-content(20px)",
to: "fit-content(20px) max-content"
}, [
{at: -1, expect: "fit-content(0px) fit-content(20px)"},
{at: 0, expect: "fit-content(10px) fit-content(20px)"},
{at: 0.4, expect: "fit-content(14px) fit-content(20px)"},
{at: 0.6, expect: "fit-content(16px) max-content"},
{at: 1, expect: "fit-content(20px) max-content"},
{at: 2, expect: "fit-content(30px) max-content"}
]);
test_interpolation({
property: 'grid-template-rows',
from: "minmax(10px, 1fr) minmax(20px, 2fr)",
to: "minmax(20px, 2fr) minmax(30px, auto)"
}, [
{at: -1, expect: "minmax(0px, 0fr) minmax(10px, 2fr)"},
{at: 0, expect: "minmax(10px, 1fr) minmax(20px, 2fr)"},
{at: 0.4, expect: "minmax(14px, 1.4fr) minmax(24px, 2fr)"},
{at: 0.6, expect: "minmax(16px, 1.6fr) minmax(26px, auto)"},
{at: 1, expect: "minmax(20px, 2fr) minmax(30px, auto)"},
{at: 2, expect: "minmax(30px, 3fr) minmax(40px, auto)"}
]);
test_interpolation({
property: 'grid-template-rows',
from: "10px 10px 10px",
to: "1fr fit-content(20px) minmax(20px, 2fr)"
}, [
{at: -1, expect: "10px 10px 10px"},
{at: 0, expect: "10px 10px 10px"},
{at: 0.4, expect: "10px 10px 10px"},
{at: 0.6, expect: "1fr fit-content(20px) minmax(20px, 2fr)"},
{at: 1, expect: "1fr fit-content(20px) minmax(20px, 2fr)"},
{at: 2, expect: "1fr fit-content(20px) minmax(20px, 2fr)"}
]);
test_interpolation({
property: 'grid-template-rows',
from: "1fr 1fr 1fr",
to: "20px fit-content(20px) minmax(20px, 2fr)"
}, [
{at: -1, expect: "1fr 1fr 1fr"},
{at: 0, expect: "1fr 1fr 1fr"},
{at: 0.4, expect: "1fr 1fr 1fr"},
{at: 0.6, expect: "20px fit-content(20px) minmax(20px, 2fr)"},
{at: 1, expect: "20px fit-content(20px) minmax(20px, 2fr)"},
{at: 2, expect: "20px fit-content(20px) minmax(20px, 2fr)"}
]);
test_interpolation({
property: 'grid-template-rows',
from: "fit-content(10px)",
to: "minmax(20px, 2fr)"
}, [
{at: -1, expect: "fit-content(10px)"},
{at: 0, expect: "fit-content(10px)"},
{at: 0.4, expect: "fit-content(10px)"},
{at: 0.6, expect: "minmax(20px, 2fr)"},
{at: 1, expect: "minmax(20px, 2fr)"},
{at: 2, expect: "minmax(20px, 2fr)"}
]);
test_interpolation({
property: 'grid-template-rows',
from: "inherit",
to: "20px 30px 40px"
}, [
{at: -1, expect: "0px 10px 20px"},
{at: 0, expect: "10px 20px 30px"},
{at: 0.4, expect: "14px 24px 34px"},
{at: 0.6, expect: "16px 26px 36px"},
{at: 1, expect: "20px 30px 40px"},
{at: 2, expect: "30px 40px 50px"}
]);
// Exercise <track-list> (with <track-repeat>)
// https://drafts.csswg.org/css-grid/#repeat-interpolation
test_no_interpolation({
property: 'grid-template-rows',
from: "1fr repeat(2, 2fr 30px) 1fr",
to: "2fr repeat(2, 3fr 40px 50px) 2fr"
});
test_no_interpolation({
property: 'grid-template-rows',
from: "1fr repeat(2, 2fr 30px) 1fr",
to: "2fr repeat(3, 3fr 40px) 2fr"
});
// See https://github.com/w3c/csswg-drafts/issues/3503
test_no_interpolation({
property: 'grid-template-rows',
from: "repeat(2, 2fr 30px)",
to: "repeat(4, 40px)"
});
test_interpolation({
property: 'grid-template-rows',
from: "1fr repeat(2, 2fr auto 30px) 1fr",
to: "2fr repeat(2, 3fr 30px 40px) 2fr"
}, [
{at: -1, expect: "0fr repeat(2, 1fr auto 20px) 0fr"},
{at: 0, expect: "1fr repeat(2, 2fr auto 30px) 1fr"},
{at: 0.4, expect: "1.4fr repeat(2, 2.4fr auto 34px) 1.4fr"},
{at: 0.6, expect: "1.6fr repeat(2, 2.6fr 30px 36px) 1.6fr"},
{at: 1, expect: "2fr repeat(2, 3fr 30px 40px) 2fr"},
{at: 2, expect: "3fr repeat(2, 4fr 30px 50px) 3fr"}
]);
// Exercise <auto-track-list>
test_no_interpolation({
property: 'grid-template-rows',
from: "10px repeat(auto-fill, minmax(25px, 1fr)) 10px",
to: "20px 20px repeat(auto-fill, minmax(30px, 1fr))"
});
test_no_interpolation({
property: 'grid-template-rows',
from: "10px repeat(auto-fill, minmax(25px, 1fr)) 10px",
to: "20px repeat(auto-fit, minmax(30px, 1fr)) 20px"
});
test_no_interpolation({
property: 'grid-template-rows',
from: "10px repeat(auto-fill, minmax(25px, 1fr)) 10px",
to: "20px repeat(auto-fill, minmax(35px, auto)) 20px"
});
</script>
</body>
</html>
|