OLD | NEW |
1 function testGridDefinitionsValues(element, columnValue, rowValue, computedColum
nValue, computedRowValue) | 1 function testGridDefinitionsValues(element, columnValue, rowValue, computedColum
nValue, computedRowValue) |
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-definition-columns')", computedColumnValue || columnValue); | 5 shouldBeEqualToString("window.getComputedStyle(" + elementID + ", '').getPro
pertyValue('grid-template-columns')", computedColumnValue || columnValue); |
6 shouldBeEqualToString("window.getComputedStyle(" + elementID + ", '').getPro
pertyValue('grid-definition-rows')", computedRowValue || rowValue); | 6 shouldBeEqualToString("window.getComputedStyle(" + elementID + ", '').getPro
pertyValue('grid-template-rows')", computedRowValue || rowValue); |
7 } | 7 } |
8 | 8 |
9 function testGridDefinitionsSetJSValues(columnValue, rowValue, computedColumnVal
ue, computedRowValue, jsColumnValue, jsRowValue) | 9 function testGridDefinitionsSetJSValues(columnValue, rowValue, computedColumnVal
ue, computedRowValue, jsColumnValue, jsRowValue) |
10 { | 10 { |
11 checkGridDefinitionsSetJSValues(true, columnValue, rowValue, computedColumnV
alue, computedRowValue, jsColumnValue, jsRowValue); | 11 checkGridDefinitionsSetJSValues(true, columnValue, rowValue, computedColumnV
alue, computedRowValue, jsColumnValue, jsRowValue); |
12 } | 12 } |
13 | 13 |
14 function testNonGridDefinitionsSetJSValues(columnValue, rowValue, computedColumn
Value, computedRowValue, jsColumnValue, jsRowValue) | 14 function testNonGridDefinitionsSetJSValues(columnValue, rowValue, computedColumn
Value, computedRowValue, jsColumnValue, jsRowValue) |
15 { | 15 { |
16 checkGridDefinitionsSetJSValues(false, columnValue, rowValue, computedColumn
Value, computedRowValue, jsColumnValue, jsRowValue); | 16 checkGridDefinitionsSetJSValues(false, columnValue, rowValue, computedColumn
Value, computedRowValue, jsColumnValue, jsRowValue); |
17 } | 17 } |
18 | 18 |
19 function checkGridDefinitionsSetJSValues(useGrid, columnValue, rowValue, compute
dColumnValue, computedRowValue, jsColumnValue, jsRowValue) | 19 function checkGridDefinitionsSetJSValues(useGrid, columnValue, rowValue, compute
dColumnValue, computedRowValue, jsColumnValue, jsRowValue) |
20 { | 20 { |
21 window.element = document.createElement("div"); | 21 window.element = document.createElement("div"); |
22 document.body.appendChild(element); | 22 document.body.appendChild(element); |
23 if (useGrid) { | 23 if (useGrid) { |
24 element.style.display = "grid"; | 24 element.style.display = "grid"; |
25 element.style.width = "800px"; | 25 element.style.width = "800px"; |
26 element.style.height = "600px"; | 26 element.style.height = "600px"; |
27 } | 27 } |
28 element.style.font = "10px Ahem"; // Used to resolve em font consistently. | 28 element.style.font = "10px Ahem"; // Used to resolve em font consistently. |
29 element.style.gridDefinitionColumns = columnValue; | 29 element.style.gridTemplateColumns = columnValue; |
30 element.style.gridDefinitionRows = rowValue; | 30 element.style.gridTemplateRows = rowValue; |
31 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid-
definition-columns')", computedColumnValue || columnValue); | 31 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid-
template-columns')", computedColumnValue || columnValue); |
32 shouldBeEqualToString("element.style.gridDefinitionColumns", jsColumnValue |
| columnValue); | 32 shouldBeEqualToString("element.style.gridTemplateColumns", jsColumnValue ||
columnValue); |
33 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid-
definition-rows')", computedRowValue || rowValue); | 33 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid-
template-rows')", computedRowValue || rowValue); |
34 shouldBeEqualToString("element.style.gridDefinitionRows", jsRowValue || rowV
alue); | 34 shouldBeEqualToString("element.style.gridTemplateRows", jsRowValue || rowVal
ue); |
35 document.body.removeChild(element); | 35 document.body.removeChild(element); |
36 } | 36 } |
37 | 37 |
38 function testGridDefinitionsSetBadJSValues(columnValue, rowValue) | 38 function testGridDefinitionsSetBadJSValues(columnValue, rowValue) |
39 { | 39 { |
40 window.element = document.createElement("div"); | 40 window.element = document.createElement("div"); |
41 document.body.appendChild(element); | 41 document.body.appendChild(element); |
42 element.style.gridDefinitionColumns = columnValue; | 42 element.style.gridTemplateColumns = columnValue; |
43 element.style.gridDefinitionRows = rowValue; | 43 element.style.gridTemplateRows = rowValue; |
44 // We can't use testSetJSValues as element.style.gridDefinitionRows returns
"". | 44 // We can't use testSetJSValues as element.style.gridTemplateRows returns ""
. |
45 testGridDefinitionsValues(element, "none", "none"); | 45 testGridDefinitionsValues(element, "none", "none"); |
46 document.body.removeChild(element); | 46 document.body.removeChild(element); |
47 } | 47 } |
OLD | NEW |