5 testRunner.overridePreference("WebKitCSSGridLayoutEnabled", 1);
7 <link href="resources/grid.css" rel="stylesheet">
10 grid-template-columns: 50px 100px;
11 grid-template-rows: 50px 100px;
14 <script src="../../resources/check-layout.js"></script>
16 function testRemoval(gridElementID, autoFlowElementID, size)
18 var gridElement = document.getElementById(gridElementID);
19 var autoFlowElement = document.getElementById(autoFlowElementID);
21 // Remove the white space and the first grid item.
22 gridElement.removeChild(gridElement.firstChild);
23 gridElement.removeChild(gridElement.firstChild);
25 autoFlowElement.setAttribute("data-expected-width", size.width);
26 autoFlowElement.setAttribute("data-expected-height", size.height);
27 checkLayout("#" + gridElementID);
30 function testRemovals()
32 checkLayout("#autoFlowColumnElement");
33 testRemoval("gridAutoFlowColumn", "autoFlowColumnElement", { 'width': '100', 'height': '100' });
34 testRemoval("gridAutoFlowColumn", "autoFlowColumnElement", { 'width': '100', 'height': '50' });
35 testRemoval("gridAutoFlowColumn", "autoFlowColumnElement", { 'width': '50', 'height': '100' });
36 testRemoval("gridAutoFlowColumn", "autoFlowColumnElement", { 'width': '50', 'height': '50' });
38 checkLayout("#autoFlowRowElement");
39 testRemoval("gridAutoFlowRow", "autoFlowRowElement", { 'width': '100', 'height': '100' });
40 testRemoval("gridAutoFlowRow", "autoFlowRowElement", { 'width': '100', 'height': '50' });
41 testRemoval("gridAutoFlowRow", "autoFlowRowElement", { 'width': '50', 'height': '50' });
42 testRemoval("gridAutoFlowRow", "autoFlowRowElement", { 'width': '50', 'height': '50' });
44 checkLayout("#gridAutoFlowColumnWithAutoItems");
45 testRemoval("gridAutoFlowColumnWithAutoItems", "autoFlowRowElementWithAutoItems", { 'width': '100', 'height': '100' });
46 testRemoval("gridAutoFlowColumnWithAutoItems", "autoFlowRowElementWithAutoItems", { 'width': '100', 'height': '50' });
47 testRemoval("gridAutoFlowColumnWithAutoItems", "autoFlowRowElementWithAutoItems", { 'width': '50', 'height': '100' });
48 testRemoval("gridAutoFlowColumnWithAutoItems", "autoFlowRowElementWithAutoItems", { 'width': '50', 'height': '50' });
50 checkLayout("#gridAutoFlowRowWithAutoAndFixedItems");
51 testRemoval("gridAutoFlowRowWithAutoAndFixedItems", "autoFlowRowElementWithAutoAndFixedItems", { 'width': '100', 'height': '100' });
52 testRemoval("gridAutoFlowRowWithAutoAndFixedItems", "autoFlowRowElementWithAutoAndFixedItems", { 'width': '100', 'height': '50' });
53 testRemoval("gridAutoFlowRowWithAutoAndFixedItems", "autoFlowRowElementWithAutoAndFixedItems", { 'width': '100', 'height': '50' });
54 testRemoval("gridAutoFlowRowWithAutoAndFixedItems", "autoFlowRowElementWithAutoAndFixedItems", { 'width': '50', 'height': '50' });
56 window.addEventListener("load", testRemovals, false);
60 <p>This test checks that the tracks' auto positions are recomputed after removing a grid item.</p>
62 <div class="unconstrainedContainer">
63 <div class="grid gridAutoFlowColumn" id="gridAutoFlowColumn">
64 <div class="sizedToGridArea secondRowSecondColumn">XXXXX XXXXX XXXXX</div>
65 <div class="sizedToGridArea firstRowSecondColumn">XXXXX XXXXX XXXXX</div>
66 <div class="sizedToGridArea secondRowFirstColumn">XXXXX XXXXX XXXXX</div>
67 <div class="sizedToGridArea firstRowFirstColumn">XXXXX XXXXX XXXXX</div>
68 <div class="sizedToGridArea autoRowAutoColumn" id="autoFlowColumnElement" data-expected-width="170" data-expected-height="50">XXXXX XXXXX XXXXX</div>
72 <div class="unconstrainedContainer">
73 <div class="grid gridAutoFlowRow" id="gridAutoFlowRow">
74 <div class="sizedToGridArea secondRowSecondColumn">XXXXX XXXXX XXXXX</div>
75 <div class="sizedToGridArea firstRowSecondColumn">XXXXX XXXXX XXXXX</div>
76 <div class="sizedToGridArea firstRowFirstColumn">XXXXX XXXXX XXXXX</div>
77 <div class="sizedToGridArea secondRowFirstColumn">XXXXX XXXXX XXXXX</div>
78 <div class="sizedToGridArea autoRowAutoColumn" id="autoFlowRowElement" data-expected-width="50" data-expected-height="30">XXXXX XXXXX XXXXX</div>
82 <div class="unconstrainedContainer">
83 <div class="grid gridAutoFlowColumn" id="gridAutoFlowColumnWithAutoItems">
84 <div class="sizedToGridArea autoRowFirstColumn">XXXXX XXXXX XXXXX</div>
85 <div class="sizedToGridArea autoRowSecondColumn">XXXXX XXXXX XXXXX</div>
86 <div class="sizedToGridArea secondRowAutoColumn">XXXXX XXXXX XXXXX</div>
87 <div class="sizedToGridArea firstRowAutoColumn">XXXXX XXXXX XXXXX</div>
88 <div class="sizedToGridArea autoRowAutoColumn" id="autoFlowRowElementWithAutoItems" data-expected-width="100" data-expected-height="100">XXXXX XXXXX XXXXX</div>
92 <div class="unconstrainedContainer">
93 <div class="grid gridAutoFlowRow" id="gridAutoFlowRowWithAutoAndFixedItems">
94 <div class="sizedToGridArea autoRowFirstColumn">XXXXX XXXXX XXXXX</div>
95 <div class="sizedToGridArea firstRowSecondColumn">XXXXX XXXXX XXXXX</div>
96 <div class="sizedToGridArea secondRowAutoColumn">XXXXX XXXXX XXXXX</div>
97 <div class="sizedToGridArea firstRowAutoColumn">XXXXX XXXXX XXXXX</div>
98 <div class="sizedToGridArea autoRowAutoColumn" id="autoFlowRowElementWithAutoAndFixedItems" data-expected-width="100" data-expected-height="100">XXXXX XXXXX XXXXX</div>