| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/x
html1/DTD/xhtml1-strict.dtd"> |
| 2 <html xmlns="http://www.w3.org/1999/xhtml"> |
| 3 <head> |
| 4 <title>CSS Grid Layout Test: Support flexible lengths for 'grid-template
-columns' and 'grid-template-rows' properties</title> |
| 5 <link rel="author" title="Manuel Rego Casasnovas" href="mailto:rego@igal
ia.com" /> |
| 6 <link rel="help" href="http://www.w3.org/TR/css-grid-1/#fr-unit" title="
5.1.3 Flexible Lengths: the fr unit" /> |
| 7 <meta name="flags" content="ahem dom" /> |
| 8 <meta name="assert" content="This test checks that 'grid-template-column
s' and 'grid-template-rows' properties support flexible lengths (the 'fr' unit),
so you can use it to represent a fraction of the free space in the grid contain
er." /> |
| 9 <script src="/resources/testharness.js" type="text/javascript"></script> |
| 10 <script src="/resources/testharnessreport.js" type="text/javascript"></s
cript> |
| 11 <script src="support/testing-utils.js" type="text/javascript"></script> |
| 12 <style type="text/css"><![CDATA[ |
| 13 .grid { |
| 14 display: grid; |
| 15 width: 800px; |
| 16 height: 600px; |
| 17 font: 10px/1 Ahem; |
| 18 justify-content: start; |
| 19 align-content: start; |
| 20 } |
| 21 ]]></style> |
| 22 </head> |
| 23 <body> |
| 24 <div id="log"></div> |
| 25 |
| 26 <div id="emptyGrid" class="grid"></div> |
| 27 <div id="grid" class="grid"> |
| 28 <div>GRID ITEM</div> |
| 29 </div> |
| 30 |
| 31 <script type="text/javascript"><![CDATA[ |
| 32 // Valid values. |
| 33 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "1fr", "1fr",
"800px", "600px"); |
| 34 TestingUtils.testGridTemplateColumnsRows("grid", "1fr", "1fr", "800p
x", "600px"); |
| 35 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "2fr", "2fr",
"800px", "600px"); |
| 36 TestingUtils.testGridTemplateColumnsRows("grid", "2fr", "2fr", "800p
x", "600px"); |
| 37 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "10fr", "10fr"
, "800px", "600px"); |
| 38 TestingUtils.testGridTemplateColumnsRows("grid", "10fr", "10fr", "80
0px", "600px"); |
| 39 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "0.5fr", "0.5f
r", "400px", "300px"); |
| 40 TestingUtils.testGridTemplateColumnsRows("grid", "0.5fr", "0.5fr", "
400px", "300px"); |
| 41 TestingUtils.testGridTemplateColumnsRows("emptyGrid", ".5fr", ".5fr"
, "400px", "300px"); |
| 42 TestingUtils.testGridTemplateColumnsRows("grid", ".5fr", ".5fr", "40
0px", "300px"); |
| 43 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "minmax(100px,
1fr)", "minmax(100px, 1fr)", "800px", "600px"); |
| 44 TestingUtils.testGridTemplateColumnsRows("grid", "minmax(100px, 1fr)
", "minmax(100px, 1fr)", "800px", "600px"); |
| 45 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "minmax(1fr, 1
fr)", "minmax(1fr, 1fr)", "800px", "600px"); |
| 46 TestingUtils.testGridTemplateColumnsRows("grid", "minmax(1fr, 1fr)",
"minmax(1fr, 1fr)", "800px", "600px"); |
| 47 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "1fr 1fr", "1f
r 1fr", ["400px 400px", "repeat(2, 400px)"], ["300px 300px", "repeat(2, 300px)"]
); |
| 48 TestingUtils.testGridTemplateColumnsRows("grid", "1fr 1fr", "1fr 1fr
", ["400px 400px", "repeat(2, 400px)"], ["300px 300px", "repeat(2, 300px)"]); |
| 49 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "0.25fr 0.75fr
", "0.25fr 0.75fr", "200px 600px", "150px 450px"); |
| 50 TestingUtils.testGridTemplateColumnsRows("grid", "0.25fr 0.75fr", "0
.25fr 0.75fr", "200px 600px", "150px 450px"); |
| 51 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "1fr 2fr 1fr",
"1fr 2fr 1fr", "200px 400px 200px", "150px 300px 150px"); |
| 52 TestingUtils.testGridTemplateColumnsRows("grid", "1fr 2fr 1fr", "1fr
2fr 1fr", "200px 400px 200px", "150px 300px 150px"); |
| 53 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "auto 1fr 4fr
3fr 2fr", "auto 1fr 4fr 3fr 2fr", "0px 80px 320px 240px 160px", "0px 60px 240px
180px 120px"); |
| 54 TestingUtils.testGridTemplateColumnsRows("grid", "auto 1fr 4fr 3fr 2
fr", "auto 1fr 4fr 3fr 2fr", "90px 71px 284px 213px 142px", "10px 59px 236px 177
px 118px"); |
| 55 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "1fr 4fr 100px
3fr 2fr", "1fr 4fr 100px 3fr 2fr", "70px 280px 100px 210px 140px", "50px 200px
100px 150px 100px"); |
| 56 TestingUtils.testGridTemplateColumnsRows("grid", "1fr 4fr 100px 3fr
2fr", "1fr 4fr 100px 3fr 2fr", "70px 280px 100px 210px 140px", "50px 200px 100px
150px 100px"); |
| 57 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "auto 1fr", "a
uto 1fr", "0px 800px", "0px 600px"); |
| 58 TestingUtils.testGridTemplateColumnsRows("grid", "auto 1fr", "auto 1
fr", "90px 710px", "10px 590px"); |
| 59 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "max-content 1
fr", "max-content 1fr", "0px 800px", "0px 600px"); |
| 60 TestingUtils.testGridTemplateColumnsRows("grid", "max-content 1fr",
"max-content 1fr", "90px 710px", "10px 590px"); |
| 61 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "min-content 1
fr", "min-content 1fr", "0px 800px", "0px 600px"); |
| 62 TestingUtils.testGridTemplateColumnsRows("grid", "min-content 1fr",
"min-content 1fr", "40px 760px", "20px 580px"); |
| 63 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "1fr auto", "1
fr auto", "800px 0px", "600px 0px"); |
| 64 TestingUtils.testGridTemplateColumnsRows("grid", "1fr auto", "1fr au
to", "800px 0px", "600px 0px"); |
| 65 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "300px 1fr", "
200px 1fr", "300px 500px", "200px 400px"); |
| 66 TestingUtils.testGridTemplateColumnsRows("grid", "300px 1fr", "200px
1fr", "300px 500px", "200px 400px"); |
| 67 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "800px 1fr", "
600px 1fr", "800px 0px", "600px 0px"); |
| 68 TestingUtils.testGridTemplateColumnsRows("grid", "800px 1fr", "600px
1fr", "800px 0px", "600px 0px"); |
| 69 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "1000px 1fr",
"700px 1fr", "1000px 0px", "700px 0px"); |
| 70 TestingUtils.testGridTemplateColumnsRows("grid", "1000px 1fr", "700p
x 1fr", "1000px 0px", "700px 0px"); |
| 71 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "calc(50px + 5
0%) 1fr", "calc(50px + 50%) 1fr", "450px 350px", "350px 250px"); |
| 72 TestingUtils.testGridTemplateColumnsRows("grid", "calc(50px + 50%) 1
fr", "calc(50px + 50%) 1fr", "450px 350px", "350px 250px"); |
| 73 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "minmax(100px,
300px) 1fr", "minmax(100px, 200px) 1fr", "300px 500px", "200px 400px"); |
| 74 TestingUtils.testGridTemplateColumnsRows("grid", "minmax(100px, 300p
x) 1fr", "minmax(100px, 200px) 1fr", "300px 500px", "200px 400px"); |
| 75 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "repeat(4, 1fr
)", "repeat(4, 1fr)", ["200px 200px 200px 200px", "repeat(4, 200px)"], ["150px 1
50px 150px 150px", "repeat(4, 150px)"]); |
| 76 TestingUtils.testGridTemplateColumnsRows("grid", "repeat(4, 1fr)", "
repeat(4, 1fr)", ["200px 200px 200px 200px", "repeat(4, 200px)"], ["150px 150px
150px 150px", "repeat(4, 150px)"]); |
| 77 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "[a] repeat(4,
[b] 1fr [c]) [d]", "[z] repeat(4, [y] 1fr) [x]", ["[a b] 200px [c b] 200px [c b
] 200px [c b] 200px [c d]", "[a] repeat(4, [b] 200px [c]) [d]"], ["[z y] 150px [
y] 150px [y] 150px [y] 150px [x]", "[z] repeat(4, [y] 150px) [x]"]); |
| 78 TestingUtils.testGridTemplateColumnsRows("grid", "[a] repeat(4, [b]
1fr [c]) [d]", "[z] repeat(4, [y] 1fr) [x]", ["[a b] 200px [c b] 200px [c b] 200
px [c b] 200px [c d]", "[a] repeat(4, [b] 200px [c]) [d]"], ["[z y] 150px [y] 15
0px [y] 150px [y] 150px [x]", "[z] repeat(4, [y] 150px) [x]"]); |
| 79 |
| 80 // Reset values. |
| 81 document.getElementById("emptyGrid").style.gridTemplateColumns = ""; |
| 82 document.getElementById("emptyGrid").style.gridTemplateRows = ""; |
| 83 document.getElementById("grid").style.gridTemplateColumns = ""; |
| 84 document.getElementById("grid").style.gridTemplateRows = ""; |
| 85 |
| 86 // Wrong values. |
| 87 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "fr", "fr", "n
one", "none"); |
| 88 TestingUtils.testGridTemplateColumnsRows("grid", "fr", "fr", "90px",
"10px"); |
| 89 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "1 fr", "1 fr"
, "none", "none"); |
| 90 TestingUtils.testGridTemplateColumnsRows("grid", "1 fr", "1 fr", "90
px", "10px"); |
| 91 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "1free-space",
"1free-space", "none", "none"); |
| 92 TestingUtils.testGridTemplateColumnsRows("grid", "1free-space", "1fr
ee-space", "90px", "10px"); |
| 93 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "-2fr", "-2fr"
, "none", "none"); |
| 94 TestingUtils.testGridTemplateColumnsRows("grid", "-2fr", "-2fr", "90
px", "10px"); |
| 95 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "0,5fr", "0,5f
r", "none", "none"); |
| 96 TestingUtils.testGridTemplateColumnsRows("grid", "0,5fr", "0,5fr", "
90px", "10px"); |
| 97 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "calc(1fr + 10
0px)", "calc(1fr + 100px)", "none", "none"); |
| 98 TestingUtils.testGridTemplateColumnsRows("grid", "calc(1fr + 100px)"
, "calc(1fr + 100px)", "90px", "10px"); |
| 99 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "(1fr) auto",
"(1fr) auto", "none", "none"); |
| 100 TestingUtils.testGridTemplateColumnsRows("grid", "(1fr) auto", "(1fr
) auto", "90px", "10px"); |
| 101 TestingUtils.testGridTemplateColumnsRows("emptyGrid", "minmax(1fr, 1
000px)", "minmax(1fr, 700px)", "none", "none"); |
| 102 TestingUtils.testGridTemplateColumnsRows("grid", "minmax(1fr, 1000px
)", "minmax(1fr, 700px)", "90px", "10px"); |
| 103 ]]></script> |
| 104 </body> |
| 105 </html> |
| OLD | NEW |