| OLD | NEW |
| 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> | 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <link href="resources/grid.css" rel="stylesheet"> | 4 <link href="resources/grid.css" rel="stylesheet"> |
| 5 <style> | 5 <style> |
| 6 .gridAutoFixedFixed { | 6 .gridAutoFixedFixed { |
| 7 grid-auto-rows: 30px; | 7 grid-auto-rows: 30px; |
| 8 grid-auto-columns: 50px; | 8 grid-auto-columns: 50px; |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 grid-auto-columns: 40px; | 23 grid-auto-columns: 40px; |
| 24 grid-template-rows: 15px; | 24 grid-template-rows: 15px; |
| 25 grid-template-columns: 20px; | 25 grid-template-columns: 20px; |
| 26 } | 26 } |
| 27 | 27 |
| 28 .gridAutoAutoInMinMax { | 28 .gridAutoAutoInMinMax { |
| 29 grid-auto-rows: minmax(auto, 8vh); | 29 grid-auto-rows: minmax(auto, 8vh); |
| 30 grid-auto-columns: minmax(10vw, auto); | 30 grid-auto-columns: minmax(10vw, auto); |
| 31 } | 31 } |
| 32 | 32 |
| 33 .gridAutoMultipleTracks { |
| 34 width: 100px; |
| 35 height: 50px; |
| 36 grid-auto-rows: 10px 20px 30px; |
| 37 grid-auto-columns: 25px 50px 100px; |
| 38 } |
| 39 |
| 33 </style> | 40 </style> |
| 34 <script src="../../resources/js-test.js"></script> | 41 <script src="../../resources/js-test.js"></script> |
| 35 <script src="resources/grid-definitions-parsing-utils.js"></script> | 42 <script src="resources/grid-definitions-parsing-utils.js"></script> |
| 36 </head> | 43 </head> |
| 37 <body> | 44 <body> |
| 38 <div class="grid gridAutoFixedFixed" id="gridAutoFixedFixed"></div> | 45 <div class="grid gridAutoFixedFixed" id="gridAutoFixedFixed"></div> |
| 39 <div class="grid gridAutoMinMax" id="gridAutoMinMax"></div> | 46 <div class="grid gridAutoMinMax" id="gridAutoMinMax"></div> |
| 40 <div class="grid gridAutoMinMaxContent" id="gridAutoMinMaxContent"></div> | 47 <div class="grid gridAutoMinMaxContent" id="gridAutoMinMaxContent"></div> |
| 41 <div class="grid gridAutoAutoInMinMax" id="gridAutoAutoInMinMax"></div> | 48 <div class="grid gridAutoAutoInMinMax" id="gridAutoAutoInMinMax"></div> |
| 42 <div class="grid gridAutoFixedFixed" id="gridAutoFixedFixedWithChildren"> | 49 <div class="grid gridAutoFixedFixed" id="gridAutoFixedFixedWithChildren"> |
| 43 <div class="sizedToGridArea firstRowFirstColumn"></div> | 50 <div class="sizedToGridArea firstRowFirstColumn"></div> |
| 44 </div> | 51 </div> |
| 45 <div class="grid gridAutoFixedFixedWithFixedFixed" id="gridAutoFixedFixedWithFix
edFixedWithChildren"> | 52 <div class="grid gridAutoFixedFixedWithFixedFixed" id="gridAutoFixedFixedWithFix
edFixedWithChildren"> |
| 46 <div class="sizedToGridArea thirdRowAutoColumn"></div> | 53 <div class="sizedToGridArea thirdRowAutoColumn"></div> |
| 47 <div class="sizedToGridArea autoRowThirdColumn"></div> | 54 <div class="sizedToGridArea autoRowThirdColumn"></div> |
| 48 </div> | 55 </div> |
| 56 <div class="grid gridAutoMultipleTracks" id="gridAutoMultipleTracks"> |
| 57 <div style="grid-column: 1; grid-row: 1"></div> |
| 58 <div style="grid-column: 2; grid-row: 2"></div> |
| 59 <div style="grid-column: 3; grid-row: 3"></div> |
| 60 <div style="grid-column: 4; grid-row: 4"></div> |
| 61 </div> |
| 62 <div class="grid gridAutoMultipleTracks" id="gridAutoMultipleTracksNegativeIndex
es"> |
| 63 <div style="grid-column: -2; grid-row: -2"></div> |
| 64 <div style="grid-column: -3; grid-row: -3"></div> |
| 65 <div style="grid-column: -4; grid-row: -4"></div> |
| 66 <div style="grid-column: -5; grid-row: -5"></div> |
| 67 </div> |
| 68 |
| 49 <script> | 69 <script> |
| 50 description('Test that setting and getting grid-auto-columns and grid-auto-rows
works as expected'); | 70 description('Test that setting and getting grid-auto-columns and grid-auto-rows
works as expected'); |
| 51 | 71 |
| 52 debug("Test getting grid-auto-columns and grid-auto-rows set through CSS"); | 72 debug("Test getting grid-auto-columns and grid-auto-rows set through CSS"); |
| 53 testGridAutoDefinitionsValues(document.getElementById("gridAutoFixedFixed"), "30
px", "50px"); | 73 testGridAutoDefinitionsValues(document.getElementById("gridAutoFixedFixed"), "30
px", "50px"); |
| 54 testGridAutoDefinitionsValues(document.getElementById("gridAutoMinMax"), "minmax
(10%, 15px)", "minmax(30%, 100px)"); | 74 testGridAutoDefinitionsValues(document.getElementById("gridAutoMinMax"), "minmax
(10%, 15px)", "minmax(30%, 100px)"); |
| 55 testGridAutoDefinitionsValues(document.getElementById("gridAutoMinMaxContent"),
"min-content", "max-content"); | 75 testGridAutoDefinitionsValues(document.getElementById("gridAutoMinMaxContent"),
"min-content", "max-content"); |
| 56 testGridAutoDefinitionsValues(document.getElementById("gridAutoAutoInMinMax"), "
minmax(auto, 48px)", "minmax(80px, auto)"); | 76 testGridAutoDefinitionsValues(document.getElementById("gridAutoAutoInMinMax"), "
minmax(auto, 48px)", "minmax(80px, auto)"); |
| 57 | 77 |
| 58 debug(""); | 78 debug(""); |
| 59 debug("Test that getting grid-template-columns and grid-template-rows set throug
h CSS lists every track listed whether implicitly or explicitly created"); | 79 debug("Test that getting grid-template-columns and grid-template-rows set throug
h CSS lists every track listed whether implicitly or explicitly created"); |
| 60 testGridAutoDefinitionsValues(document.getElementById("gridAutoFixedFixedWithChi
ldren"), "30px", "50px"); | 80 testGridAutoDefinitionsValues(document.getElementById("gridAutoFixedFixedWithChi
ldren"), "30px", "50px"); |
| 61 testGridDefinitionsValues(document.getElementById("gridAutoFixedFixedWithChildre
n"), "50px", "30px"); | 81 testGridDefinitionsValues(document.getElementById("gridAutoFixedFixedWithChildre
n"), "50px", "30px"); |
| 62 testGridAutoDefinitionsValues(document.getElementById("gridAutoFixedFixedWithFix
edFixedWithChildren"), "30px", "40px"); | 82 testGridAutoDefinitionsValues(document.getElementById("gridAutoFixedFixedWithFix
edFixedWithChildren"), "30px", "40px"); |
| 63 testGridDefinitionsValues(document.getElementById("gridAutoFixedFixedWithFixedFi
xedWithChildren"), "20px 40px 40px", "15px 30px 30px"); | 83 testGridDefinitionsValues(document.getElementById("gridAutoFixedFixedWithFixedFi
xedWithChildren"), "20px 40px 40px", "15px 30px 30px"); |
| 84 testGridDefinitionsValues(document.getElementById("gridAutoMultipleTracks"), "25
px 50px 100px 25px", "10px 20px 30px 10px"); |
| 85 testGridDefinitionsValues(document.getElementById("gridAutoMultipleTracksNegativ
eIndexes"), "100px 25px 50px 100px", "30px 10px 20px 30px"); |
| 64 | 86 |
| 65 debug(""); | 87 debug(""); |
| 66 debug("Test that grid-template-* definitions are not affected by grid-auto-* def
initions"); | 88 debug("Test that grid-template-* definitions are not affected by grid-auto-* def
initions"); |
| 67 testGridDefinitionsValues(document.getElementById("gridAutoFixedFixed"), "none",
"none"); | 89 testGridDefinitionsValues(document.getElementById("gridAutoFixedFixed"), "none",
"none"); |
| 68 testGridDefinitionsValues(document.getElementById("gridAutoMinMax"), "none", "no
ne"); | 90 testGridDefinitionsValues(document.getElementById("gridAutoMinMax"), "none", "no
ne"); |
| 69 testGridDefinitionsValues(document.getElementById("gridAutoMinMaxContent"), "non
e", "none"); | 91 testGridDefinitionsValues(document.getElementById("gridAutoMinMaxContent"), "non
e", "none"); |
| 70 | 92 |
| 71 debug(""); | 93 debug(""); |
| 72 debug("Test the initial value"); | 94 debug("Test the initial value"); |
| 73 var element = document.createElement("div"); | 95 var element = document.createElement("div"); |
| 74 document.body.appendChild(element); | 96 document.body.appendChild(element); |
| 75 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-columns')",
"'auto'"); | 97 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-columns')",
"'auto'"); |
| 76 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-rows')", "'a
uto'"); | 98 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-rows')", "'a
uto'"); |
| 77 | 99 |
| 100 function testAutoValues(autoCols, autoRows, computedAutoCols, computedAutoRows)
{ |
| 101 element = document.createElement("div"); |
| 102 document.body.appendChild(element); |
| 103 element.style.fontSize = "10px"; |
| 104 element.style.gridAutoColumns = autoCols; |
| 105 element.style.gridAutoRows = autoRows; |
| 106 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid
-auto-columns')", computedAutoCols || autoCols); |
| 107 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid
-auto-rows')", computedAutoRows || autoRows); |
| 108 } |
| 109 |
| 78 debug(""); | 110 debug(""); |
| 79 debug("Test getting and setting grid-auto-columns and grid-auto-rows through JS"
); | 111 debug("Test getting and setting grid-auto-columns and grid-auto-rows through JS"
); |
| 80 element.style.font = "10px Ahem"; | 112 testAutoValues("18em", "66em", "180px", "660px"); |
| 81 element.style.gridAutoColumns = "18em"; | 113 testAutoValues("minmax(min-content, 8vh)", "minmax(10vw, min-content)", "minmax(
min-content, 48px)", "minmax(80px, min-content)"); |
| 82 element.style.gridAutoRows = "66em"; | 114 testAutoValues("minmax(min-content, max-content)", "minmax(max-content, min-cont
ent)"); |
| 83 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-columns')",
"'180px'"); | 115 testAutoValues("minmax(min-content, 10px) 48px 5%", "auto 30px minmax(10%, 60%)"
); |
| 84 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-rows')", "'6
60px'"); | |
| 85 | |
| 86 element = document.createElement("div"); | |
| 87 document.body.appendChild(element); | |
| 88 element.style.gridAutoColumns = "minmax(min-content, 8vh)"; | |
| 89 element.style.gridAutoRows = "minmax(10vw, min-content)"; | |
| 90 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-columns')",
"'minmax(min-content, 48px)'"); | |
| 91 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-rows')", "'m
inmax(80px, min-content)'"); | |
| 92 | |
| 93 element = document.createElement("div"); | |
| 94 document.body.appendChild(element); | |
| 95 element.style.gridAutoColumns = "minmax(min-content, max-content)"; | |
| 96 element.style.gridAutoRows = "minmax(max-content, min-content)"; | |
| 97 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-columns')",
"'minmax(min-content, max-content)'"); | |
| 98 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-rows')", "'m
inmax(max-content, min-content)'"); | |
| 99 | 116 |
| 100 debug(""); | 117 debug(""); |
| 101 debug("Test setting grid-auto-columns and grid-auto-rows to bad minmax value thr
ough JS"); | 118 debug("Test setting grid-auto-columns and grid-auto-rows to bad minmax value thr
ough JS"); |
| 102 element = document.createElement("div"); | 119 testAutoValues("minmax(10px 20px)", "minmax(10px)", "auto", "auto"); |
| 103 document.body.appendChild(element); | 120 testAutoValues("minmax(minmax(10px, 20px), 20px)", "minmax(10px, 20px, 30px)", "
auto", "auto"); |
| 104 // No comma. | 121 testAutoValues("minmax()", "minmax(30px 30% 30em)", "auto", "auto"); |
| 105 element.style.gridAutoColumns = "minmax(10px 20px)"; | 122 testAutoValues("none", "none", "auto", "auto"); |
| 106 // Only 1 argument provided. | 123 testAutoValues("10px [a] 20px", "[z] auto [y] min-content", "auto", "auto"); |
| 107 element.style.gridAutoRows = "minmax(10px)"; | 124 testAutoValues("repeat(2, 10px [a] 20px)", "[z] repeat(auto-fit, 100px)", "auto"
, "auto"); |
| 108 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-columns')",
"'auto'"); | |
| 109 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-rows')", "'a
uto'"); | |
| 110 | |
| 111 element = document.createElement("div"); | |
| 112 document.body.appendChild(element); | |
| 113 // Nested minmax. | |
| 114 element.style.gridAutoColumns = "minmax(minmax(10px, 20px), 20px)"; | |
| 115 // Only 2 arguments are allowed. | |
| 116 element.style.gridAutoRows = "minmax(10px, 20px, 30px)"; | |
| 117 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-columns')",
"'auto'"); | |
| 118 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-rows')", "'a
uto'"); | |
| 119 | |
| 120 element = document.createElement("div"); | |
| 121 document.body.appendChild(element); | |
| 122 // No breadth value. | |
| 123 element.style.gridAutoColumns = "minmax()"; | |
| 124 // No comma. | |
| 125 element.style.gridAutoRows = "minmax(30px 30% 30em)"; | |
| 126 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-columns')",
"'auto'"); | |
| 127 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-rows')", "'a
uto'"); | |
| 128 | |
| 129 element = document.createElement("div"); | |
| 130 document.body.appendChild(element); | |
| 131 // None is not allowed for grid-auto-{rows|columns}. | |
| 132 element.style.gridAutoColumns = "none"; | |
| 133 element.style.gridAutoRows = "none"; | |
| 134 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-columns')",
"'auto'"); | |
| 135 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-rows')", "'a
uto'"); | |
| 136 | 125 |
| 137 function testInherit() | 126 function testInherit() |
| 138 { | 127 { |
| 139 var parentElement = document.createElement("div"); | 128 var parentElement = document.createElement("div"); |
| 140 document.body.appendChild(parentElement); | 129 document.body.appendChild(parentElement); |
| 141 parentElement.style.gridAutoColumns = "50px"; | 130 parentElement.style.gridAutoColumns = "50px"; |
| 142 parentElement.style.gridAutoRows = "101%"; | 131 parentElement.style.gridAutoRows = "101%"; |
| 143 | 132 |
| 144 element = document.createElement("div"); | 133 element = document.createElement("div"); |
| 145 parentElement.appendChild(element); | 134 parentElement.appendChild(element); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 169 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-rows')",
"'auto'"); | 158 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-rows')",
"'auto'"); |
| 170 | 159 |
| 171 document.body.removeChild(element); | 160 document.body.removeChild(element); |
| 172 } | 161 } |
| 173 debug(""); | 162 debug(""); |
| 174 debug("Test setting grid-auto-columns and grid-auto-rows to 'initial' through JS
"); | 163 debug("Test setting grid-auto-columns and grid-auto-rows to 'initial' through JS
"); |
| 175 testInitial(); | 164 testInitial(); |
| 176 </script> | 165 </script> |
| 177 </body> | 166 </body> |
| 178 </html> | 167 </html> |
| OLD | NEW |