| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <html> |
| <head> |
| <link href="resources/grid.css" rel="stylesheet"> |
| <style> |
| .singleSingleTrackRepeat { |
| grid-template-rows: repeat(1, 18px); |
| grid-template-columns: repeat(1, 15%); |
| } |
| |
| .twoSingleTrackRepeat { |
| grid-template-rows: repeat(2, auto); |
| grid-template-columns: repeat(2, minmax(15px, 50%)); |
| } |
| |
| .twoDoubleTrackRepeat { |
| grid-template-rows: repeat(2, minmax(5px, 10px) auto); |
| grid-template-columns: repeat(2, auto minmax(100px, 120px)); |
| } |
| |
| .twoDoubleTrackWithNamedGridLineRepeat { |
| grid-template-rows: repeat(2, 10px [start] auto [end]); |
| grid-template-columns: repeat(2, auto [middle] 250px [end]); |
| } |
| |
| .twoDoubleTrackWithTrailingNamedGridLineRepeat { |
| grid-template-rows: repeat(2, [before] 10px); |
| grid-template-columns: repeat(2, [before] auto); |
| } |
| |
| .trailingNamedGridLineRepeat { |
| grid-template-rows: repeat(1, 10px) [end]; |
| grid-template-columns: repeat(1, 250px) [end]; |
| } |
| |
| .leadingNamedGridLineRepeat { |
| grid-template-rows: [start] repeat(2, 10px); |
| grid-template-columns: [start] repeat(2, 250px); |
| } |
| |
| .mixRepeatAfterNonRepeat { |
| grid-template-rows: auto repeat(2, 10px); |
| grid-template-columns: [start] 140px repeat(2, 250px); |
| } |
| |
| .mixNonRepeatAfterRepeat { |
| grid-template-rows: repeat(2, 10px) [end] auto; |
| grid-template-columns: repeat(2, 250px) 15% [last]; |
| } |
| </style> |
| <script src="../../resources/js-test-pre.js"></script> |
| </head> |
| <body> |
| <div class="singleSingleTrackRepeat" id="singleSingleTrackRepeat"></div> |
| <div class="twoSingleTrackRepeat" id="twoSingleTrackRepeat"></div> |
| <div class="twoDoubleTrackRepeat" id="twoDoubleTrackRepeat"></div> |
| <div class="twoDoubleTrackWithNamedGridLineRepeat" id="twoDoubleTrackWithNamedGridLineRepeat"></div> |
| <div class="twoDoubleTrackWithTrailingNamedGridLineRepeat" id="twoDoubleTrackWithTrailingNamedGridLineRepeat"></div> |
| <div class="trailingNamedGridLineRepeat" id="trailingNamedGridLineRepeat"></div> |
| <div class="leadingNamedGridLineRepeat" id="leadingNamedGridLineRepeat"></div> |
| <div class="mixRepeatAfterNonRepeat" id="mixRepeatAfterNonRepeat"></div> |
| <div class="mixNonRepeatAfterRepeat" id="mixNonRepeatAfterRepeat"></div> |
| |
| <script src="resources/grid-definitions-parsing-utils.js"></script> |
| <script> |
| description('Test that setting and getting grid-template-columns and grid-template-rows with repeat() works as expected'); |
| |
| debug("Test getting grid-template-columns and grid-template-rows set through CSS"); |
| testGridTemplatesValues(document.getElementById("singleSingleTrackRepeat"), "15%", "18px"); |
| testGridTemplatesValues(document.getElementById("twoSingleTrackRepeat"), "minmax(15px, 50%) minmax(15px, 50%)", "auto auto"); |
| testGridTemplatesValues(document.getElementById("twoDoubleTrackRepeat"), "auto minmax(100px, 120px) auto minmax(100px, 120px)", "minmax(5px, 10px) auto minmax(5px, 10px) auto"); |
| testGridTemplatesValues(document.getElementById("twoDoubleTrackWithNamedGridLineRepeat"), "auto [middle] 250px [end] auto [middle] 250px [end]", "10px [start] auto [end] 10px [start] auto [end]"); |
| testGridTemplatesValues(document.getElementById("twoDoubleTrackWithTrailingNamedGridLineRepeat"), "[before] auto [before] auto", "[before] 10px [before] 10px"); |
| testGridTemplatesValues(document.getElementById("trailingNamedGridLineRepeat"), "250px [end]", "10px [end]"); |
| testGridTemplatesValues(document.getElementById("leadingNamedGridLineRepeat"), "[start] 250px 250px", "[start] 10px 10px"); |
| testGridTemplatesValues(document.getElementById("mixRepeatAfterNonRepeat"), "[start] 140px 250px 250px", "auto 10px 10px"); |
| testGridTemplatesValues(document.getElementById("mixNonRepeatAfterRepeat"), "250px 250px 15% [last]", "10px 10px [end] auto"); |
| |
| debug(""); |
| debug("Test invalid repeat syntax."); |
| function testInvalidSyntax(gridColumn) { |
| element = document.createElement("div"); |
| document.body.appendChild(element); |
| element.style.gridDefinitionColumns = gridColumn; |
| shouldBeEqualToString("window.getComputedStyle(element, '').getPropertyValue('grid-template-columns')", "none"); |
| document.body.removeChild(element); |
| } |
| testInvalidSyntax("repeat("); |
| testInvalidSyntax("repeat()"); |
| testInvalidSyntax("repeat(3 / auto)"); |
| testInvalidSyntax("repeat(3 , ,)"); |
| testInvalidSyntax("repeat(0, 15px)"); |
| testInvalidSyntax("repeat(-1, auto)"); |
| // Nesting is no allowed. |
| testInvalidSyntax("repeat(2, repeat(1, auto))"); |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |