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:
            
- /css/css-grid/masonry/tentative/track-sizing/auto-repeat/intrinsic-auto-repeat/row-auto-repeat-auto-020.html - WPT Dashboard Interop Dashboard
 
 
<!DOCTYPE html>
<html>
<title>Auto-fit repeat tracks with auto size and auto item placement</title>
<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(5, 100px) repeat(auto-fit, auto);
    width: 200px;
    height: 1000px;
}
.masonry > div {
    height: 100px;
    width: 100px;
}
</style>
<div class="masonry">
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
  <div></div>
</div>
<script>
  test(function() {
    const container = document.querySelector('.masonry');
    const computedStyle = window.getComputedStyle(container);
    // The last auto-fit row is 500px because it stretches to fill the remaining
    // space.
    assert_equals(computedStyle.getPropertyValue('grid-template-rows'),
      "100px 100px 100px 100px 100px 500px 0px 0px 0px 0px");
  });
</script>
</html>