1<!DOCTYPE html>
2<html>
3<head>
4<script>
5if (window.testRunner)
6 testRunner.overridePreference("WebKitCSSGridLayoutEnabled", 1);
7</script>
8<style>
9.gridItemWithColumnSpan {
10 -webkit-grid-column: 1;
11 -webkit-grid-column-span: 5;
12}
13
14.gridItemWithRowSpan {
15 -webkit-grid-row: 2;
16 -webkit-grid-row-span: 3;
17}
18
19.gridItemWithColumnRowSpan {
20 -webkit-grid-column: 5;
21 -webkit-grid-row: 7;
22 -webkit-grid-column-span: 10;
23 -webkit-grid-row-span: 3;
24}
25
26.gridItemWithMultipleValuesForSpan {
27 -webkit-grid-column-span: 1 2 3;
28}
29</style>
30<script src="../js/resources/js-test-pre.js"></script>
31</head>
32<body>
33<!-- The first has no properties set on it. -->
34<div id="gridElement"></div>
35<div class="gridItemWithColumnSpan" id="gridItemWithColumnSpan"></div>
36<div class="gridItemWithRowSpan" id="gridItemWithRowSpan"></div>
37<div class="gridItemWithColumnRowSpan" id="gridItemWithColumnRowSpan"></div>
38<div class="gridItemWithMultipleValuesForSpan" id="gridItemWithMultipleValuesForSpan"></div>
39<script>
40 description('Test that setting and getting -webkit-grid-column-span and -webkit-grid-row-span works as expected');
41
42 debug("Test getting -webkit-grid-column-span and -webkit-grid-row-span set through CSS");
43 var gridElement = document.getElementById("gridElement");
44 shouldBe("getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-column-span')", "'1'");
45 shouldBe("getComputedStyle(gridElement, '').getPropertyValue('-webkit-grid-row-span')", "'1'");
46
47 var gridItemWithPositiveInteger = document.getElementById("gridItemWithColumnSpan");
48 shouldBe("getComputedStyle(gridItemWithColumnSpan, '').getPropertyValue('-webkit-grid-column')", "'1'");
49 shouldBe("getComputedStyle(gridItemWithColumnSpan, '').getPropertyValue('-webkit-grid-column-span')", "'5'");
50
51 var gridItemWithPositiveInteger = document.getElementById("gridItemWithRowSpan");
52 shouldBe("getComputedStyle(gridItemWithRowSpan, '').getPropertyValue('-webkit-grid-row')", "'2'");
53 shouldBe("getComputedStyle(gridItemWithRowSpan, '').getPropertyValue('-webkit-grid-row-span')", "'3'");
54
55 var gridItemWithPositiveInteger = document.getElementById("gridItemWithColumnRowSpan");
56 shouldBe("getComputedStyle(gridItemWithColumnRowSpan, '').getPropertyValue('-webkit-grid-row')", "'7'");
57 shouldBe("getComputedStyle(gridItemWithColumnRowSpan, '').getPropertyValue('-webkit-grid-column')", "'5'");
58 shouldBe("getComputedStyle(gridItemWithColumnRowSpan, '').getPropertyValue('-webkit-grid-row-span')", "'3'");
59 shouldBe("getComputedStyle(gridItemWithColumnRowSpan, '').getPropertyValue('-webkit-grid-column-span')", "'10'");
60
61 var gridItemWithPositiveInteger = document.getElementById("gridItemWithMultipleValuesForSpan");
62 shouldBe("getComputedStyle(gridItemWithMultipleValuesForSpan, '').getPropertyValue('-webkit-grid-row-span')", "'1'");
63 shouldBe("getComputedStyle(gridItemWithMultipleValuesForSpan, '').getPropertyValue('-webkit-grid-column-span')", "'1'");
64
65 element = document.createElement("div");
66 document.body.appendChild(element);
67 element.style.webkitGridColumnSpan = "5";
68 element.style.webkitGridRowSpan = "12";
69 shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-column-span')", "'5'");
70 shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-row-span')", "'12'");
71
72 element = document.createElement("div");
73 document.body.appendChild(element);
74 element.style.webkitGridColumnSpan = "1 2 3";
75 element.style.webkitGridRowSpan = "4 5 6";
76 shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-column-span')", "'1'");
77 shouldBe("getComputedStyle(element, '').getPropertyValue('-webkit-grid-row-span')", "'1'");
78
79</script>
80<script src="../js/resources/js-test-post.js"></script>
81</body>
82</html>