3 <link href=
"resources/grid.css" rel=
"stylesheet">
4 <script src=
"../../resources/check-layout.js"></script>
7 grid-auto-flow: row dense;
25 function testGridDefinitions(gridTemplateRows
, gridTemplateColumns
, firstGridItemData
, secondGridItemData
, thirdGridItemData
)
27 var gridElement
= document
.getElementsByClassName("grid")[0];
28 gridElement
.style
.gridTemplateRows
= gridTemplateRows
;
29 gridElement
.style
.gridTemplateColumns
= gridTemplateColumns
;
31 var firstGridItem
= document
.getElementById("firstGridItem");
32 firstGridItem
.setAttribute("data-expected-width", firstGridItemData
.width
);
33 firstGridItem
.setAttribute("data-expected-height", firstGridItemData
.height
);
34 firstGridItem
.setAttribute("data-offset-x", firstGridItemData
.x
);
35 firstGridItem
.setAttribute("data-offset-y", firstGridItemData
.y
);
37 var secondGridItem
= document
.getElementById("secondGridItem");
38 secondGridItem
.setAttribute("data-expected-width", secondGridItemData
.width
);
39 secondGridItem
.setAttribute("data-expected-height", secondGridItemData
.height
);
40 secondGridItem
.setAttribute("data-offset-x", secondGridItemData
.x
);
41 secondGridItem
.setAttribute("data-offset-y", secondGridItemData
.y
);
43 var thirdGridItem
= document
.getElementById("thirdGridItem");
44 thirdGridItem
.setAttribute("data-expected-width", thirdGridItemData
.width
);
45 thirdGridItem
.setAttribute("data-expected-height", thirdGridItemData
.height
);
46 thirdGridItem
.setAttribute("data-offset-x", thirdGridItemData
.x
);
47 thirdGridItem
.setAttribute("data-offset-y", thirdGridItemData
.y
);
52 function testChangingGridDefinitions()
54 testGridDefinitions('10px 20px', '10px', { 'width': '10', 'height': '20', 'x': '0', 'y': '10' }, { 'width': '10', 'height': '10', 'x': '0', 'y': '0' }, { 'width': '10', 'height': '0', 'x': '0', 'y': '30' });
55 testGridDefinitions('50px', '30px 40px', { 'width': '30', 'height': '0', 'x': '0', 'y': '50' }, { 'width': '30', 'height': '50', 'x': '0', 'y': '0' }, { 'width': '40', 'height': '50', 'x': '30', 'y': '0' });
56 testGridDefinitions('50px', '60px', { 'width': '60', 'height': '0', 'x': '0', 'y': '50' }, { 'width': '60', 'height': '50', 'x': '0', 'y': '0' }, { 'width': '60', 'height': '0', 'x': '0', 'y': '50' });
57 testGridDefinitions('50px 100px 150px', '60px', { 'width': '60', 'height': '100', 'x': '0', 'y': '50' }, { 'width': '60', 'height': '50', 'x': '0', 'y': '0' }, { 'width': '60', 'height': '150', 'x': '0', 'y': '150' });
60 window
.addEventListener("load", testChangingGridDefinitions
, false);
63 <div>This test checks that grid-template-{rows|columns} dynamic updates recomputes the positions of automatically placed grid items.
</div>
65 <div style=
"position: relative">
67 <div class=
"sizedToGridArea" id=
"firstGridItem"></div>
68 <div class=
"sizedToGridArea" id=
"secondGridItem"></div>
69 <div class=
"sizedToGridArea" id=
"thirdGridItem"></div>