1 Test that setting and getting grid-template-columns and grid-template-rows works as expected
3 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
6 Test getting grid-template-columns and grid-template-rows set through CSS
7 PASS window.getComputedStyle(gridWithNoneElement, '').getPropertyValue('grid-template-columns') is "none"
8 PASS window.getComputedStyle(gridWithNoneElement, '').getPropertyValue('grid-template-rows') is "none"
9 PASS window.getComputedStyle(gridWithFixedElement, '').getPropertyValue('grid-template-columns') is "10px"
10 PASS window.getComputedStyle(gridWithFixedElement, '').getPropertyValue('grid-template-rows') is "15px"
11 PASS window.getComputedStyle(gridWithPercentElement, '').getPropertyValue('grid-template-columns') is "53%"
12 PASS window.getComputedStyle(gridWithPercentElement, '').getPropertyValue('grid-template-rows') is "27%"
13 PASS window.getComputedStyle(gridWithAutoElement, '').getPropertyValue('grid-template-columns') is "auto"
14 PASS window.getComputedStyle(gridWithAutoElement, '').getPropertyValue('grid-template-rows') is "auto"
15 PASS window.getComputedStyle(gridWithEMElement, '').getPropertyValue('grid-template-columns') is "100px"
16 PASS window.getComputedStyle(gridWithEMElement, '').getPropertyValue('grid-template-rows') is "150px"
17 PASS window.getComputedStyle(gridWithViewPortPercentageElement, '').getPropertyValue('grid-template-columns') is "64px"
18 PASS window.getComputedStyle(gridWithViewPortPercentageElement, '').getPropertyValue('grid-template-rows') is "60px"
19 PASS window.getComputedStyle(gridWithMinMax, '').getPropertyValue('grid-template-columns') is "minmax(10%, 15px)"
20 PASS window.getComputedStyle(gridWithMinMax, '').getPropertyValue('grid-template-rows') is "minmax(20px, 50%)"
21 PASS window.getComputedStyle(gridWithMinContent, '').getPropertyValue('grid-template-columns') is "min-content"
22 PASS window.getComputedStyle(gridWithMinContent, '').getPropertyValue('grid-template-rows') is "min-content"
23 PASS window.getComputedStyle(gridWithMaxContent, '').getPropertyValue('grid-template-columns') is "max-content"
24 PASS window.getComputedStyle(gridWithMaxContent, '').getPropertyValue('grid-template-rows') is "max-content"
25 PASS window.getComputedStyle(gridWithFraction, '').getPropertyValue('grid-template-columns') is "1fr"
26 PASS window.getComputedStyle(gridWithFraction, '').getPropertyValue('grid-template-rows') is "2fr"
27 PASS window.getComputedStyle(gridWithCalc, '').getPropertyValue('grid-template-columns') is "150px"
28 PASS window.getComputedStyle(gridWithCalc, '').getPropertyValue('grid-template-rows') is "75px"
29 PASS window.getComputedStyle(gridWithCalcComplex, '').getPropertyValue('grid-template-columns') is "calc(150px + 50%)"
30 PASS window.getComputedStyle(gridWithCalcComplex, '').getPropertyValue('grid-template-rows') is "calc(75px + 65%)"
31 PASS window.getComputedStyle(gridWithCalcInsideMinMax, '').getPropertyValue('grid-template-columns') is "minmax(10%, 15px)"
32 PASS window.getComputedStyle(gridWithCalcInsideMinMax, '').getPropertyValue('grid-template-rows') is "minmax(20px, 50%)"
33 PASS window.getComputedStyle(gridWithCalcComplexInsideMinMax, '').getPropertyValue('grid-template-columns') is "minmax(10%, calc(15px + 50%))"
34 PASS window.getComputedStyle(gridWithCalcComplexInsideMinMax, '').getPropertyValue('grid-template-rows') is "minmax(calc(20px + 10%), 50%)"
35 PASS window.getComputedStyle(gridWithAutoInsideMinMax, '').getPropertyValue('grid-template-columns') is "minmax(auto, 20px)"
36 PASS window.getComputedStyle(gridWithAutoInsideMinMax, '').getPropertyValue('grid-template-rows') is "minmax(min-content, auto)"
38 Test getting wrong values for grid-template-columns and grid-template-rows through CSS (they should resolve to the default: 'none')
39 PASS window.getComputedStyle(gridWithFitContentElement, '').getPropertyValue('grid-template-columns') is "none"
40 PASS window.getComputedStyle(gridWithFitContentElement, '').getPropertyValue('grid-template-rows') is "none"
41 PASS window.getComputedStyle(gridWithFitAvailableElement, '').getPropertyValue('grid-template-columns') is "none"
42 PASS window.getComputedStyle(gridWithFitAvailableElement, '').getPropertyValue('grid-template-rows') is "none"
44 Test the initial value
45 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none"
46 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "none"
47 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is 'none'
48 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is 'none'
50 Test getting and setting grid-template-columns and grid-template-rows through JS
51 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "18px"
52 PASS element.style.gridTemplateColumns is "18px"
53 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "66px"
54 PASS element.style.gridTemplateRows is "66px"
55 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "55%"
56 PASS element.style.gridTemplateColumns is "55%"
57 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "40%"
58 PASS element.style.gridTemplateRows is "40%"
59 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "auto"
60 PASS element.style.gridTemplateColumns is "auto"
61 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "auto"
62 PASS element.style.gridTemplateRows is "auto"
63 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "80px"
64 PASS element.style.gridTemplateColumns is "10vw"
65 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "150px"
66 PASS element.style.gridTemplateRows is "25vh"
67 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "min-content"
68 PASS element.style.gridTemplateColumns is "min-content"
69 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "min-content"
70 PASS element.style.gridTemplateRows is "min-content"
71 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "max-content"
72 PASS element.style.gridTemplateColumns is "max-content"
73 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "max-content"
74 PASS element.style.gridTemplateRows is "max-content"
76 Test getting and setting grid-template-columns and grid-template-rows to minmax() values through JS
77 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "minmax(55%, 45px)"
78 PASS element.style.gridTemplateColumns is "minmax(55%, 45px)"
79 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "minmax(30px, 40%)"
80 PASS element.style.gridTemplateRows is "minmax(30px, 40%)"
81 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "minmax(220px, 48px)"
82 PASS element.style.gridTemplateColumns is "minmax(22em, 8vh)"
83 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "minmax(80px, 50px)"
84 PASS element.style.gridTemplateRows is "minmax(10vw, 5em)"
85 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "minmax(min-content, 48px)"
86 PASS element.style.gridTemplateColumns is "minmax(min-content, 8vh)"
87 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "minmax(80px, min-content)"
88 PASS element.style.gridTemplateRows is "minmax(10vw, min-content)"
89 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "minmax(220px, max-content)"
90 PASS element.style.gridTemplateColumns is "minmax(22em, max-content)"
91 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "minmax(max-content, 50px)"
92 PASS element.style.gridTemplateRows is "minmax(max-content, 5em)"
93 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "minmax(min-content, max-content)"
94 PASS element.style.gridTemplateColumns is "minmax(min-content, max-content)"
95 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "minmax(max-content, min-content)"
96 PASS element.style.gridTemplateRows is "minmax(max-content, min-content)"
97 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "3600fr"
98 PASS element.style.gridTemplateColumns is "3600fr"
99 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "154fr"
100 PASS element.style.gridTemplateRows is "154fr"
101 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "3.1459fr"
102 PASS element.style.gridTemplateColumns is "3.1459fr"
103 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "2.718fr"
104 PASS element.style.gridTemplateRows is "2.718fr"
105 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "3fr"
106 PASS element.style.gridTemplateColumns is "3fr"
107 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "4fr"
108 PASS element.style.gridTemplateRows is "4fr"
109 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "minmax(auto, 48px)"
110 PASS element.style.gridTemplateColumns is "minmax(auto, 8vh)"
111 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "minmax(80px, auto)"
112 PASS element.style.gridTemplateRows is "minmax(10vw, auto)"
114 Test setting grid-template-columns and grid-template-rows to bad values through JS
115 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none"
116 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "none"
117 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none"
118 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "none"
119 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none"
120 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "none"
121 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none"
122 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "none"
123 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none"
124 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "none"
125 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none"
126 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "none"
127 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none"
128 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "none"
129 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none"
130 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "none"
131 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none"
132 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "none"
133 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none"
134 PASS window.getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "none"
136 Test setting grid-template-columns and grid-template-rows back to 'none' through JS
137 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "18px"
138 PASS element.style.gridTemplateColumns is "18px"
139 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "66px"
140 PASS element.style.gridTemplateRows is "66px"
141 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is "none"
142 PASS element.style.gridTemplateColumns is "none"
143 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is "none"
144 PASS element.style.gridTemplateRows is "none"
146 Test setting grid-template-columns and grid-template-rows to 'inherit' through JS
147 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is '50px [last]'
148 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is '[first] 101%'
150 Test setting grid-template-columns and grid-template-rows to 'initial' through JS
151 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is '150% [last]'
152 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is '[first] 1fr'
153 PASS getComputedStyle(element, '').getPropertyValue('grid-template-columns') is 'none'
154 PASS getComputedStyle(element, '').getPropertyValue('grid-template-rows') is 'none'
155 PASS successfullyParsed is true