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

Side by Side Diff: LayoutTests/fast/css-grid-layout/resources/grid-template-shorthand-parsing-utils.js

Issue 149373004: [CSS Grid Layout] Implementation of the grid-template shorthand. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@grid-template-working
Patch Set: New approach: simpler code, reusing track-list parsing and allow rewinding. Created 6 years, 10 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
(Empty)
1 function testGridDefinitionsValues(element, columnsValue, rowsValue, areasValue, computedColumnsValue, computedRowsValue)
2 {
3 window.element = element;
4 var elementID = element.id || "element";
5 shouldBeEqualToString("window.getComputedStyle(" + elementID + ", '').getPro pertyValue('grid-template-columns')", computedColumnsValue || columnsValue);
6 shouldBeEqualToString("window.getComputedStyle(" + elementID + ", '').getPro pertyValue('grid-template-rows')", computedRowsValue || rowsValue);
7 shouldBeEqualToString("window.getComputedStyle(" + elementID + ", '').getPro pertyValue('grid-template-areas')", areasValue);
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 element.style.font = "10px Ahem"; // Used to resolve em font consistently.
30 element.style.gridTemplate = shorthandValue;
31 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid- template-columns')", computedColumnsValue);
32 shouldBeEqualToString("element.style.gridTemplateColumns", jsColumnsValue || computedColumnsValue);
33 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid- template-rows')", computedRowsValue);
34 shouldBeEqualToString("element.style.gridTemplateRows", jsRowsValue || compu tedRowsValue);
35 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid- template-areas')", computedAreasValue);
36 shouldBeEqualToString("element.style.gridTemplateAreas", jsAreasValue || com putedAreasValue);
37 document.body.removeChild(element);
38 }
39
40 function testGridDefinitionsSetBadJSValues(shorthandValue)
41 {
42 window.element = document.createElement("div");
43 document.body.appendChild(element);
44 element.style.gridTemplate = shorthandValue;
45 // We can't use testSetJSValues as element.style.gridTemplateRows returns "" .
46 testGridDefinitionsValues(element, "none", "none", "none");
47 document.body.removeChild(element);
48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698