summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-flexbox/height-percentage-with-dynamic-container-size.html
blob: 9e13d8b17cd94086a53726385d1f5295e231a69d (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
<!DOCTYPE html>
<meta charset="utf-8">
<title>CSS Flexbox Test: Flex container with height percentage and dynamic container size</title>
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com">
<link rel="help" href="http://www.w3.org/TR/css-flexbox-1">
<meta name="assert" content="Checks that if a flex container has a definite height percentage, but then the height of the container is dynamically changed to be intrinsic, the resolved value of the percentage is correctly updated.">
<style>
.container {
  width: 100px;
  background: cyan;
  height: 200px;
}
.changed .container {
  height: auto;
}
.flex {
  display: flex;
}
.content {
  height: 100px;
  width: 100px;
}
</style>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script>

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

<pre>height: 0%</pre>

<div class="container" data-expected-height="100">
  <div class="flex" style="height: 0%" data-expected-height="100">
    <div data-expected-height="100">
      <div class="content"></div>
    </div>
  </div>
</div>

<pre>height: 100%</pre>

<div class="container" data-expected-height="100">
  <div class="flex" style="height: 100%" data-expected-height="100">
    <div data-expected-height="100">
      <div class="content"></div>
    </div>
  </div>
</div>

<pre>height: 200%</pre>

<div class="container" data-expected-height="100">
  <div class="flex" style="height: 200%" data-expected-height="100">
    <div data-expected-height="100">
      <div class="content"></div>
    </div>
  </div>
</div>

<script>
// Force layout
document.body.offsetLeft;

// Change 'height' to 'auto'.
document.body.classList.add("changed");

// Check final layout
checkLayout('.container');
</script>