gecko/layout/reftests/flexbox/flexbox-minSize-horiz-1.xhtml

72 lines
2.3 KiB
HTML

<?xml version="1.0" encoding="UTF-8"?>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!--
This test checks that we honor the flexbox-specific behavior of the
new "min-width: auto" value that was introduced in the flexbox spec.
We check that flex items can't shrink below their min-content width,
unless we explicitly reduce their min-width with e.g. "min-width: 0".
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style>
div.flexbox {
width: 200px;
display: flex;
margin-bottom: 5px;
font-size: 8px;
border: 1px dotted black;
}
div.flexbox > * {
margin-right: 20px;
border: 1px dashed green;
background: lightblue;
height: 40px;
}
div.smallSize { width: 5px; }
div.smallFlexBasis { flex-basis: 2px; }
div.zeroMinWidth { min-width: 0; }
</style>
</head>
<body>
<!-- Check that we use the min-content width as a lower-bound when sizing
flex items. -->
<div class="flexbox">
<div>abc d e f</div>
<div class="smallSize">abc d e f</div>
<div class="smallFlexBasis">abc d e f</div>
</div>
<!-- ... EVEN if our flex container is small and we're overflowing. -->
<div class="flexbox smallSize">
<div>abc d e f</div>
<div class="smallSize">abc d e f</div>
<div class="smallFlexBasis">abc d e f</div>
</div>
<!-- Test that "min-width: 0" on flex items will keep us from clamping to
the min-content width. (So we can now actually honor small 'width'
and 'flex-basis' values.) -->
<div class="flexbox">
<div class="zeroMinWidth">abc d e f</div>
<div class="zeroMinWidth smallSize">abc d e f</div>
<div class="zeroMinWidth smallFlexBasis">abc d e f</div>
</div>
<!-- ... and similarly, when we have a small flex container and we trigger
shrinking behavior, flex items with "min-width: 0" are allowed to
shrink past their min-content width. -->
<div class="flexbox smallSize">
<div class="zeroMinWidth">abc d e f</div>
<div class="zeroMinWidth smallSize">abc d e f</div>
<div class="zeroMinWidth smallFlexBasis">abc d e f</div>
</div>
</body>
</html>