blob: 270d5fdc9ceb29d22ec0dea8bd33bf6eb70adaca [file] [log] [blame]
ojan@chromium.org897876a2012-08-06 19:17:20 +00001<!DOCTYPE html>
2<html>
tony@chromium.orgda559b22012-10-05 04:37:39 +00003<link href="resources/flexbox.css" rel="stylesheet">
ojan@chromium.org897876a2012-08-06 19:17:20 +00004<style>
5.flexbox {
ojan@chromium.org897876a2012-08-06 19:17:20 +00006 border: 2px solid orange;
7}
ojan@chromium.org897876a2012-08-06 19:17:20 +00008.h3 {
9 height: 300px;
10}
11.w3 {
12 width: 300px;
13}
14.h4 {
15 height: 400px;
16}
17.w4 {
18 width: 400px;
19}
20.border-box, .flexbox > div {
21 box-sizing: border-box;
22 height: 100px;
23 width: 100px;
24 border: 2px solid lightblue;
25 border-top-width: 4px;
26 padding: 3px;
27}
28</style>
hyatt@apple.com247170f2017-02-28 16:23:15 +000029<script src="../../resources/testharness.js"></script>
30<script src="../../resources/testharnessreport.js"></script>
31<script src="../../resources/check-layout-th.js"></script>
ojan@chromium.org897876a2012-08-06 19:17:20 +000032<body onload="checkLayout('.flexbox')">
hyatt@apple.com247170f2017-02-28 16:23:15 +000033<div id=log></div>
ojan@chromium.org897876a2012-08-06 19:17:20 +000034
35All blue boxes are 100x100px with box-sizing: border-box and 2px border (4px border-top), we expect offsetWidth/Height to be <b>100x100</b>
36
37<h3>flex-flow: default, orange box has width: 300px</h3>
38<div class="flexbox" style="width: 300px">
39 <div></div><div></div><div></div>
40</div>
41
42<h3>flex-flow: default, orange box has width: 400px</h3>
43<div class="flexbox" style="width: 400px">
44 <div></div><div></div><div></div>
45</div>
46
47<h3>flex-flow: default, orange box has width: auto</h3>
48<div class="flexbox">
49 <div></div><div></div><div></div>
50</div>
51
52<h3>flex-flow: default, orange box has width: auto, flex-box has box-sizing: border-box</h3>
53<div class="flexbox border-box">
ojan@chromium.org6efd34e2013-03-29 20:12:16 +000054 <div data-expected-width=30></div>
55 <div data-expected-width=30></div>
56 <div data-expected-width=30></div>
ojan@chromium.org897876a2012-08-06 19:17:20 +000057</div>
58
59<h3>flex-flow: column, red box has height: 300px</h3>
60<div class="flexbox column" style="height: 300px">
61 <div></div><div></div><div></div>
62</div>
63
64<h3>flex-flow: column, red box has height: 400px</h3>
65<div class="flexbox column" style="height: 400px">
66 <div></div><div></div><div></div>
67</div>
68
69<h3>flex-flow: column, red box has height: auto</h3>
70<div class="flexbox column">
71 <div></div><div></div><div></div>
72</div>
73
74<h3>flex-box has box-sizing: border-box and flex-wrap: wrap;</h3>
tony@chromium.orgda559b22012-10-05 04:37:39 +000075<div class="flexbox column wrap" style="box-sizing: border-box; border: 2px solid lightblue; padding: 3px; height: 200px; width: 100px; position: relative" data-expected-width=100 data-expected-height=200>
ojan@chromium.org897876a2012-08-06 19:17:20 +000076 <div data-offset-x=3></div><div data-offset-x=103></div><div data-offset-x=203></div>
77</div>
78
79<h3>flex-box has box-sizing: default and flex-wrap: wrap;</h3>
tony@chromium.orgda559b22012-10-05 04:37:39 +000080<div class="flexbox column wrap" style="border: 2px solid lightblue; padding: 3px; height: 200px; width: 100px; position: relative" data-expected-width=110 data-expected-height=210>
ojan@chromium.org897876a2012-08-06 19:17:20 +000081 <div data-offset-x=3></div><div data-offset-x=3></div><div data-offset-x=103></div>
82</div>
83
84<h3>flex-flow: column, flex-box has box-sizing: border-box, flex items have flex: 1</h3>
85<div class="flexbox column" style="box-sizing: border-box; border: 2px solid lightblue; padding: 3px; height: 343px; width: 100px;" data-expected-width=100 data-expected-height=343>
hyatt@apple.com247170f2017-02-28 16:23:15 +000086 <div style="flex: 1;" data-expected-height=111></div>
87 <div style="flex: 1;" data-expected-height=111></div>
88 <div style="flex: 1;" data-expected-height=111></div>
ojan@chromium.org897876a2012-08-06 19:17:20 +000089</div>
90
91<script>
92 function addExpectedSizes(flexItem) {
93 if (!flexItem.hasAttribute('data-expected-height'))
94 flexItem.setAttribute('data-expected-height', 100);
95 if (!flexItem.hasAttribute('data-expected-width'))
96 flexItem.setAttribute('data-expected-width', 100);
97 }
98 [].forEach.call(document.querySelectorAll(".flexbox > div"), addExpectedSizes);
99 [].forEach.call(document.querySelectorAll(".border-box"), addExpectedSizes);
ojan@chromium.org897876a2012-08-06 19:17:20 +0000100</script>
101</body>
102</html>