blob: 8aab95c16a4ea2c31b2b2502417f84e5119698dd [file] [log] [blame]
<!DOCTYPE html>
<html>
<link href="resources/grid.css" rel="stylesheet">
<script src="../../resources/check-layout.js"></script>
<style>
.grid {
grid-template-columns: 50px 100px;
grid-template-rows: 50px 100px;
}
</style>
<script>
function testGrid(flow, positionAndSize)
{
var gridElement = document.getElementsByClassName("grid")[0];
gridElement.style.gridAutoFlow = flow;
var gridItem = document.getElementById("autoItem");
gridItem.setAttribute("data-offset-x", positionAndSize.offsetX);
gridItem.setAttribute("data-offset-y", positionAndSize.offsetY);
gridItem.setAttribute("data-expected-width", positionAndSize.width);
gridItem.setAttribute("data-expected-height", positionAndSize.height);
checkLayout(".grid");
}
function updateAutoFlow()
{
checkLayout(".grid");
testGrid("column", { 'offsetX': '0', 'offsetY': '50', 'width': '50', 'height': '100' });
testGrid("dense", { 'offsetX': '50', 'offsetY': '0', 'width': '100', 'height': '50' });
testGrid("", { 'offsetX': '50', 'offsetY': '0', 'width': '100', 'height': '50' });
testGrid("invalid", { 'offsetX': '50', 'offsetY': '0', 'width': '100', 'height': '50' });
testGrid("none", { 'offsetX': '50', 'offsetY': '0', 'width': '100', 'height': '50' });
}
window.addEventListener("load", updateAutoFlow, false);
</script>
<body>
<div>This test checks that updating the grid's element's grid-auto-flow property recomputes the grid.</div>
<div style="position: relative">
<div class="grid">
<div class="sizedToGridArea autoRowAutoColumn" id="autoItem" data-offset-x="50" data-offset-y="0" data-expected-width="100" data-expected-height="50"></div>
<div class="sizedToGridArea firstRowFirstColumn" data-offset-x="0" data-offset-y="0" data-expected-width="50" data-expected-height="50"></div>
</div>
</div>
</body>
</html>