| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../../resources/js-test.js"></script> | 2 <script src="../../resources/js-test.js"></script> |
| 3 <script src="resources/grid-definitions-parsing-utils.js"></script> | 3 <script src="resources/grid-definitions-parsing-utils.js"></script> |
| 4 <style> | 4 <style> |
| 5 body { font-size: 10px; } | 5 body { font-size: 10px; } |
| 6 </style> | 6 </style> |
| 7 | 7 |
| 8 <body style="width: 800px; height: 600px;"> | 8 <body style="width: 800px; height: 600px;"> |
| 9 </body> | 9 </body> |
| 10 <script> | 10 <script> |
| 11 description('Test that setting/getting grid-template-{columns|rows} with rep
eat(auto-fill|auto-fit,) works as expected'); | 11 description('Test that setting/getting grid-template-{columns|rows} with rep
eat(auto-fill|auto-fit,) works as expected'); |
| 12 | 12 |
| 13 debug("Test auto-repeat syntax."); | 13 debug("Test auto-repeat syntax."); |
| 14 testGridDefinitionsSetJSValues("repeat(auto-fill, [foo bar] 200px)", "repeat
(auto-fill, 20em [foo bar])", "[foo bar] 200px [foo bar] 200px [foo bar] 200px [
foo bar] 200px", "200px [foo bar] 200px [foo bar] 200px [foo bar]"); | 14 testGridDefinitionsSetJSValues("repeat(auto-fill, [foo bar] 200px)", "repeat
(auto-fill, 20em [foo bar])", "[foo bar] 200px [foo bar] 200px [foo bar] 200px [
foo bar] 200px", "200px [foo bar] 200px [foo bar] 200px [foo bar]"); |
| 15 testGridDefinitionsSetJSValues("repeat(auto-fill, [foo bar] minmax(300px, 1f
r))", "repeat(auto-fill, [foo] minmax(175px, max-content) [bar])", "[foo bar] 40
0px [foo bar] 400px", "[foo] 175px [bar foo] 175px [bar foo] 175px [bar]"); | 15 testGridDefinitionsSetJSValues("repeat(auto-fill, [foo bar] minmax(300px, 1f
r))", "repeat(auto-fill, [foo] minmax(175px, max-content) [bar])", "[foo bar] 40
0px [foo bar] 400px", "[foo] 175px [bar foo] 175px [bar foo] 175px [bar]"); |
| 16 testGridDefinitionsSetJSValues("repeat(auto-fill, minmax(50px, 100px)) repea
t(2, 250px)", "repeat(1, 450px) repeat(auto-fill, minmax(max-content, 5em) [bar]
) repeat(2, [foo] 1em)", "100px 100px 100px 250px 250px", "450px 50px [bar] 50px
[bar foo] 10px [foo] 10px", "repeat(auto-fill, minmax(50px, 100px)) 250px 250px
", "450px repeat(auto-fill, minmax(max-content, 5em) [bar]) [foo] 1em [foo] 1em"
); | 16 testGridDefinitionsSetJSValues("repeat(auto-fill, minmax(50px, 100px)) repea
t(2, 250px)", "repeat(1, 450px) repeat(auto-fill, minmax(max-content, 5em) [bar]
) repeat(2, [foo] 1em)", "100px 100px 100px 250px 250px", "450px 50px [bar] 50px
[bar foo] 10px [foo] 10px", "repeat(auto-fill, minmax(50px, 100px)) 250px 250px
", "450px repeat(auto-fill, minmax(max-content, 5em) [bar]) [foo] 1em [foo] 1em"
); |
| 17 testGridDefinitionsSetJSValues("[start] 10% repeat(auto-fill, [foo bar] 200p
x) [end]", "75px [prev] repeat(auto-fill, 20em [foo bar]) [next] 15em [last end]
", "[start] 80px [foo bar] 200px [foo bar] 200px [foo bar] 200px [end]", "75px [
prev] 200px [foo bar next] 150px [last end]"); | 17 testGridDefinitionsSetJSValues("[start] 10% repeat(auto-fill, [foo bar] 200p
x) [end]", "75px [prev] repeat(auto-fill, 20em [foo bar]) [next] 15em [last end]
", "[start] 80px [foo bar] 200px [foo bar] 200px [foo bar] 200px [end]", "75px [
prev] 200px [foo bar next] 150px [last end]"); |
| 18 testGridDefinitionsSetJSValues("repeat(auto-fit, [foo bar] 150px)", "repeat(
auto-fit, 24em [foo bar])", "none", "none"); | 18 testGridDefinitionsSetJSValues("repeat(auto-fit, [foo bar] 150px)", "repeat(
auto-fit, 24em [foo bar])", "[foo bar] 0px [foo bar] 0px [foo bar] 0px [foo bar]
0px [foo bar] 0px", "0px [foo bar] 0px [foo bar]"); |
| 19 testGridDefinitionsSetJSValues("repeat(auto-fit, [foo bar] minmax(270px, 1fr
))", "repeat(auto-fit, [foo] minmax(20em, max-content) [bar])", "none", "none"); | 19 testGridDefinitionsSetJSValues("repeat(auto-fit, [foo bar] minmax(270px, 1fr
))", "repeat(auto-fit, [foo] minmax(20em, max-content) [bar])", "[foo bar] 0px [
foo bar] 0px", "[foo] 0px [bar foo] 0px [bar foo] 0px [bar]"); |
| 20 testGridDefinitionsSetJSValues("repeat(auto-fit, minmax(300px, min-content))
repeat(2, 20px)", "repeat(1, 10%) repeat(auto-fit, minmax(30em, max-content) [b
ar]) repeat(2, [foo] 1em)", "20px 20px", "60px [foo] 10px [foo] 10px", "repeat(a
uto-fit, minmax(300px, min-content)) 20px 20px", "10% repeat(auto-fit, minmax(30
em, max-content) [bar]) [foo] 1em [foo] 1em"); | 20 testGridDefinitionsSetJSValues("repeat(auto-fit, minmax(300px, min-content))
repeat(2, 20px)", "repeat(1, 10%) repeat(auto-fit, minmax(30em, max-content) [b
ar]) repeat(2, [foo] 1em)", "0px 0px 20px 20px", "60px 0px [bar foo] 10px [foo]
10px", "repeat(auto-fit, minmax(300px, min-content)) 20px 20px", "10% repeat(aut
o-fit, minmax(30em, max-content) [bar]) [foo] 1em [foo] 1em"); |
| 21 testGridDefinitionsSetJSValues("[a] repeat(auto-fit, [z] 100px [y]) [b] 30px
[c d] 20px [e]", "repeat(auto-fit, [z] 100px [y]) [a b] 30px [c d] 20px [e]", "
[a z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y b] 30px
[c d] 20px [e]", "[z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y a b] 30px
[c d] 20px [e]"); |
| 22 testGridDefinitionsSetJSValues("[a] repeat(auto-fit, [z] 100px [y]) repeat(1
, [b] 30px [c]) 20px [e]", "[a b] 30px [c d] 20px [e] repeat(auto-fit, [z] 100px
[y])", "[a z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [y z] 0px [
y b] 30px [c] 20px [e]", "[a b] 30px [c d] 20px [e z] 0px [y z] 0px [y z] 0px [y
z] 0px [y z] 0px [y]", "[a] repeat(auto-fit, [z] 100px [y]) [b] 30px [c] 20px [
e]"); |
| 21 | 23 |
| 22 debug(""); | 24 debug(""); |
| 23 debug("Test invalid repeat syntax."); | 25 debug("Test invalid repeat syntax."); |
| 24 function testInvalidSyntax(gridColumn) { | 26 function testInvalidSyntax(gridColumn) { |
| 25 element = document.createElement("div"); | 27 element = document.createElement("div"); |
| 26 document.body.appendChild(element); | 28 document.body.appendChild(element); |
| 27 element.style.gridTemplateColumns = gridColumn; | 29 element.style.gridTemplateColumns = gridColumn; |
| 28 shouldBeEqualToString("window.getComputedStyle(element, '').getPropertyV
alue('grid-template-columns')", "none"); | 30 shouldBeEqualToString("window.getComputedStyle(element, '').getPropertyV
alue('grid-template-columns')", "none"); |
| 29 document.body.removeChild(element); | 31 document.body.removeChild(element); |
| 30 } | 32 } |
| (...skipping 18 matching lines...) Expand all Loading... |
| 49 testInvalidSyntax("repeat(auto-fit, 10em [bar]) auto repeat(auto-fit, [foo]
2em)"); | 51 testInvalidSyntax("repeat(auto-fit, 10em [bar]) auto repeat(auto-fit, [foo]
2em)"); |
| 50 testInvalidSyntax("repeat(auto-fill, [foo] 1em [bar]) auto repeat(auto-fit,
[foo] 32px)"); | 52 testInvalidSyntax("repeat(auto-fill, [foo] 1em [bar]) auto repeat(auto-fit,
[foo] 32px)"); |
| 51 testInvalidSyntax("repeat(auto-fill, 1em [bar]) repeat(3, max-content [last]
) repeat(auto-fit, 32px)"); | 53 testInvalidSyntax("repeat(auto-fill, 1em [bar]) repeat(3, max-content [last]
) repeat(auto-fit, 32px)"); |
| 52 | 54 |
| 53 // <auto-repeat> requires definite minimum track sizes. | 55 // <auto-repeat> requires definite minimum track sizes. |
| 54 testInvalidSyntax("repeat(auto-fill, 10px) repeat(10, minmax(min-content, au
to))"); | 56 testInvalidSyntax("repeat(auto-fill, 10px) repeat(10, minmax(min-content, au
to))"); |
| 55 testInvalidSyntax("auto repeat(auto-fit, [foo] 10px)"); | 57 testInvalidSyntax("auto repeat(auto-fit, [foo] 10px)"); |
| 56 testInvalidSyntax("10% repeat(auto-fit, [foo] 10px) min-content"); | 58 testInvalidSyntax("10% repeat(auto-fit, [foo] 10px) min-content"); |
| 57 testInvalidSyntax("20px [bar] repeat(4, auto) [foo] repeat(auto-fill, 3em)")
; | 59 testInvalidSyntax("20px [bar] repeat(4, auto) [foo] repeat(auto-fill, 3em)")
; |
| 58 </script> | 60 </script> |
| OLD | NEW |