OLD | NEW |
1 description('Test that setting and getting grid-template-columns and grid-templa
te-rows works as expected'); | 1 description('Test that setting and getting grid-template-columns and grid-templa
te-rows works as expected'); |
2 | 2 |
3 debug("Test getting grid-template-columns and grid-template-rows set through CSS
"); | 3 debug("Test getting grid-template-columns and grid-template-rows set through CSS
"); |
4 testGridDefinitionsValues(document.getElementById("gridWithNoneElement"), "none"
, "none"); | 4 testGridDefinitionsValues(document.getElementById("gridWithNoneElement"), "none"
, "none"); |
5 testGridDefinitionsValues(document.getElementById("gridWithFixedElement"), "10px
", "15px"); | 5 testGridDefinitionsValues(document.getElementById("gridWithFixedElement"), "10px
", "15px"); |
6 testGridDefinitionsValues(document.getElementById("gridWithPercentElement"), "40
0px", "150px"); | 6 testGridDefinitionsValues(document.getElementById("gridWithPercentElement"), "40
0px", "150px"); |
7 testGridDefinitionsValues(document.getElementById("gridWithPercentWithoutSize"),
"0px", "0px"); | 7 testGridDefinitionsValues(document.getElementById("gridWithPercentWithoutSize"),
"0px", "0px"); |
8 testGridDefinitionsValues(document.getElementById("gridWithPercentWithoutSizeWit
hChildren"), "7px", "11px"); | 8 testGridDefinitionsValues(document.getElementById("gridWithPercentWithoutSizeWit
hChildren"), "7px", "11px"); |
9 testGridDefinitionsValues(document.getElementById("gridWithAutoElement"), "0px",
"0px"); | 9 testGridDefinitionsValues(document.getElementById("gridWithAutoElement"), "0px",
"0px"); |
10 testGridDefinitionsValues(document.getElementById("gridWithAutoWithoutSizeElemen
t"), "0px", "0px"); | 10 testGridDefinitionsValues(document.getElementById("gridWithAutoWithoutSizeElemen
t"), "0px", "0px"); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 | 95 |
96 debug(""); | 96 debug(""); |
97 debug("Test setting grid-template-columns and grid-template-rows back to 'none'
through JS"); | 97 debug("Test setting grid-template-columns and grid-template-rows back to 'none'
through JS"); |
98 testGridDefinitionsSetJSValues("18px", "66px"); | 98 testGridDefinitionsSetJSValues("18px", "66px"); |
99 testGridDefinitionsSetJSValues("none", "none"); | 99 testGridDefinitionsSetJSValues("none", "none"); |
100 | 100 |
101 function testInherit() | 101 function testInherit() |
102 { | 102 { |
103 var parentElement = document.createElement("div"); | 103 var parentElement = document.createElement("div"); |
104 document.body.appendChild(parentElement); | 104 document.body.appendChild(parentElement); |
105 parentElement.style.gridTemplateColumns = "50px (last)"; | 105 parentElement.style.gridTemplateColumns = "50px [last]"; |
106 parentElement.style.gridTemplateRows = "(first) 101%"; | 106 parentElement.style.gridTemplateRows = "[first] 101%"; |
107 | 107 |
108 element = document.createElement("div"); | 108 element = document.createElement("div"); |
109 parentElement.appendChild(element); | 109 parentElement.appendChild(element); |
110 element.style.display = "grid"; | 110 element.style.display = "grid"; |
111 element.style.height = "100px"; | 111 element.style.height = "100px"; |
112 element.style.gridTemplateColumns = "inherit"; | 112 element.style.gridTemplateColumns = "inherit"; |
113 element.style.gridTemplateRows = "inherit"; | 113 element.style.gridTemplateRows = "inherit"; |
114 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-template-colu
mns')", "'50px (last)'"); | 114 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-template-colu
mns')", "'50px [last]'"); |
115 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-template-rows
')", "'(first) 101px'"); | 115 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-template-rows
')", "'[first] 101px'"); |
116 | 116 |
117 document.body.removeChild(parentElement); | 117 document.body.removeChild(parentElement); |
118 } | 118 } |
119 debug(""); | 119 debug(""); |
120 debug("Test setting grid-template-columns and grid-template-rows to 'inherit' th
rough JS"); | 120 debug("Test setting grid-template-columns and grid-template-rows to 'inherit' th
rough JS"); |
121 testInherit(); | 121 testInherit(); |
122 | 122 |
123 function testInitial() | 123 function testInitial() |
124 { | 124 { |
125 element = document.createElement("div"); | 125 element = document.createElement("div"); |
126 document.body.appendChild(element); | 126 document.body.appendChild(element); |
127 element.style.display = "grid"; | 127 element.style.display = "grid"; |
128 element.style.width = "300px"; | 128 element.style.width = "300px"; |
129 element.style.height = "150px"; | 129 element.style.height = "150px"; |
130 element.style.gridTemplateColumns = "150% (last)"; | 130 element.style.gridTemplateColumns = "150% [last]"; |
131 element.style.gridTemplateRows = "(first) 1fr"; | 131 element.style.gridTemplateRows = "[first] 1fr"; |
132 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-template-colu
mns')", "'450px (last)'"); | 132 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-template-colu
mns')", "'450px [last]'"); |
133 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-template-rows
')", "'(first) 150px'"); | 133 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-template-rows
')", "'[first] 150px'"); |
134 | 134 |
135 element.style.display = "grid"; | 135 element.style.display = "grid"; |
136 element.style.gridTemplateColumns = "initial"; | 136 element.style.gridTemplateColumns = "initial"; |
137 element.style.gridTemplateRows = "initial"; | 137 element.style.gridTemplateRows = "initial"; |
138 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-template-colu
mns')", "'none'"); | 138 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-template-colu
mns')", "'none'"); |
139 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-template-rows
')", "'none'"); | 139 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-template-rows
')", "'none'"); |
140 | 140 |
141 document.body.removeChild(element); | 141 document.body.removeChild(element); |
142 } | 142 } |
143 debug(""); | 143 debug(""); |
144 debug("Test setting grid-template-columns and grid-template-rows to 'initial' th
rough JS"); | 144 debug("Test setting grid-template-columns and grid-template-rows to 'initial' th
rough JS"); |
145 testInitial(); | 145 testInitial(); |
OLD | NEW |