File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -327,6 +327,8 @@ def render_border_label(
327327 return
328328
329329 text_label = Text .from_markup (label )
330+ if not text_label .cell_len :
331+ return
330332 text_label .truncate (width - cells_reserved , overflow = "ellipsis" )
331333 segments = text_label .render (console )
332334
Original file line number Diff line number Diff line change @@ -175,6 +175,33 @@ def test_render_border_label_wide_plain(label: str):
175175 assert original_text == Segment (label , _EMPTY_STYLE )
176176
177177
178+ @pytest .mark .parametrize (
179+ "label" ,
180+ [
181+ "[b][/]" ,
182+ "[i b][/]" ,
183+ "[white on red][/]" ,
184+ "[blue]" ,
185+ ],
186+ )
187+ def test_render_border_empty_text_with_markup (label : str ):
188+ """Test label rendering if there is no text but some markup."""
189+ assert [] == list (
190+ render_border_label (
191+ label ,
192+ True ,
193+ "round" ,
194+ 999 ,
195+ _EMPTY_STYLE ,
196+ _EMPTY_STYLE ,
197+ _EMPTY_STYLE ,
198+ _WIDE_CONSOLE ,
199+ True ,
200+ True ,
201+ )
202+ )
203+
204+
178205def test_render_border_label ():
179206 """Test label rendering with styling, with and without overflow."""
180207
You can’t perform that action at this time.
0 commit comments