@@ -100,7 +100,7 @@ def get_auto_height(container: Size, parent: Size, width: int) -> int:
100100
101101
102102def test_height ():
103- """Test width settings."""
103+ """Test height settings."""
104104 styles = Styles ()
105105 one = Fraction (1 )
106106
@@ -123,15 +123,15 @@ def get_auto_height(container: Size, parent: Size, width: int) -> int:
123123 )
124124 assert box_model == BoxModel (Fraction (54 ), Fraction (16 ), Spacing (1 , 2 , 3 , 4 ))
125125
126- # Set width to 100 vw which should make it the width of the parent
126+ # Set height to 100 vw which should make it the height of the parent
127127 styles .height = "100vh"
128128
129129 box_model = get_box_model (
130130 styles , Size (60 , 20 ), Size (80 , 24 ), one , one , get_auto_width , get_auto_height
131131 )
132132 assert box_model == BoxModel (Fraction (54 ), Fraction (24 ), Spacing (1 , 2 , 3 , 4 ))
133133
134- # Set the width to 100% should make it fill the container size
134+ # Set the height to 100% should make it fill the container size
135135 styles .height = "100%"
136136
137137 box_model = get_box_model (
@@ -156,6 +156,14 @@ def get_auto_height(container: Size, parent: Size, width: int) -> int:
156156 )
157157 assert box_model == BoxModel (Fraction (54 ), Fraction (10 ), Spacing (1 , 2 , 3 , 4 ))
158158
159+ # Set height to auto and set content height to 0 to check if box collapses.
160+ styles .height = "auto"
161+
162+ box_model = get_box_model (
163+ styles , Size (60 , 20 ), Size (80 , 24 ), one , one , get_auto_width , lambda * _ : 0
164+ )
165+ assert box_model == BoxModel (Fraction (54 ), Fraction (0 ), Spacing (1 , 2 , 3 , 4 ))
166+
159167
160168def test_max ():
161169 """Check that max_width and max_height are respected."""
0 commit comments