3 <link href=
"resources/grid.css" rel=
"stylesheet">
4 <script src=
"../../resources/check-layout.js"></script>
8 grid-template-rows:
50px
100px;
9 grid-template-columns:
40px;
28 function testGridItemsOrder(firstGridItemData
, secondGridItemData
, thirdGridItemData
)
30 var firstGridItem
= document
.getElementById("firstGridItem");
31 firstGridItem
.style
.order
= firstGridItemData
.order
;
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
.style
.order
= secondGridItemData
.order
;
39 secondGridItem
.setAttribute("data-expected-width", secondGridItemData
.width
);
40 secondGridItem
.setAttribute("data-expected-height", secondGridItemData
.height
);
41 secondGridItem
.setAttribute("data-offset-x", secondGridItemData
.x
);
42 secondGridItem
.setAttribute("data-offset-y", secondGridItemData
.y
);
44 var thirdGridItem
= document
.getElementById("thirdGridItem");
45 thirdGridItem
.style
.order
= thirdGridItemData
.order
;
46 thirdGridItem
.setAttribute("data-expected-width", thirdGridItemData
.width
);
47 thirdGridItem
.setAttribute("data-expected-height", thirdGridItemData
.height
);
48 thirdGridItem
.setAttribute("data-offset-x", thirdGridItemData
.x
);
49 thirdGridItem
.setAttribute("data-offset-y", thirdGridItemData
.y
);
54 function testChangingGridItemsOrder()
56 testGridItemsOrder({ 'order': '0', 'width': '40', 'height': '100', 'x': '0', 'y': '50' }, { 'order': '0', 'width': '40', 'height': '50', 'x': '0', 'y': '0' }, { 'order': '0', 'width': '40', 'height': '0', 'x': '0', 'y': '150' });
57 testGridItemsOrder({ 'order': '0', 'width': '40', 'height': '100', 'x': '0', 'y': '50' }, { 'order': '-1', 'width': '40', 'height': '50', 'x': '0', 'y': '0' }, { 'order': '0', 'width': '40', 'height': '0', 'x': '0', 'y': '150' });
58 testGridItemsOrder({ 'order': '1', 'width': '40', 'height': '0', 'x': '0', 'y': '150' }, { 'order': '-1', 'width': '40', 'height': '50', 'x': '0', 'y': '0' }, { 'order': '0', 'width': '40', 'height': '100', 'x': '0', 'y': '50' });
59 testGridItemsOrder({ 'order': '1', 'width': '40', 'height': '100', 'x': '0', 'y': '50' }, { 'order': '-1', 'width': '40', 'height': '50', 'x': '0', 'y': '0' }, { 'order': '10', 'width': '40', 'height': '0', 'x': '0', 'y': '150' });
62 window
.addEventListener("load", testChangingGridItemsOrder
, false);
65 <div>This test checks that grid items' 'order' dynamic updates recomputes the positions of automatically placed grid items.
</div>
67 <div style=
"position: relative">
69 <div class=
"sizedToGridArea" id=
"firstGridItem"></div>
70 <div class=
"sizedToGridArea" id=
"secondGridItem"></div>
71 <div class=
"sizedToGridArea" id=
"thirdGridItem"></div>