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