Source code

Revision control

Copy as Markdown

Other Tools

Test Info: Warnings

  • This test has a WPT meta file that expects 1 subtest issues.
  • This WPT test may be referenced by the following Test IDs:
<!DOCTYPE html>
<html>
<title>Auto-fit repeat tracks with auto size and auto item placement</title>
<link rel="help" href="https://drafts.csswg.org/css-grid-3">
<link rel="author" title="Alison Maher" href="mailto:almaher@microsoft.com">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style>
.masonry {
display: masonry;
item-tolerance: 0;
masonry-direction: row;
grid-template-rows: repeat(auto-fit, auto);
width: 200px;
height: 1000px;
}
.masonry > div {
height: 100px;
width: 100px;
}
</style>
<div class="masonry">
<div style="grid-row: 1;"></div>
<div style="grid-row: 3;"></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
<script>
test(function() {
const container = document.querySelector('.masonry');
const computedStyle = window.getComputedStyle(container);
// These don't end up being 100px because auto tracks get stretched at the end of
// track sizing.
assert_equals(computedStyle.getPropertyValue('grid-template-rows'),
"250px 250px 250px 250px 0px 0px 0px 0px 0px 0px");
});
</script>
</html>