OLD | NEW |
1 <style> | 1 <style> |
2 border-box { | 2 border-box { |
3 background-color: pink; | 3 background-color: pink; |
4 box-sizing: border-box; | 4 box-sizing: border-box; |
5 max-width: 300px; | 5 max-width: 300px; |
6 padding: 0 5%; | 6 padding: 0 5%; |
7 } | 7 } |
8 paragraph { | |
9 display: paragraph; | |
10 } | |
11 </style> | 8 </style> |
12 <container style="width: 400px"> | 9 <container style="width: 400px"> |
13 <border-box> | 10 <border-box> |
14 <paragraph>Even though the width of 'border-box' stays the same after it rea
ches 300px, the width available to its children decreases as its padding continu
es to expand. Because the padding is based off the width before it's constrained
by min/max. This tests that we continue to layout the contents of border-box ev
en when its own width remains the same.</paragraph> | 11 <p>Even though the width of 'border-box' stays the same after it reaches 300
px, the width available to its children decreases as its padding continues to ex
pand. Because the padding is based off the width before it's constrained by min/
max. This tests that we continue to layout the contents of border-box even when
its own width remains the same.</p> |
15 </div> | 12 </div> |
16 </container> | 13 </container> |
17 | 14 |
18 <script> | 15 <script> |
19 import "../resources/third_party/unittest/unittest.dart"; | 16 import "../resources/third_party/unittest/unittest.dart"; |
20 import "../resources/unit.dart"; | 17 import "../resources/unit.dart"; |
21 | 18 |
22 import "dart:sky"; | 19 import "dart:sky"; |
23 | 20 |
24 void main() { | 21 void main() { |
25 initUnit(); | 22 initUnit(); |
26 | 23 |
27 test("paragraph width should shrink", () { | 24 test("paragraph width should shrink", () { |
28 expect(document.querySelector("paragraph").offsetWidth, equals(260)); | 25 expect(document.querySelector("p").offsetWidth, equals(260)); |
29 document.querySelector("container").style["width"] = "800px"; | 26 document.querySelector("container").style["width"] = "800px"; |
30 expect(document.querySelector("paragraph").offsetWidth, equals(220)); | 27 expect(document.querySelector("p").offsetWidth, equals(220)); |
31 }); | 28 }); |
32 } | 29 } |
33 </script> | 30 </script> |
OLD | NEW |