blob: 241541218b8eba0747d6c9d933f81e614289b7a0 [file] [log] [blame]
<!DOCTYPE html>
<html>
<link href="resources/grid.css" rel="stylesheet">
<link href="resources/grid-alignment.css" rel="stylesheet">
<style>
.grid {
grid-template-columns: 50px 100px;
grid-template-rows: 50px 100px;
}
</style>
<script src="../../resources/check-layout.js"></script>
<script>
function testRemoval(gridElementID, autoFlowElementID, size)
{
var gridElement = document.getElementById(gridElementID);
var autoFlowElement = document.getElementById(autoFlowElementID);
// Remove the white space and the first grid item.
gridElement.removeChild(gridElement.firstChild);
gridElement.removeChild(gridElement.firstChild);
autoFlowElement.setAttribute("data-expected-width", size.width);
autoFlowElement.setAttribute("data-expected-height", size.height);
checkLayout("#" + gridElementID, document.getElementById("test-output"));
}
function testRemovals()
{
var testOutput = document.getElementById("test-output");
checkLayout("#autoFlowColumnElement", testOutput);
testRemoval("gridAutoFlowColumnDense", "autoFlowColumnElement", { 'width': '100', 'height': '100' });
testRemoval("gridAutoFlowColumnDense", "autoFlowColumnElement", { 'width': '100', 'height': '50' });
testRemoval("gridAutoFlowColumnDense", "autoFlowColumnElement", { 'width': '50', 'height': '100' });
testRemoval("gridAutoFlowColumnDense", "autoFlowColumnElement", { 'width': '50', 'height': '50' });
checkLayout("#autoFlowRowElement", testOutput);
testRemoval("gridAutoFlowRowDense", "autoFlowRowElement", { 'width': '100', 'height': '100' });
testRemoval("gridAutoFlowRowDense", "autoFlowRowElement", { 'width': '100', 'height': '50' });
testRemoval("gridAutoFlowRowDense", "autoFlowRowElement", { 'width': '50', 'height': '50' });
testRemoval("gridAutoFlowRowDense", "autoFlowRowElement", { 'width': '50', 'height': '50' });
checkLayout("#gridAutoFlowColumnWithAutoItems", testOutput);
testRemoval("gridAutoFlowColumnWithAutoItems", "autoFlowRowElementWithAutoItems", { 'width': '100', 'height': '100' });
testRemoval("gridAutoFlowColumnWithAutoItems", "autoFlowRowElementWithAutoItems", { 'width': '100', 'height': '50' });
testRemoval("gridAutoFlowColumnWithAutoItems", "autoFlowRowElementWithAutoItems", { 'width': '50', 'height': '100' });
testRemoval("gridAutoFlowColumnWithAutoItems", "autoFlowRowElementWithAutoItems", { 'width': '50', 'height': '50' });
checkLayout("#gridAutoFlowRowWithAutoAndFixedItems", testOutput);
testRemoval("gridAutoFlowRowWithAutoAndFixedItems", "autoFlowRowElementWithAutoAndFixedItems", { 'width': '100', 'height': '100' });
testRemoval("gridAutoFlowRowWithAutoAndFixedItems", "autoFlowRowElementWithAutoAndFixedItems", { 'width': '100', 'height': '50' });
testRemoval("gridAutoFlowRowWithAutoAndFixedItems", "autoFlowRowElementWithAutoAndFixedItems", { 'width': '100', 'height': '50' });
testRemoval("gridAutoFlowRowWithAutoAndFixedItems", "autoFlowRowElementWithAutoAndFixedItems", { 'width': '50', 'height': '50' });
}
window.addEventListener("load", testRemovals, false);
</script>
<body>
<p>This test checks that the tracks' auto positions are recomputed after removing a grid item.</p>
<div class="unconstrainedContainer">
<div class="grid gridAutoFlowColumnDense justifyContentStart" id="gridAutoFlowColumnDense">
<div class="sizedToGridArea secondRowSecondColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea firstRowSecondColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea secondRowFirstColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea firstRowFirstColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea autoRowAutoColumn" id="autoFlowColumnElement" data-expected-width="170" data-expected-height="50">XXXXX XXXXX XXXXX</div>
</div>
</div>
<div class="unconstrainedContainer">
<div class="grid gridAutoFlowRowDense" id="gridAutoFlowRowDense">
<div class="sizedToGridArea secondRowSecondColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea firstRowSecondColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea firstRowFirstColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea secondRowFirstColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea autoRowAutoColumn" id="autoFlowRowElement" data-expected-width="50" data-expected-height="30">XXXXX XXXXX XXXXX</div>
</div>
</div>
<div class="unconstrainedContainer">
<div class="grid gridAutoFlowColumnDense" id="gridAutoFlowColumnWithAutoItems">
<div class="sizedToGridArea autoRowFirstColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea autoRowSecondColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea secondRowAutoColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea firstRowAutoColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea autoRowAutoColumn" id="autoFlowRowElementWithAutoItems" data-expected-width="100" data-expected-height="100">XXXXX XXXXX XXXXX</div>
</div>
</div>
<div class="unconstrainedContainer">
<div class="grid gridAutoFlowRowDense" id="gridAutoFlowRowWithAutoAndFixedItems">
<div class="sizedToGridArea autoRowFirstColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea firstRowSecondColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea secondRowAutoColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea firstRowAutoColumn">XXXXX XXXXX XXXXX</div>
<div class="sizedToGridArea autoRowAutoColumn" id="autoFlowRowElementWithAutoAndFixedItems" data-expected-width="100" data-expected-height="100">XXXXX XXXXX XXXXX</div>
</div>
</div>
<div id="test-output"></div>
</body>
</html>