90 lines
5.6 KiB
HTML
90 lines
5.6 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<link href="resources/grid.css" rel="stylesheet">
|
|
<link href="resources/grid-alignment.css" rel="stylesheet">
|
|
<style>
|
|
.grid {
|
|
grid-template-rows: 20px;
|
|
grid-template-columns: 10px;
|
|
grid-auto-rows: 30px;
|
|
grid-auto-columns: 50px;
|
|
font: 10px/1 Ahem;
|
|
}
|
|
</style>
|
|
</head>
|
|
<script src="../../resources/check-layout.js"></script>
|
|
<script>
|
|
function updateAndCheck(gridElementID, defaultSizing, gridItemSize)
|
|
{
|
|
var gridElement = document.getElementById(gridElementID);
|
|
gridElement.style.gridAutoRows = defaultSizing.rows;
|
|
gridElement.style.gridAutoColumns = defaultSizing.columns;
|
|
|
|
var gridItem = gridElement.firstChild.nextSibling;
|
|
gridItem.setAttribute("data-expected-width", gridItemSize.width);
|
|
gridItem.setAttribute("data-expected-height", gridItemSize.height);
|
|
|
|
checkLayout("#" + gridElementID);
|
|
}
|
|
|
|
function updateGridAutoRowsColumns()
|
|
{
|
|
checkLayout('.grid');
|
|
|
|
// The constrained example is always sized to the min width so we don't test max width.
|
|
updateAndCheck("constrainedGrid", { 'rows': 'minmax(20em, 15px)', 'columns': '50px' }, { 'width': '50px', 'height': '200px' });
|
|
updateAndCheck("constrainedGrid", { 'rows': 'minmax(20em, 15px)', 'columns': 'minmax(10%, 100px)' }, { 'width': '1px', 'height': '200px' });
|
|
updateAndCheck("constrainedGrid", { 'rows': 'minmax(min-content, 15px)', 'columns': 'minmax(10%, 100px)' }, { 'width': '1px', 'height': '20px' });
|
|
updateAndCheck("constrainedGrid", { 'rows': 'minmax(min-content, 15px)', 'columns': 'minmax(max-content, 100px)' }, { 'width': '120px', 'height': '10px' });
|
|
updateAndCheck("constrainedGrid", { 'rows': 'minmax(40em, 15px)', 'columns': 'minmax(max-content, 100px)' }, { 'width': '120px', 'height': '400px' });
|
|
updateAndCheck("constrainedGrid", { 'rows': 'minmax(40em, 15px)', 'columns': 'minmax(10%, 100px)' }, { 'width': '1px', 'height': '400px' });
|
|
updateAndCheck("constrainedGrid", { 'rows': 'minmax(40em, 15px)', 'columns': 'auto' }, { 'width': '60px', 'height': '400px' });
|
|
updateAndCheck("constrainedGrid", { 'rows': 'auto', 'columns': 'auto' }, { 'width': '60px', 'height': '20px' });
|
|
|
|
updateAndCheck("unconstrainedGrid", { 'rows': 'minmax(20em, 15px)', 'columns': '50px' }, { 'width': '50px', 'height': '200px' });
|
|
updateAndCheck("unconstrainedGrid", { 'rows': 'minmax(20em, 15px)', 'columns': 'minmax(10%, 100px)' }, { 'width': '100px', 'height': '200px' });
|
|
updateAndCheck("unconstrainedGrid", { 'rows': 'minmax(min-content, 15px)', 'columns': 'minmax(10%, 100px)' }, { 'width': '100px', 'height': '20px' });
|
|
updateAndCheck("unconstrainedGrid", { 'rows': 'minmax(min-content, 15px)', 'columns': 'minmax(10%, max-content)' }, { 'width': '120px', 'height': '15px' });
|
|
updateAndCheck("unconstrainedGrid", { 'rows': 'minmax(min-content, 15px)', 'columns': 'minmax(10%, max-content)' }, { 'width': '120px', 'height': '15px' });
|
|
updateAndCheck("unconstrainedGrid", { 'rows': 'auto', 'columns': 'minmax(10em, max-content)' }, { 'width': '120px', 'height': '10px' });
|
|
updateAndCheck("unconstrainedGrid", { 'rows': 'auto', 'columns': 'minmax(20em, max-content)' }, { 'width': '200px', 'height': '10px' });
|
|
updateAndCheck("unconstrainedGrid", { 'rows': 'auto', 'columns': 'auto' }, { 'width': '120px', 'height': '10px' });
|
|
|
|
updateAndCheck("constrainedGridUndefinedHeight", { 'rows': 'minmax(20em, 15px)', 'columns': '50px' }, { 'width': '50px', 'height': '200px' });
|
|
updateAndCheck("constrainedGridUndefinedHeight", { 'rows': 'minmax(20em, 15px)', 'columns': 'minmax(10%, 100px)' }, { 'width': '1px', 'height': '200px' });
|
|
updateAndCheck("constrainedGridUndefinedHeight", { 'rows': 'minmax(min-content, 15px)', 'columns': 'minmax(10%, 100px)' }, { 'width': '1px', 'height': '20px' });
|
|
updateAndCheck("constrainedGridUndefinedHeight", { 'rows': 'minmax(min-content, 15px)', 'columns': 'minmax(max-content, 100px)' }, { 'width': '120px', 'height': '15px' });
|
|
updateAndCheck("constrainedGridUndefinedHeight", { 'rows': 'minmax(40em, 15px)', 'columns': 'minmax(max-content, 100px)' }, { 'width': '120px', 'height': '400px' });
|
|
updateAndCheck("constrainedGridUndefinedHeight", { 'rows': 'minmax(40em, 15px)', 'columns': 'minmax(10%, 100px)' }, { 'width': '1px', 'height': '400px' });
|
|
updateAndCheck("constrainedGridUndefinedHeight", { 'rows': 'minmax(40em, 15px)', 'columns': 'auto' }, { 'width': '60px', 'height': '400px' });
|
|
updateAndCheck("constrainedGridUndefinedHeight", { 'rows': 'auto', 'columns': 'auto' }, { 'width': '60px', 'height': '20px' });
|
|
}
|
|
|
|
window.addEventListener("load", updateGridAutoRowsColumns, false);
|
|
</script>
|
|
<body>
|
|
|
|
<div>This test checks that grid-auto-{row|column} updates properly recomputes the grid items' sizes.</div>
|
|
|
|
<div class="constrainedContainer" style="position: relative">
|
|
<div class="grid" id="constrainedGrid" style="height: 100%; width: 100%;">
|
|
<div class="sizedToGridArea secondRowSecondColumn" data-offset-x="10" data-offset-y="20" data-expected-width="50" data-expected-height="30">XXXXX XXXXXX</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="unconstrainedContainer" style="position: relative">
|
|
<div class="grid justifyContentStart" id="unconstrainedGrid">
|
|
<div class="sizedToGridArea secondRowSecondColumn" data-offset-x="10" data-offset-y="20" data-expected-width="50" data-expected-height="30">XXXXX XXXXXX</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="constrainedContainer" style="position: relative;">
|
|
<div class="grid" id="constrainedGridUndefinedHeight" style="width: 100%;">
|
|
<div class="sizedToGridArea secondRowSecondColumn" data-offset-x="10" data-offset-y="20" data-expected-width="50" data-expected-height="30">XXXXX XXXXXX</div>
|
|
</div>
|
|
</div>
|
|
|
|
</body>
|
|
</html>
|