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

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: Added the new property to the ones runtime enabled only. 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, computedColumnsValue, computedRowsVa lue, computedAreasValue)
2 {
3 window.element = element;
4 var elementID = element.id || "element";
5 shouldBeEqualToString("window.getComputedStyle(" + elementID + ", '').getPro pertyValue('grid-template-columns')", computedColumnsValue);
6 shouldBeEqualToString("window.getComputedStyle(" + elementID + ", '').getPro pertyValue('grid-template-rows')", computedRowsValue);
7 shouldBeEqualToString("window.getComputedStyle(" + elementID + ", '').getPro pertyValue('grid-template-areas')", computedAreasValue);
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
30 element.style.font = "10px Ahem"; // Used to resolve em font consistently.
31 element.style.gridTemplate = shorthandValue;
32 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid- template-columns')", computedColumnsValue);
33 shouldBeEqualToString("element.style.gridTemplateColumns", jsColumnsValue || computedColumnsValue);
34 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid- template-rows')", computedRowsValue);
35 shouldBeEqualToString("element.style.gridTemplateRows", jsRowsValue || compu tedRowsValue);
36 shouldBeEqualToString("getComputedStyle(element, '').getPropertyValue('grid- template-areas')", computedAreasValue);
37 shouldBeEqualToString("element.style.gridTemplateAreas", jsAreasValue || com putedAreasValue);
38 document.body.removeChild(element);
39
40 }
41
42 function testGridDefinitionsSetBadJSValues(shorthandValue)
43 {
44 window.element = document.createElement("div");
45 document.body.appendChild(element);
46
47 element.style.gridTemplate = shorthandValue;
48 // We can't use testSetJSValues as element.style.gridTemplateRows returns "" .
49 testGridDefinitionsValues(element, "none", "none", "none");
50 document.body.removeChild(element);
51 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698