| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <html> | 2 <html> |
| 3 <link href="resources/grid.css" rel="stylesheet"> | 3 <link href="resources/grid.css" rel="stylesheet"> |
| 4 <style> | 4 <style> |
| 5 .grid { | 5 .grid { |
| 6 grid-template-columns: 50px 100px; | 6 grid-template-columns: 50px 100px; |
| 7 grid-template-rows: 70px 140px; | 7 grid-template-rows: 70px 140px; |
| 8 } | 8 } |
| 9 | 9 |
| 10 #minHeightPercent { | 10 #minHeightPercent { |
| 11 height: 10px; | 11 height: 10px; |
| 12 min-height: 50%; | 12 min-height: 50%; |
| 13 } | 13 } |
| 14 | 14 |
| 15 #maxHeightPercent { | 15 #maxHeightPercent { |
| 16 height: 100px; | 16 height: 100px; |
| 17 max-height: 50%; | 17 max-height: 50%; |
| 18 } | 18 } |
| 19 </style> | 19 </style> |
| 20 <script src="../../resources/check-layout.js"></script> | 20 <script src="../../resources/check-layout.js"></script> |
| 21 <script> | 21 <script> |
| 22 function testLayout(gridElementID, gridTracks, size) | 22 function testLayout(gridElementID, gridTracks, size) |
| 23 { | 23 { |
| 24 var gridElement = document.getElementById(gridElementID); | 24 var gridElement = document.getElementById(gridElementID); |
| 25 gridElement.style.gridTemplateRows = gridTracks.rows; | 25 gridElement.style.gridTemplateRows = gridTracks.rows; |
| 26 var gridItem = gridElement.firstChild.nextSibling; | 26 var gridItem = gridElement.firstChild.nextSibling; |
| 27 gridItem.setAttribute("data-expected-width", size.width); | 27 gridItem.setAttribute("data-expected-width", size.width); |
| 28 gridItem.setAttribute("data-expected-height", size.height); | 28 gridItem.setAttribute("data-expected-height", size.height); |
| 29 checkLayout("#" + gridElementID) | 29 checkLayout("#" + gridElementID, document.getElementById("test-output")) |
| 30 } | 30 } |
| 31 | 31 |
| 32 function runTests() | 32 function runTests() |
| 33 { | 33 { |
| 34 testLayout("gridWithMinHeightItem", { "rows": "70px 140px" }, { "width": "50
px", "height": "35px" }); | 34 testLayout("gridWithMinHeightItem", { "rows": "70px 140px" }, { "width": "50
px", "height": "35px" }); |
| 35 testLayout("gridWithMinHeightItem", { "rows": "100px 140px" }, { "width": "5
0px", "height": "50px" }); | 35 testLayout("gridWithMinHeightItem", { "rows": "100px 140px" }, { "width": "5
0px", "height": "50px" }); |
| 36 testLayout("gridWithMinHeightItem", { "rows": "100px 240px" }, { "width": "5
0px", "height": "50px" }); | 36 testLayout("gridWithMinHeightItem", { "rows": "100px 240px" }, { "width": "5
0px", "height": "50px" }); |
| 37 testLayout("gridWithMinHeightItem", { "rows": "10px 240px" }, { "width": "50
px", "height": "10px" }); | 37 testLayout("gridWithMinHeightItem", { "rows": "10px 240px" }, { "width": "50
px", "height": "10px" }); |
| 38 | 38 |
| 39 testLayout("gridWithMaxHeightItem", { "rows": "70px 140px" }, { "width": "50
px", "height": "35px" }); | 39 testLayout("gridWithMaxHeightItem", { "rows": "70px 140px" }, { "width": "50
px", "height": "35px" }); |
| 40 testLayout("gridWithMaxHeightItem", { "rows": "100px 140px" }, { "width": "5
0px", "height": "50px" }); | 40 testLayout("gridWithMaxHeightItem", { "rows": "100px 140px" }, { "width": "5
0px", "height": "50px" }); |
| 41 testLayout("gridWithMaxHeightItem", { "rows": "100px 240px" }, { "width": "5
0px", "height": "50px" }); | 41 testLayout("gridWithMaxHeightItem", { "rows": "100px 240px" }, { "width": "5
0px", "height": "50px" }); |
| 42 testLayout("gridWithMaxHeightItem", { "rows": "1000px 240px" }, { "width": "
50px", "height": "100px" }); | 42 testLayout("gridWithMaxHeightItem", { "rows": "1000px 240px" }, { "width": "
50px", "height": "100px" }); |
| 43 } | 43 } |
| 44 | 44 |
| 45 window.addEventListener("load", runTests, false); | 45 window.addEventListener("load", runTests, false); |
| 46 </script> | 46 </script> |
| 47 <body> | 47 <body> |
| 48 | 48 |
| 49 <p>Test that grid items with a percentage logical min-height or max-height resol
ve their size properly.</p> | 49 <p>Test that grid items with a percentage logical min-height or max-height resol
ve their size properly.</p> |
| 50 | 50 |
| 51 <div id="gridWithMinHeightItem" class="grid"> | 51 <div id="gridWithMinHeightItem" class="grid"> |
| 52 <div id="minHeightPercent"></div> | 52 <div id="minHeightPercent"></div> |
| 53 </div> | 53 </div> |
| 54 | 54 |
| 55 <div id="gridWithMaxHeightItem" class="grid"> | 55 <div id="gridWithMaxHeightItem" class="grid"> |
| 56 <div id="maxHeightPercent"></div> | 56 <div id="maxHeightPercent"></div> |
| 57 </div> | 57 </div> |
| 58 | 58 |
| 59 <div id="test-output"></div> |
| 60 |
| 59 </body> | 61 </body> |
| 60 </html> | 62 </html> |
| OLD | NEW |