summaryrefslogtreecommitdiffstats
path: root/dom/grid/test/chrome/test_grid_lines.html
diff options
context:
space:
mode:
Diffstat (limited to 'dom/grid/test/chrome/test_grid_lines.html')
-rw-r--r--dom/grid/test/chrome/test_grid_lines.html104
1 files changed, 104 insertions, 0 deletions
diff --git a/dom/grid/test/chrome/test_grid_lines.html b/dom/grid/test/chrome/test_grid_lines.html
new file mode 100644
index 0000000000..c8fa8b6850
--- /dev/null
+++ b/dom/grid/test/chrome/test_grid_lines.html
@@ -0,0 +1,104 @@
+<!doctype html>
+<html>
+<head>
+<meta charset="utf-8">
+<script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+<style>
+body {
+ margin: 40px;
+}
+.wrapper {
+ display: grid;
+ width: 400px;
+ grid-gap: 10px;
+ grid-template-columns: 50px [first first] repeat(3, [divider] 100px) [last last last last];
+ grid-template-rows: [top1 top2] repeat(1, [top2 top2] 50px) [bot];
+ background-color: #f00;
+}
+.box {
+ background-color: #444;
+ color: #fff;
+}
+</style>
+
+<script>
+"use strict";
+
+SimpleTest.waitForExplicitFinish();
+
+function runTests() {
+ var wrapper = document.getElementById("wrapper");
+ var grid = wrapper.getGridFragments()[0];
+
+ // test property existence
+ isnot(typeof(grid.cols.lines), "undefined", "Grid.cols.lines property exists.");
+
+ if (typeof(grid.cols.lines) != "undefined") {
+ // test column line count
+ is(grid.cols.lines.length, 5,
+ "Grid.cols.lines property has length that matches grid-template-columns."
+ );
+
+ if (grid.cols.lines.length == 5) {
+ // test column line position
+ is(grid.cols.lines[1].start, 50, "Grid column line 2 position is as expected.");
+
+ // test column line width
+ is(grid.cols.lines[1].breadth, 10, "Grid column line 2 width is as expected.");
+
+ // test column line numbers, positive and negative
+ is(grid.cols.lines[3].number, 4, "Grid column line 4 positive number is as expected.");
+ is(grid.cols.lines[3].negativeNumber, -2, "Grid column line 4 negative number is as expected.");
+
+ // test column line names
+ is(grid.cols.lines[0].names.length, 0, "Grid column line 1 has no names.");
+
+ is(grid.cols.lines[1].names.length, 2, "Grid column line 2 has 2 names.");
+ is(grid.cols.lines[1].names + "", "first,divider", "Grid column line 2 has the names 'first,divider'.");
+
+ is(grid.cols.lines[4].names.length, 1, "Grid column line 5 has 1 name.");
+ is(grid.cols.lines[4].names + "", "last", "Grid column line 5 has the name 'last'.");
+ }
+ }
+
+ // test property existence
+ isnot(typeof(grid.rows.lines), "undefined", "Grid.rows.lines property exists.");
+
+ if (typeof(grid.rows.lines) != "undefined") {
+ // test column line count
+ is(grid.rows.lines.length, 3,
+ "Grid.rows.lines property has length that matches grid-template-rows."
+ );
+
+ if (grid.rows.lines.length == 3) {
+ // test row line names
+ is(grid.rows.lines[0].names.length, 2, "Grid row line 1 has 2 names.");
+ is(grid.rows.lines[0].names + "", "top1,top2", "Grid row line 1 has the names 'top1,top2'.");
+
+ is(grid.rows.lines[1].names.length, 1, "Grid row line 2 has 1 name.");
+ is(grid.rows.lines[1].names + "", "bot", "Grid row line 2 has the name 'bot'.");
+
+ is(grid.rows.lines[2].names.length, 0, "Grid row line 3 has no names.");
+ }
+ }
+
+ SimpleTest.finish();
+}
+</script>
+</head>
+<body onLoad="runTests();">
+
+ <div id="wrapper" class="wrapper">
+ <div id="boxA" class="box a">A</div>
+ <div id="boxB" class="box b">B</div>
+ <div id="boxC" class="box c">C</div>
+ <div class="box d">D</div>
+ <div class="box e">E</div>
+ <div class="box f">F</div>
+ <div class="box g">G</div>
+ <div class="box h">H</div>
+ </div>
+
+</body>
+</html>