mirror of
https://github.com/ManchildProductions/UXP-Fixed.git
synced 2026-06-15 04:18:47 +00:00
118 lines
3.3 KiB
HTML
118 lines
3.3 KiB
HTML
<!doctype html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<script type="text/javascript" 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] repeat(3, [divider] 100px) [last];
|
|
grid-template-rows: [top1] repeat(1, [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 number
|
|
is(grid.cols.lines[3].number, 4, "Grid column line 4 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.");
|
|
isnot(grid.cols.lines[1].names.indexOf("first"), -1,
|
|
"Grid column line 2 has the name 'first'."
|
|
);
|
|
isnot(grid.cols.lines[1].names.indexOf("divider"), -1,
|
|
"Grid column line 2 has the name 'divider'."
|
|
);
|
|
|
|
is(grid.cols.lines[4].names.length, 1, "Grid column line 5 has 1 name.");
|
|
isnot(grid.cols.lines[4].names.indexOf("last"), -1,
|
|
"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.");
|
|
isnot(grid.rows.lines[0].names.indexOf("top1"), -1,
|
|
"Grid row line 1 has the name 'top1'."
|
|
);
|
|
isnot(grid.rows.lines[0].names.indexOf("top2"), -1,
|
|
"Grid row line 1 has the name 'top2'."
|
|
);
|
|
|
|
is(grid.rows.lines[1].names.length, 1, "Grid row line 2 has 1 name.");
|
|
isnot(grid.rows.lines[1].names.indexOf("bot"), -1,
|
|
"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>
|