Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: third_party/WebKit/LayoutTests/fast/css-grid-layout/grid-auto-columns-rows-get-set.html

Issue 2166393002: [css-grid] grid-auto-flow|row should take a <track-size>+ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> 1 <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2 <html> 2 <html>
3 <head> 3 <head>
4 <link href="resources/grid.css" rel="stylesheet"> 4 <link href="resources/grid.css" rel="stylesheet">
5 <style> 5 <style>
6 .gridAutoFixedFixed { 6 .gridAutoFixedFixed {
7 grid-auto-rows: 30px; 7 grid-auto-rows: 30px;
8 grid-auto-columns: 50px; 8 grid-auto-columns: 50px;
9 } 9 }
10 10
(...skipping 12 matching lines...) Expand all
23 grid-auto-columns: 40px; 23 grid-auto-columns: 40px;
24 grid-template-rows: 15px; 24 grid-template-rows: 15px;
25 grid-template-columns: 20px; 25 grid-template-columns: 20px;
26 } 26 }
27 27
28 .gridAutoAutoInMinMax { 28 .gridAutoAutoInMinMax {
29 grid-auto-rows: minmax(auto, 8vh); 29 grid-auto-rows: minmax(auto, 8vh);
30 grid-auto-columns: minmax(10vw, auto); 30 grid-auto-columns: minmax(10vw, auto);
31 } 31 }
32 32
33 .gridAutoMultipleTracks {
34 width: 100px;
35 height: 50px;
36 grid-auto-rows: 10px 20px 30px;
37 grid-auto-columns: 25px 50px 100px;
38 }
39
40 .ahem { font: 10px/1 Ahem; }
33 </style> 41 </style>
34 <script src="../../resources/js-test.js"></script> 42 <script src="../../resources/js-test.js"></script>
35 <script src="resources/grid-definitions-parsing-utils.js"></script> 43 <script src="resources/grid-definitions-parsing-utils.js"></script>
36 </head> 44 </head>
37 <body> 45 <body>
38 <div class="grid gridAutoFixedFixed" id="gridAutoFixedFixed"></div> 46 <div class="grid gridAutoFixedFixed" id="gridAutoFixedFixed"></div>
39 <div class="grid gridAutoMinMax" id="gridAutoMinMax"></div> 47 <div class="grid gridAutoMinMax" id="gridAutoMinMax"></div>
40 <div class="grid gridAutoMinMaxContent" id="gridAutoMinMaxContent"></div> 48 <div class="grid gridAutoMinMaxContent" id="gridAutoMinMaxContent"></div>
41 <div class="grid gridAutoAutoInMinMax" id="gridAutoAutoInMinMax"></div> 49 <div class="grid gridAutoAutoInMinMax" id="gridAutoAutoInMinMax"></div>
42 <div class="grid gridAutoFixedFixed" id="gridAutoFixedFixedWithChildren"> 50 <div class="grid gridAutoFixedFixed" id="gridAutoFixedFixedWithChildren">
43 <div class="sizedToGridArea firstRowFirstColumn"></div> 51 <div class="sizedToGridArea firstRowFirstColumn"></div>
44 </div> 52 </div>
45 <div class="grid gridAutoFixedFixedWithFixedFixed" id="gridAutoFixedFixedWithFix edFixedWithChildren"> 53 <div class="grid gridAutoFixedFixedWithFixedFixed" id="gridAutoFixedFixedWithFix edFixedWithChildren">
46 <div class="sizedToGridArea thirdRowAutoColumn"></div> 54 <div class="sizedToGridArea thirdRowAutoColumn"></div>
47 <div class="sizedToGridArea autoRowThirdColumn"></div> 55 <div class="sizedToGridArea autoRowThirdColumn"></div>
48 </div> 56 </div>
57 <div class="grid gridAutoMultipleTracks" id="gridAutoMultipleTracks">
58 <div class="ahem" style="grid-column: 1; grid-row: 1"></div>
Manuel Rego 2016/07/22 08:24:55 Nit: "ahem" class is not needed here as you don't
svillar 2016/07/22 13:08:28 Yeah, it used to, but I removed it at the very las
59 <div class="ahem" style="grid-column: 2; grid-row: 2"></div>
60 <div class="ahem" style="grid-column: 3; grid-row: 3"></div>
61 <div class="ahem" style="grid-column: 4; grid-row: 4"></div>
62 </div>
63 <div class="grid gridAutoMultipleTracks" id="gridAutoMultipleTracksNegativeIndex es">
64 <div class="ahem" style="grid-column: -2; grid-row: -2"></div>
65 <div class="ahem" style="grid-column: -3; grid-row: -3"></div>
66 <div class="ahem" style="grid-column: -4; grid-row: -4"></div>
67 <div class="ahem" style="grid-column: -5; grid-row: -5"></div>
68 </div>
69
49 <script> 70 <script>
50 description('Test that setting and getting grid-auto-columns and grid-auto-rows works as expected'); 71 description('Test that setting and getting grid-auto-columns and grid-auto-rows works as expected');
51 72
52 debug("Test getting grid-auto-columns and grid-auto-rows set through CSS"); 73 debug("Test getting grid-auto-columns and grid-auto-rows set through CSS");
53 testGridAutoDefinitionsValues(document.getElementById("gridAutoFixedFixed"), "30 px", "50px"); 74 testGridAutoDefinitionsValues(document.getElementById("gridAutoFixedFixed"), "30 px", "50px");
54 testGridAutoDefinitionsValues(document.getElementById("gridAutoMinMax"), "minmax (10%, 15px)", "minmax(30%, 100px)"); 75 testGridAutoDefinitionsValues(document.getElementById("gridAutoMinMax"), "minmax (10%, 15px)", "minmax(30%, 100px)");
55 testGridAutoDefinitionsValues(document.getElementById("gridAutoMinMaxContent"), "min-content", "max-content"); 76 testGridAutoDefinitionsValues(document.getElementById("gridAutoMinMaxContent"), "min-content", "max-content");
56 testGridAutoDefinitionsValues(document.getElementById("gridAutoAutoInMinMax"), " minmax(auto, 48px)", "minmax(80px, auto)"); 77 testGridAutoDefinitionsValues(document.getElementById("gridAutoAutoInMinMax"), " minmax(auto, 48px)", "minmax(80px, auto)");
57 78
58 debug(""); 79 debug("");
59 debug("Test that getting grid-template-columns and grid-template-rows set throug h CSS lists every track listed whether implicitly or explicitly created"); 80 debug("Test that getting grid-template-columns and grid-template-rows set throug h CSS lists every track listed whether implicitly or explicitly created");
60 testGridAutoDefinitionsValues(document.getElementById("gridAutoFixedFixedWithChi ldren"), "30px", "50px"); 81 testGridAutoDefinitionsValues(document.getElementById("gridAutoFixedFixedWithChi ldren"), "30px", "50px");
61 testGridDefinitionsValues(document.getElementById("gridAutoFixedFixedWithChildre n"), "50px", "30px"); 82 testGridDefinitionsValues(document.getElementById("gridAutoFixedFixedWithChildre n"), "50px", "30px");
62 testGridAutoDefinitionsValues(document.getElementById("gridAutoFixedFixedWithFix edFixedWithChildren"), "30px", "40px"); 83 testGridAutoDefinitionsValues(document.getElementById("gridAutoFixedFixedWithFix edFixedWithChildren"), "30px", "40px");
63 testGridDefinitionsValues(document.getElementById("gridAutoFixedFixedWithFixedFi xedWithChildren"), "20px 40px 40px", "15px 30px 30px"); 84 testGridDefinitionsValues(document.getElementById("gridAutoFixedFixedWithFixedFi xedWithChildren"), "20px 40px 40px", "15px 30px 30px");
85 testGridDefinitionsValues(document.getElementById("gridAutoMultipleTracks"), "25 px 50px 100px 25px", "10px 20px 30px 10px");
86 testGridDefinitionsValues(document.getElementById("gridAutoMultipleTracksNegativ eIndexes"), "100px 25px 50px 100px", "30px 10px 20px 30px");
64 87
65 debug(""); 88 debug("");
66 debug("Test that grid-template-* definitions are not affected by grid-auto-* def initions"); 89 debug("Test that grid-template-* definitions are not affected by grid-auto-* def initions");
67 testGridDefinitionsValues(document.getElementById("gridAutoFixedFixed"), "none", "none"); 90 testGridDefinitionsValues(document.getElementById("gridAutoFixedFixed"), "none", "none");
68 testGridDefinitionsValues(document.getElementById("gridAutoMinMax"), "none", "no ne"); 91 testGridDefinitionsValues(document.getElementById("gridAutoMinMax"), "none", "no ne");
69 testGridDefinitionsValues(document.getElementById("gridAutoMinMaxContent"), "non e", "none"); 92 testGridDefinitionsValues(document.getElementById("gridAutoMinMaxContent"), "non e", "none");
70 93
71 debug(""); 94 debug("");
72 debug("Test the initial value"); 95 debug("Test the initial value");
73 var element = document.createElement("div"); 96 var element = document.createElement("div");
74 document.body.appendChild(element); 97 document.body.appendChild(element);
75 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-columns')", "'auto'"); 98 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-columns')", "'auto'");
76 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-rows')", "'a uto'"); 99 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-rows')", "'a uto'");
77 100
101 function testAutoValues(autoCols, autoRows, computedAutoCols, computedAutoRows) {
102 element = document.createElement("div");
103 document.body.appendChild(element);
104 element.style.fontSize = "10px";
105 element.style.gridAutoColumns = autoCols;
106 element.style.gridAutoRows = autoRows;
107 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid -auto-columns')", computedAutoCols || autoCols);
108 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid -auto-rows')", computedAutoRows || autoRows);
109 }
110
78 debug(""); 111 debug("");
79 debug("Test getting and setting grid-auto-columns and grid-auto-rows through JS" ); 112 debug("Test getting and setting grid-auto-columns and grid-auto-rows through JS" );
80 element.style.font = "10px Ahem"; 113 testAutoValues("18em", "66em", "180px", "660px");
81 element.style.gridAutoColumns = "18em"; 114 testAutoValues("minmax(min-content, 8vh)", "minmax(10vw, min-content)", "minmax( min-content, 48px)", "minmax(80px, min-content)");
82 element.style.gridAutoRows = "66em"; 115 testAutoValues("minmax(min-content, max-content)", "minmax(max-content, min-cont ent)");
83 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-columns')", "'180px'"); 116 testAutoValues("minmax(min-content, 10px) 48px 5%", "auto 30px minmax(10%, 60%)" );
Manuel Rego 2016/07/22 08:24:55 Shouldn't the percentages be resolved when you che
svillar 2016/07/22 13:08:28 Content sized tracks cannot be resolved for obviou
84 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-rows')", "'6 60px'");
85
86 element = document.createElement("div");
87 document.body.appendChild(element);
88 element.style.gridAutoColumns = "minmax(min-content, 8vh)";
89 element.style.gridAutoRows = "minmax(10vw, min-content)";
90 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-columns')", "'minmax(min-content, 48px)'");
91 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-rows')", "'m inmax(80px, min-content)'");
92
93 element = document.createElement("div");
94 document.body.appendChild(element);
95 element.style.gridAutoColumns = "minmax(min-content, max-content)";
96 element.style.gridAutoRows = "minmax(max-content, min-content)";
97 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-columns')", "'minmax(min-content, max-content)'");
98 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-rows')", "'m inmax(max-content, min-content)'");
99 117
100 debug(""); 118 debug("");
101 debug("Test setting grid-auto-columns and grid-auto-rows to bad minmax value thr ough JS"); 119 debug("Test setting grid-auto-columns and grid-auto-rows to bad minmax value thr ough JS");
102 element = document.createElement("div"); 120 testAutoValues("minmax(10px 20px)", "minmax(10px)", "auto", "auto");
103 document.body.appendChild(element); 121 testAutoValues("minmax(minmax(10px, 20px), 20px)", "minmax(10px, 20px, 30px)", " auto", "auto");
104 // No comma. 122 testAutoValues("minmax()", "minmax(30px 30% 30em)", "auto", "auto");
105 element.style.gridAutoColumns = "minmax(10px 20px)"; 123 testAutoValues("none", "none", "auto", "auto");
106 // Only 1 argument provided. 124 testAutoValues("10px [a] 20px", "[z] auto [y] min-content", "auto", "auto");
107 element.style.gridAutoRows = "minmax(10px)"; 125 testAutoValues("repeat(2, 10px [a] 20px)", "[z] repeat(auto-fit, 100px)", "auto" , "auto");
108 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-columns')", "'auto'");
109 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-rows')", "'a uto'");
110
111 element = document.createElement("div");
112 document.body.appendChild(element);
113 // Nested minmax.
114 element.style.gridAutoColumns = "minmax(minmax(10px, 20px), 20px)";
115 // Only 2 arguments are allowed.
116 element.style.gridAutoRows = "minmax(10px, 20px, 30px)";
117 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-columns')", "'auto'");
118 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-rows')", "'a uto'");
119
120 element = document.createElement("div");
121 document.body.appendChild(element);
122 // No breadth value.
123 element.style.gridAutoColumns = "minmax()";
124 // No comma.
125 element.style.gridAutoRows = "minmax(30px 30% 30em)";
126 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-columns')", "'auto'");
127 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-rows')", "'a uto'");
128
129 element = document.createElement("div");
130 document.body.appendChild(element);
131 // None is not allowed for grid-auto-{rows|columns}.
132 element.style.gridAutoColumns = "none";
133 element.style.gridAutoRows = "none";
134 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-columns')", "'auto'");
135 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-rows')", "'a uto'");
136 126
137 function testInherit() 127 function testInherit()
138 { 128 {
139 var parentElement = document.createElement("div"); 129 var parentElement = document.createElement("div");
140 document.body.appendChild(parentElement); 130 document.body.appendChild(parentElement);
141 parentElement.style.gridAutoColumns = "50px"; 131 parentElement.style.gridAutoColumns = "50px";
142 parentElement.style.gridAutoRows = "101%"; 132 parentElement.style.gridAutoRows = "101%";
143 133
144 element = document.createElement("div"); 134 element = document.createElement("div");
145 parentElement.appendChild(element); 135 parentElement.appendChild(element);
(...skipping 23 matching lines...) Expand all
169 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-rows')", "'auto'"); 159 shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-rows')", "'auto'");
170 160
171 document.body.removeChild(element); 161 document.body.removeChild(element);
172 } 162 }
173 debug(""); 163 debug("");
174 debug("Test setting grid-auto-columns and grid-auto-rows to 'initial' through JS "); 164 debug("Test setting grid-auto-columns and grid-auto-rows to 'initial' through JS ");
175 testInitial(); 165 testInitial();
176 </script> 166 </script>
177 </body> 167 </body>
178 </html> 168 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698