summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-flexbox/text-as-flexitem-size-001.html
blob: 6d621bbb5b2eea95bbeaba556b1a7ed292c3549f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<!DOCTYPE html>
<!--
     Any copyright is dedicated to the Public Domain.
     http://creativecommons.org/publicdomain/zero/1.0/

     This test is a text-based variant of text-as-flexitem-size-001.
     (Not sure if all these variants are needed without an aspect ratio,
     but seemed best to keep it in parallel as much as reasonable.)
-->
<html>
  <head>
    <meta charset="utf-8">
    <title>
      CSS Test: Testing how explicit main-size & cross-size constraints
      influence sizing on non-stretched flex item containing text.
    </title>
    <link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com">
    <link rel="author" title="David Grogan" href="mailto:dgrogan@chromium.org">
    <link rel="author" title="Elika J. Etemad" href="http://inkedblade.net/contact">
    <link rel="help" href="https://www.w3.org/TR/css-flexbox-1/#hypothetical-main-size">
    <link rel="help" href="https://www.w3.org/TR/css-flexbox-1/#hypothetical-cross-size">
    <style>
      @import "/fonts/ahem.css";
      .flexbox {
        display: flex;
        flex-direction: row;
        border: 1px solid black;
        margin: 0 2px 2px 0; /* (Just for spacing things out, visually) */
        width: 80px;
        height: 50px;

        justify-content: flex-start;
        align-items: flex-start;

        float: left; /* For testing in "rows" */
      }
      br { clear: both; }

      .flexbox > * {
        /* Disable "min-width:auto"/"min-height:auto" to focus purely on
           later channels of influence. */
        min-width: 0;
        min-height: 0;
        background: orange;
      }

      .flexbox p {
        font: 10px/1 Ahem, monospace;
        margin: 0.5em;
        color: #0006;
      }
      /* Depending on wrapping, flex item content will be 35px or 45px tall,
         min-content width = 40px and max-content width = 70px */
    </style>
    <script src="/resources/testharness.js"></script>
    <script src="/resources/testharnessreport.js"></script>
    <script src="/resources/check-layout-th.js"></script>
  </head>
  <body onload="checkLayout('.flexbox > div')">
    <!-- Row 1: no special sizing: -->
    <div class="flexbox">
      <div data-expected-width="70" data-expected-height="35">
        <p>xx xxx</p>
        <p>xx</p>
      </div>
    </div>
    <div class="flexbox" style="width: 50px">
      <div data-expected-width="50" data-expected-height="45">
        <p>xx xxx</p>
        <p>xx</p>
      </div>
    </div>
    <div class="flexbox" style="width: 20px">
      <div data-expected-width="20" data-expected-height="45">
        <p>xx xxx</p>
        <p>xx</p>
      </div>
    </div>
    <br>

    <!-- Row 2: Specified main-size, cross-size, or flex-basis: -->
    <div class="flexbox">
      <div style="width: 30px"
           data-expected-width="30" data-expected-height="45">
        <p>xx xxx</p>
        <p>xx</p>
      </div>
    </div>
    <div class="flexbox">
      <div style="height: 30px"
           data-expected-width="70" data-expected-height="30">
        <p>xx xxx</p>
        <p>xx</p>
      </div>
    </div>
    <div class="flexbox">
      <div style="flex: 0 0 30px"
           data-expected-width="30" data-expected-height="45">
        <p>xx xxx</p>
        <p>xx</p>
      </div>
    </div>
    <br>

    <!-- Row 3: min main-size OR min cross-size, or both -->
    <div class="flexbox">
      <div style="min-width: 75px"
           data-expected-width="75" data-expected-height="35">
        <p>xx xxx</p>
        <p>xx</p>
      </div>
    </div>
    <div class="flexbox">
      <div style="min-height: 40px"
           data-expected-width="70" data-expected-height="40">
        <p>xx xxx</p>
        <p>xx</p>
      </div>
    </div>
    <div class="flexbox">
      <div style="min-width: 75px; min-height: 40px"
           data-expected-width="75" data-expected-height="40">
        <p>xx xxx</p>
        <p>xx</p>
      </div>
    </div>
    <br>

    <!-- Row 4: max main-size OR max cross-size, or both -->
    <div class="flexbox">
      <div style="max-width: 20px"
           data-expected-width="20" data-expected-height="45">
        <p>xx xxx</p>
        <p>xx</p>
      </div>
    </div>
    <div class="flexbox">
      <div style="max-height: 20px"
           data-expected-width="70" data-expected-height="20">
        <p>xx xxx</p>
        <p>xx</p>
      </div>
    </div>
    <div class="flexbox">
      <div style="max-width: 20px; max-height: 20px"
           data-expected-width="20" data-expected-height="20">
        <p>xx xxx</p>
        <p>xx</p>
      </div>
    </div>
    <br>

    <!-- Row 5: min main-size vs. max cross-size, & vice versa -->
    <div class="flexbox">
      <div style="min-width: 70px; max-height: 20px"
           data-expected-width="70" data-expected-height="20">
        <p>xx xxx</p>
        <p>xx</p>
      </div>
    </div>
    <div class="flexbox">
      <div style="max-width: 20px; min-height: 50px"
           data-expected-width="20" data-expected-height="50">
        <p>xx xxx</p>
        <p>xx</p>
      </div>
    </div>
    <br>

    <!-- Row 6: min|max main-size vs. explicit cross-size, & vice versa -->
    <div class="flexbox">
      <div style="min-width: 70px; height: 20px"
           data-expected-width="70" data-expected-height="20">
        <p>xx xxx</p>
        <p>xx</p>
      </div>
    </div>
    <div class="flexbox">
      <div style="width: 40px; max-height: 20px"
           data-expected-width="40" data-expected-height="20">
        <p>xx xxx</p>
        <p>xx</p>
      </div>
    </div>
    <div class="flexbox">
      <div style="max-width: 20px; height: 20px"
           data-expected-width="20" data-expected-height="20">
        <p>xx xxx</p>
        <p>xx</p>
      </div>
    </div>
    <div class="flexbox">
      <div style="width: 20px; min-height: 20px"
           data-expected-width="20" data-expected-height="45">
        <p>xx xxx</p>
        <p>xx</p>
      </div>
    </div>
  </body>
</html>