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

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

Issue 176853007: [CSS Grid Layout] Implementation of the grid shorthand. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fixed compilation error in debug. Created 6 years, 8 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, autoFlowValue, autoColumnsValue, autoRowsValue)
2 {
3 window.element = element;
4 var elementID = element.id || "element";
5 shouldBeEqualToString("window.getComputedStyle(" + elementID + ", '').getPro pertyValue('grid-template-columns')", columnsValue);
6 shouldBeEqualToString("window.getComputedStyle(" + elementID + ", '').getPro pertyValue('grid-template-rows')", rowsValue);
7 shouldBeEqualToString("window.getComputedStyle(" + elementID + ", '').getPro pertyValue('grid-template-areas')", areasValue);
8 shouldBeEqualToString("window.getComputedStyle(" + elementID + ", '').getPro pertyValue('grid-auto-flow')", autoFlowValue);
9 shouldBeEqualToString("window.getComputedStyle(" + elementID + ", '').getPro pertyValue('grid-auto-columns')", autoColumnsValue);
10 shouldBeEqualToString("window.getComputedStyle(" + elementID + ", '').getPro pertyValue('grid-auto-rows')", autoRowsValue);
11 }
12
13 function testGridDefinitionsSetJSValues(shorthandValue, computedColumnsValue, co mputedRowsValue, computedAreasValue, computedAutoFlowValue, computedAutoColumnsV alue, computedAutoRowsValue, jsColumnsValue, jsRowsValue, jsAreasValue, jsAutoFl owValue, jsAutoColumnsValue, jsAutoRowsValue)
14 {
15 checkGridDefinitionsSetJSValues(true, shorthandValue, computedColumnsValue, computedRowsValue, computedAreasValue, computedAutoFlowValue, computedAutoColumn sValue, computedAutoRowsValue, jsColumnsValue, jsRowsValue, jsAreasValue, jsAuto FlowValue, jsAutoColumnsValue, jsAutoRowsValue);
16 }
17
18 function testNonGridDefinitionsSetJSValues(shorthandValue, computedColumnsValue, computedRowsValue, computedAreasValue, computedAutoFlowValue, computedAutoColum nsValue, computedAutoRowsValue, jsColumnsValue, jsRowsValue, jsAreasValue, jsAut oFlowValue, jsAutoColumnsValue, jsAutoRowValue)
19 {
20 checkGridDefinitionsSetJSValues(false, shorthandValue, computedColumnsValue, computedRowsValue, computedAreasValue, computedAutoFlowValue, computedAutoColum nsValue, computedAutoRowsValue, jsColumnsValue, jsRowsValue, jsAreasValue, jsAut oFlowValue, jsAutoColumnsValue, jsAutoRowValue);
21 }
22
23 function checkGridDefinitionsSetJSValues(useGrid, shorthandValue, computedColumn sValue, computedRowsValue, computedAreasValue, computedAutoFlowValue, computedAu toColumnsValue, computedAutoRowsValue, jsColumnsValue, jsRowsValue, jsAreasValue , jsAutoFlowValue, jsAutoColumnsValue, jsAutoRowsValue)
24 {
25 window.element = document.createElement("div");
26 document.body.appendChild(element);
27 if (useGrid) {
28 element.style.display = "grid";
29 element.style.width = "800px";
30 element.style.height = "600px";
31 }
32 element.style.font = "10px Ahem"; // Used to resolve em font consistently.
33 element.style.grid = shorthandValue;
34 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid- template-columns')", computedColumnsValue);
35 shouldBeEqualToString("element.style.gridTemplateColumns", jsColumnsValue || computedColumnsValue);
36 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid- template-rows')", computedRowsValue);
37 shouldBeEqualToString("element.style.gridTemplateRows", jsRowsValue || compu tedRowsValue);
38 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid- template-areas')", computedAreasValue);
39 shouldBeEqualToString("element.style.gridTemplateAreas", jsAreasValue || com putedAreasValue);
40 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid- auto-flow')", computedAutoFlowValue);
41 shouldBeEqualToString("element.style.gridAutoFlow", jsAutoFlowValue || compu tedAutoFlowValue);
42 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid- auto-columns')", computedAutoColumnsValue);
43 shouldBeEqualToString("element.style.gridAutoColumns", jsAutoColumnsValue || computedAutoColumnsValue);
44 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid- auto-rows')", computedAutoRowsValue);
45 shouldBeEqualToString("element.style.gridAutoRows", jsAutoRowsValue || compu tedAutoRowsValue);
46 document.body.removeChild(element);
47 }
48
49 function testGridDefinitionsSetBadJSValues(shorthandValue)
50 {
51 window.element = document.createElement("div");
52 document.body.appendChild(element);
53 element.style.gridTemplate = shorthandValue;
54 // We can't use testSetJSValues as element.style.gridTemplateRows returns "" .
55 testGridDefinitionsValues(element, "none", "none", "none");
56 document.body.removeChild(element);
57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698