Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<!DOCTYPE html>
<html>
<meta charset="utf-8">
<title>CSS Grid Layout Test: Flooring of repeating track sizes to nonzero values</title>
<link rel="author" title="Sean Lauritzen" href="mailto:[email protected]">
<link rel="help" href="https://www.w3.org/TR/css-grid-1/#auto-repeat">
<meta name="assert" content="This test checks that the grid `repeat()` notation floors track sizes to a positive nonzero value (nominally 1px) for the purpose of finding the number of auto-repeated tracks.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
#test-1 {
width: 60px;
display: grid;
grid-template-columns: repeat(auto-fit, 0);
}
#test-2 {
width: 60px;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
}
#test-3 {
height: 60px;
display: grid;
grid-template-rows: repeat(auto-fill, minmax(0, 0));
}
</style>
<p>These tests make sure that <code>repeat(auto-fill|auto-fit, ...)</code> floors zero-sized tracks for track count calculations.</p>
<p>Subtest 1: <code>repeat(auto-fit, 0)</code></p>
<div id="test-1"></div>
<p>Subtest 2: <code>repeat(auto-fit, minmax(0, 1fr))</code></p>
<div id="test-2">
<div style="background: red;">.</div>
<div style="background: lime;">.</div>
<div style="background: blue;">.</div>
</div>
<p>Subtest 3: <code>repeat(auto-fill, minmax(0, 0))</code></p>
<div id="test-3"></div>
<script>
var test1 = document.getElementById("test-1");
test(
() => {
assert_greater_than(window.getComputedStyle(test1)["grid-template-columns"].split("0px").length - 1, 1);
},
"Subtest #1: Check for at least two zero-sized tracks"
);
var test2 = document.getElementById("test-2");
test(
() => {
assert_equals(window.getComputedStyle(test2)["grid-template-columns"].split("20px").length - 1, 3);
},
"Subtest #2: Check for three tracks 20px each"
);
var test3 = document.getElementById("test-3");
test(
() => {
assert_greater_than(window.getComputedStyle(test3)["grid-template-rows"].split("0px").length - 1, 1);
},
"Subtest #3: Check for at least two zero-sized tracks"
);
</script>
</html>