chromium/third_party/blink/web_tests/external/wpt/css/css-grid/grid-items/grid-items-minimum-width-001.html

<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Grid Layout Test: Mininum width of grid items</title>
<link rel="author" title="Manuel Rego Casasnovas" href="mailto:[email protected]">
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#grid-items">
<meta name="assert" content="Checks that grid items minimum width takes into account borders, padding and margins for grid containers with definite width.">
<link rel="stylesheet" href="/css/support/grid.css">
<style>
.grid {
  width: 100px;
  border: solid thick;
  grid: 10px 10px / minmax(auto, 0px);
}

.grid > div:nth-child(1) { background: cyan; }
.grid > div:nth-child(2) { background: magenta; }

.width60 { width: 60px; }
.minWidth60 { min-width: 60px; }

.marginLeft5 { margin-left: 5px; }
.marginRight10 { margin-right: 10px; }

.paddingLeft6 { padding-left: 6px; }
.paddingRight3 { padding-right: 3px; }

.borderLeft2, .borderRight4 { border: solid yellow 0px; }
.borderLeft2 { border-left-width: 2px; }
.borderRight4 { border-right-width: 4px; }
</style>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script>

<body onload="checkLayout('.grid')">

<div id="log"></div>

<h3>Direction LTR</h3>

<pre>Item width: 60px;</pre>

<div class="grid">
  <div class="width60" data-expected-width="60"></div>
  <div data-expected-width="60"></div>
</div>

<pre>Item min-width: 60px;</pre>

<div class="grid">
  <div class="minWidth60" data-expected-width="60"></div>
  <div data-expected-width="60"></div>
</div>

<pre>Item width: 60px; &amp; margin-left: 5px;</pre>

<div class="grid">
  <div class="width60 marginLeft5" data-expected-width="60"></div>
  <div data-expected-width="65"></div>
</div>

<pre>Item min-width: 60px; &amp; margin-left: 5px;</pre>

<div class="grid">
  <div class="minWidth60 marginLeft5" data-expected-width="60"></div>
  <div data-expected-width="65"></div>
</div>

<pre>Item width: 60px; &amp; margin-right: 10px;</pre>

<div class="grid">
  <div class="width60 marginRight10" data-expected-width="60"></div>
  <div data-expected-width="70"></div>
</div>

<pre>Item min-width: 60px; &amp; margin-right: 10px;</pre>

<div class="grid">
  <div class="minWidth60 marginRight10" data-expected-width="60"></div>
  <div data-expected-width="70"></div>
</div>

<pre>Item width: 60px; &amp; margin-left: 5px; &amp; margin-right: 10px;</pre>

<div class="grid">
  <div class="width60 marginLeft5 marginRight10" data-expected-width="60"></div>
  <div data-expected-width="75"></div>
</div>

<pre>Item min-width: 60px; &amp; margin-left: 5px; &amp; margin-right: 10px;</pre>

<div class="grid">
  <div class="minWidth60 marginLeft5 marginRight10" data-expected-width="60"></div>
  <div data-expected-width="75"></div>
</div>

<pre>Item width: 60px; &amp; padding-left: 6px;</pre>

<div class="grid">
  <div class="width60 paddingLeft6" data-expected-width="66"></div>
  <div data-expected-width="66"></div>
</div>

<pre>Item min-width: 60px; &amp; padding-left: 6px;</pre>

<div class="grid">
  <div class="minWidth60 paddingLeft6" data-expected-width="66"></div>
  <div data-expected-width="66"></div>
</div>

<pre>Item width: 60px; &amp; padding-right: 3px;</pre>

<div class="grid">
  <div class="width60 paddingRight3" data-expected-width="63"></div>
  <div data-expected-width="63"></div>
</div>

<pre>Item min-width: 60px; &amp; padding-right: 3px;</pre>

<div class="grid">
  <div class="minWidth60 paddingRight3" data-expected-width="63"></div>
  <div data-expected-width="63"></div>
</div>

<pre>Item width: 60px; &amp; padding-left: 6px; &amp; padding-right: 3px;</pre>

<div class="grid">
  <div class="width60 paddingLeft6 paddingRight3" data-expected-width="69"></div>
  <div data-expected-width="69"></div>
</div>

<pre>Item min-width: 60px; &amp; padding-left: 6px; &amp; padding-right: 3px;</pre>

<div class="grid">
  <div class="minWidth60 paddingLeft6 paddingRight3" data-expected-width="69"></div>
  <div data-expected-width="69"></div>
</div>

<pre>Item width: 60px; &amp; border-left-width: 2px;</pre>

<div class="grid">
  <div class="width60 borderLeft2" data-expected-width="62"></div>
  <div data-expected-width="62"></div>
</div>

<pre>Item min-width: 60px; &amp; border-left-width: 2px;</pre>

<div class="grid">
  <div class="minWidth60 borderLeft2" data-expected-width="62"></div>
  <div data-expected-width="62"></div>
</div>

<pre>Item width: 60px; &amp; border-right-width: 4px;</pre>

<div class="grid">
  <div class="width60 borderRight4" data-expected-width="64"></div>
  <div data-expected-width="64"></div>
</div>

<pre>Item min-width: 60px; &amp; border-right-width: 4px;</pre>

<div class="grid">
  <div class="minWidth60 borderRight4" data-expected-width="64"></div>
  <div data-expected-width="64"></div>
</div>

<pre>Item width: 60px; &amp; border-left-width: 2px; &amp; border-right-width: 4px;</pre>

<div class="grid">
  <div class="width60 borderLeft2 borderRight4" data-expected-width="66"></div>
  <div data-expected-width="66"></div>
</div>

<pre>Item min-width: 60px; &amp; border-left-width: 2px; &amp; border-right-width: 4px;</pre>

<div class="grid">
  <div class="minWidth60 borderLeft2 borderRight4" data-expected-width="66"></div>
  <div data-expected-width="66"></div>
</div>

<pre>Item width: 60px; &amp; margin-left: 5px; &amp; margin-right: 10px; &amp; padding-left: 6px; &amp; padding-right: 3px; &amp; border-left-width: 2px; &amp; border-right-width: 4px;</pre>

<div class="grid">
  <div class="width60 marginLeft5 marginRight10 paddingLeft6 paddingRight3 borderLeft2 borderRight4" data-expected-width="75"></div>
  <div data-expected-width="90"></div>
</div>

<pre>Item min-width: 60px; &amp; margin-left: 5px; &amp; margin-right: 10px; &amp; padding-left: 6px; &amp; padding-right: 3px; &amp; border-left-width: 2px; &amp; border-right-width: 4px;</pre>

<div class="grid">
  <div class="minWidth60 marginLeft5 marginRight10 paddingLeft6 paddingRight3 borderLeft2 borderRight4" data-expected-width="75"></div>
  <div data-expected-width="90"></div>
</div>

<h3>Direction RTL</h3>

<pre>Item width: 60px;</pre>

<div class="grid directionRTL">
  <div class="width60" data-expected-width="60"></div>
  <div data-expected-width="60"></div>
</div>

<pre>Item min-width: 60px;</pre>

<div class="grid directionRTL">
  <div class="minWidth60" data-expected-width="60"></div>
  <div data-expected-width="60"></div>
</div>

<pre>Item width: 60px; &amp; margin-left: 5px;</pre>

<div class="grid directionRTL">
  <div class="width60 marginLeft5" data-expected-width="60"></div>
  <div data-expected-width="65"></div>
</div>

<pre>Item min-width: 60px; &amp; margin-left: 5px;</pre>

<div class="grid directionRTL">
  <div class="minWidth60 marginLeft5" data-expected-width="60"></div>
  <div data-expected-width="65"></div>
</div>

<pre>Item width: 60px; &amp; margin-right: 10px;</pre>

<div class="grid directionRTL">
  <div class="width60 marginRight10" data-expected-width="60"></div>
  <div data-expected-width="70"></div>
</div>

<pre>Item min-width: 60px; &amp; margin-right: 10px;</pre>

<div class="grid directionRTL">
  <div class="minWidth60 marginRight10" data-expected-width="60"></div>
  <div data-expected-width="70"></div>
</div>

<pre>Item width: 60px; &amp; margin-left: 5px; &amp; margin-right: 10px;</pre>

<div class="grid directionRTL">
  <div class="width60 marginLeft5 marginRight10" data-expected-width="60"></div>
  <div data-expected-width="75"></div>
</div>

<pre>Item min-width: 60px; &amp; margin-left: 5px; &amp; margin-right: 10px;</pre>

<div class="grid directionRTL">
  <div class="minWidth60 marginLeft5 marginRight10" data-expected-width="60"></div>
  <div data-expected-width="75"></div>
</div>

<pre>Item width: 60px; &amp; padding-left: 6px;</pre>

<div class="grid directionRTL">
  <div class="width60 paddingLeft6" data-expected-width="66"></div>
  <div data-expected-width="66"></div>
</div>

<pre>Item min-width: 60px; &amp; padding-left: 6px;</pre>

<div class="grid directionRTL">
  <div class="minWidth60 paddingLeft6" data-expected-width="66"></div>
  <div data-expected-width="66"></div>
</div>

<pre>Item width: 60px; &amp; padding-right: 3px;</pre>

<div class="grid directionRTL">
  <div class="width60 paddingRight3" data-expected-width="63"></div>
  <div data-expected-width="63"></div>
</div>

<pre>Item min-width: 60px; &amp; padding-right: 3px;</pre>

<div class="grid directionRTL">
  <div class="minWidth60 paddingRight3" data-expected-width="63"></div>
  <div data-expected-width="63"></div>
</div>

<pre>Item width: 60px; &amp; padding-left: 6px; &amp; padding-right: 3px;</pre>

<div class="grid directionRTL">
  <div class="width60 paddingLeft6 paddingRight3" data-expected-width="69"></div>
  <div data-expected-width="69"></div>
</div>

<pre>Item min-width: 60px; &amp; padding-left: 6px; &amp; padding-right: 3px;</pre>

<div class="grid directionRTL">
  <div class="minWidth60 paddingLeft6 paddingRight3" data-expected-width="69"></div>
  <div data-expected-width="69"></div>
</div>

<pre>Item width: 60px; &amp; border-left-width: 2px;</pre>

<div class="grid directionRTL">
  <div class="width60 borderLeft2" data-expected-width="62"></div>
  <div data-expected-width="62"></div>
</div>

<pre>Item min-width: 60px; &amp; border-left-width: 2px;</pre>

<div class="grid directionRTL">
  <div class="minWidth60 borderLeft2" data-expected-width="62"></div>
  <div data-expected-width="62"></div>
</div>

<pre>Item width: 60px; &amp; border-right-width: 4px;</pre>

<div class="grid directionRTL">
  <div class="width60 borderRight4" data-expected-width="64"></div>
  <div data-expected-width="64"></div>
</div>

<pre>Item min-width: 60px; &amp; border-right-width: 4px;</pre>

<div class="grid directionRTL">
  <div class="minWidth60 borderRight4" data-expected-width="64"></div>
  <div data-expected-width="64"></div>
</div>

<pre>Item width: 60px; &amp; border-left-width: 2px; &amp; border-right-width: 4px;</pre>

<div class="grid directionRTL">
  <div class="width60 borderLeft2 borderRight4" data-expected-width="66"></div>
  <div data-expected-width="66"></div>
</div>

<pre>Item min-width: 60px; &amp; border-left-width: 2px; &amp; border-right-width: 4px;</pre>

<div class="grid directionRTL">
  <div class="minWidth60 borderLeft2 borderRight4" data-expected-width="66"></div>
  <div data-expected-width="66"></div>
</div>

<pre>Item width: 60px; &amp; margin-left: 5px; &amp; margin-right: 10px; &amp; padding-left: 6px; &amp; padding-right: 3px; &amp; border-left-width: 2px; &amp; border-right-width: 4px;</pre>

<div class="grid directionRTL">
  <div class="width60 marginLeft5 marginRight10 paddingLeft6 paddingRight3 borderLeft2 borderRight4" data-expected-width="75"></div>
  <div data-expected-width="90"></div>
</div>

<pre>Item min-width: 60px; &amp; margin-left: 5px; &amp; margin-right: 10px; &amp; padding-left: 6px; &amp; padding-right: 3px; &amp; border-left-width: 2px; &amp; border-right-width: 4px;</pre>

<div class="grid directionRTL">
  <div class="minWidth60 marginLeft5 marginRight10 paddingLeft6 paddingRight3 borderLeft2 borderRight4" data-expected-width="75"></div>
  <div data-expected-width="90"></div>
</div>