Index: LayoutTests/fast/css-grid-layout/grid-shorthand-get-set.html |
diff --git a/LayoutTests/fast/css-grid-layout/grid-shorthand-get-set.html b/LayoutTests/fast/css-grid-layout/grid-shorthand-get-set.html |
new file mode 100644 |
index 0000000000000000000000000000000000000000..fb3426fe88a999849fb4284ae8759d5531848136 |
--- /dev/null |
+++ b/LayoutTests/fast/css-grid-layout/grid-shorthand-get-set.html |
@@ -0,0 +1,88 @@ |
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
+<html> |
+<head> |
+<link href="resources/grid.css" rel="stylesheet"> |
+<style> |
+#gridWithNone { |
+ grid: none; |
+} |
+#gridWithTemplate { |
+ grid: 15px / 10px; |
+} |
+#gridWithAutoFlowAndColumns { |
+ grid: row 10px; |
+} |
+#gridWithAutoFlowNone { |
+ grid: none 10px; |
+} |
+#gridWithAutoFlowAndColumnsAndRows { |
+ grid: column 10px / 20px; |
+} |
+ |
+/* Bad values. */ |
+ |
+#gridWithExplicitAndImplicit { |
+ grid: 10px / 20px column; |
+} |
+#gridWithMisplacedNone1 { |
+ grid: column 10px / none 20px; |
+} |
+#gridWithMisplacedNone2 { |
+ grid: 10px / 20px none; |
+} |
+</style> |
+<script src="../../resources/js-test.js"></script> |
+</head> |
+<body> |
+<div class="grid" id="gridWithNone"></div> |
+<div class="grid" id="gridWithTemplate"></div> |
+<div class="grid" id="gridWithAutoFlowAndColumns"></div> |
+<div class="grid" id="gridWithAutoFlowNone"></div> |
+<div class="grid" id="gridWithAutoFlowAndColumnsAndRows"></div> |
+<div class="grid" id="gridWithExplicitAndImplicit"></div> |
+<div class="grid" id="gridWithMisplacedNone1"></div> |
+<div class="grid" id="gridWithMisplacedNone2"></div> |
+<script src="resources/grid-shorthand-parsing-utils.js"></script> |
+<script> |
+ description("This test checks that the 'grid' shorthand is properly parsed and the longhand properties correctly assigned."); |
+ |
+ debug("Test getting the longhand values when shorthand is set through CSS."); |
+ testGridDefinitionsValues(document.getElementById("gridWithNone"), "none", "none", "none", "none", "auto", "auto"); |
+ testGridDefinitionsValues(document.getElementById("gridWithTemplate"), "15px", "10px", "none", "none", "auto", "auto"); |
+ testGridDefinitionsValues(document.getElementById("gridWithAutoFlowAndColumns"), "none", "none", "none", "row", "10px", "10px"); |
+ testGridDefinitionsValues(document.getElementById("gridWithAutoFlowNone"), "none", "none", "none", "none", "10px", "10px"); |
+ testGridDefinitionsValues(document.getElementById("gridWithAutoFlowAndColumnsAndRows"), "none", "none", "none", "column", "10px", "20px"); |
+ |
+ debug(""); |
+ debug("Test getting wrong values for 'grid' shorthand through CSS (they should resolve to the default: 'none')"); |
+ testGridDefinitionsValues(document.getElementById("gridWithExplicitAndImplicit"), "none", "none", "none", "none", "auto", "auto"); |
+ testGridDefinitionsValues(document.getElementById("gridWithMisplacedNone1"), "none", "none", "none", "none", "auto", "auto"); |
+ testGridDefinitionsValues(document.getElementById("gridWithMisplacedNone2"), "none", "none", "none", "none", "auto", "auto"); |
+ |
+ debug(""); |
+ debug("Test getting and setting 'grid' shorthand through JS"); |
+ testGridDefinitionsSetJSValues("10px / 20px", "10px", "20px", "none", "none", "auto", "auto", "10px", "20px", "none", "initial", "initial", "initial"); |
+ testGridDefinitionsSetJSValues("10px / (line) 'a' 20px", "10px", "(line) 20px", "\"a\"", "none", "auto", "auto", "10px", "(line) 20px", "\"a\"", "initial", "initial", "initial"); |
+ testGridDefinitionsSetJSValues("row 20px", "none", "none", "none", "row", "20px", "20px", "initial", "initial", "initial", "row", "20px", "20px"); |
+ testGridDefinitionsSetJSValues("column 20px / 10px", "none", "none", "none", "column", "20px", "10px", "initial", "initial", "initial", "column", "20px", "10px"); |
+ |
+ debug(""); |
+ debug("Test the initial value"); |
+ var element = document.createElement("div"); |
+ document.body.appendChild(element); |
+ testGridDefinitionsValues(element, "none", "none", "none", "none", "auto", "auto"); |
+ shouldBe("getComputedStyle(element, '').getPropertyValue('grid-template-columns')", "'none'"); |
+ shouldBe("getComputedStyle(element, '').getPropertyValue('grid-template-rows')", "'none'"); |
+ shouldBe("getComputedStyle(element, '').getPropertyValue('grid-template-areas')", "'none'"); |
+ shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-flow')", "'none'"); |
+ shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-columns')", "'auto'"); |
+ shouldBe("getComputedStyle(element, '').getPropertyValue('grid-auto-rows')", "'auto'"); |
+ |
+ debug(""); |
+ debug("Test setting grid-template-columns and grid-template-rows back to 'none' through JS"); |
+ testGridDefinitionsSetJSValues("column 10px / 20px", "none", "none", "none", "column", "10px", "20px", "initial", "initial", "initial", "column", "10px", "20px"); |
+ testGridDefinitionsSetJSValues("none", "none", "none", "none", "none", "auto", "auto", "none", "none", "none", "initial", "initial", "initial"); |
+ |
+</script> |
+</body> |
+</html> |