| OLD | NEW |
| 1 function testGridDefinitionsValues(element, computedColumnsValue, computedRowsVa
lue, computedAreasValue) | 1 function testGridDefinitionsValues(element, computedColumnsValue, computedRowsVa
lue, computedAreasValue) |
| 2 { | 2 { |
| 3 window.element = element; | 3 window.element = element; |
| 4 var elementID = element.id || "element"; | 4 var elementID = element.id || "element"; |
| 5 shouldBeEqualToString("window.getComputedStyle(" + elementID + ", '').getPro
pertyValue('grid-template-columns')", computedColumnsValue); | 5 shouldBeEqualToString("window.getComputedStyle(" + elementID + ", '').getPro
pertyValue('grid-template-columns')", computedColumnsValue); |
| 6 shouldBeEqualToString("window.getComputedStyle(" + elementID + ", '').getPro
pertyValue('grid-template-rows')", computedRowsValue); | 6 shouldBeEqualToString("window.getComputedStyle(" + elementID + ", '').getPro
pertyValue('grid-template-rows')", computedRowsValue); |
| 7 shouldBeEqualToString("window.getComputedStyle(" + elementID + ", '').getPro
pertyValue('grid-template-areas')", computedAreasValue); | 7 shouldBeEqualToString("window.getComputedStyle(" + elementID + ", '').getPro
pertyValue('grid-template-areas')", computedAreasValue); |
| 8 } | 8 } |
| 9 | 9 |
| 10 function testGridDefinitionsSetJSValues(shorthandValue, computedColumnsValue, co
mputedRowsValue, computedAreasValue, jsColumnsValue, jsRowsValue, jsAreasValue) | 10 function testGridDefinitionsSetJSValues(shorthandValue, computedColumnsValue, co
mputedRowsValue, computedAreasValue, jsColumnsValue, jsRowsValue, jsAreasValue) |
| 11 { | 11 { |
| 12 checkGridDefinitionsSetJSValues(true, shorthandValue, computedColumnsValue,
computedRowsValue, computedAreasValue, jsColumnsValue, jsRowsValue, jsAreasValue
); | 12 checkGridDefinitionsSetJSValues(true, shorthandValue, computedColumnsValue,
computedRowsValue, computedAreasValue, jsColumnsValue, jsRowsValue, jsAreasValue
); |
| 13 } | 13 } |
| 14 | 14 |
| 15 function testNonGridDefinitionsSetJSValues(shorthandValue, computedColumnsValue,
computedRowsValue, computedAreasValue, jsColumnsValue, jsRowsValue, jsAreasValu
e) | 15 function testNonGridDefinitionsSetJSValues(shorthandValue, computedColumnsValue,
computedRowsValue, computedAreasValue, jsColumnsValue, jsRowsValue, jsAreasValu
e) |
| 16 { | 16 { |
| 17 checkGridDefinitionsSetJSValues(false, shorthandValue, computedColumnsValue,
computedRowsValue, computedAreasValue, jsColumnsValue, jsRowsValue, jsAreasValu
e); | 17 checkGridDefinitionsSetJSValues(false, shorthandValue, computedColumnsValue,
computedRowsValue, computedAreasValue, jsColumnsValue, jsRowsValue, jsAreasValu
e); |
| 18 } | 18 } |
| 19 | 19 |
| 20 function checkGridDefinitionsSetJSValues(useGrid, shorthandValue, computedColumn
sValue, computedRowsValue, computedAreasValue, jsColumnsValue, jsRowsValue, jsAr
easValue) | 20 function checkGridDefinitionsSetJSValues(useGrid, shorthandValue, computedColumn
sValue, computedRowsValue, computedAreasValue, jsColumnsValue, jsRowsValue, jsAr
easValue) |
| 21 { | 21 { |
| 22 window.element = document.createElement("div"); | 22 window.element = document.createElement("div"); |
| 23 document.body.appendChild(element); | 23 document.body.appendChild(element); |
| 24 if (useGrid) { | 24 if (useGrid) { |
| 25 element.style.display = "grid"; | 25 element.style.display = "grid"; |
| 26 element.style.width = "800px"; | 26 element.style.width = "800px"; |
| 27 element.style.height = "600px"; | 27 element.style.height = "600px"; |
| 28 element.style.justifyContent = "start"; |
| 29 element.style.alignContent = "start"; |
| 28 } | 30 } |
| 29 | 31 |
| 30 element.style.font = "10px Ahem"; // Used to resolve em font consistently. | 32 element.style.font = "10px Ahem"; // Used to resolve em font consistently. |
| 31 element.style.gridTemplate = shorthandValue; | 33 element.style.gridTemplate = shorthandValue; |
| 32 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid-
template-columns')", computedColumnsValue); | 34 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid-
template-columns')", computedColumnsValue); |
| 33 shouldBeEqualToString("element.style.gridTemplateColumns", jsColumnsValue ||
computedColumnsValue); | 35 shouldBeEqualToString("element.style.gridTemplateColumns", jsColumnsValue ||
computedColumnsValue); |
| 34 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid-
template-rows')", computedRowsValue); | 36 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid-
template-rows')", computedRowsValue); |
| 35 shouldBeEqualToString("element.style.gridTemplateRows", jsRowsValue || compu
tedRowsValue); | 37 shouldBeEqualToString("element.style.gridTemplateRows", jsRowsValue || compu
tedRowsValue); |
| 36 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid-
template-areas')", computedAreasValue); | 38 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid-
template-areas')", computedAreasValue); |
| 37 shouldBeEqualToString("element.style.gridTemplateAreas", jsAreasValue || com
putedAreasValue); | 39 shouldBeEqualToString("element.style.gridTemplateAreas", jsAreasValue || com
putedAreasValue); |
| 38 document.body.removeChild(element); | 40 document.body.removeChild(element); |
| 39 | 41 |
| 40 } | 42 } |
| 41 | 43 |
| 42 function testGridDefinitionsSetBadJSValues(shorthandValue) | 44 function testGridDefinitionsSetBadJSValues(shorthandValue) |
| 43 { | 45 { |
| 44 window.element = document.createElement("div"); | 46 window.element = document.createElement("div"); |
| 45 document.body.appendChild(element); | 47 document.body.appendChild(element); |
| 46 | 48 |
| 47 element.style.gridTemplate = shorthandValue; | 49 element.style.gridTemplate = shorthandValue; |
| 48 // We can't use testSetJSValues as element.style.gridTemplateRows returns ""
. | 50 // We can't use testSetJSValues as element.style.gridTemplateRows returns ""
. |
| 49 testGridDefinitionsValues(element, "none", "none", "none"); | 51 testGridDefinitionsValues(element, "none", "none", "none"); |
| 50 document.body.removeChild(element); | 52 document.body.removeChild(element); |
| 51 } | 53 } |
| OLD | NEW |