fix issue rendering strips with missing style

This commit is contained in:
Will McGugan
2025-09-07 10:58:56 +01:00
parent 43485ed8bd
commit 8e67ce25d4
3 changed files with 14 additions and 2 deletions

View File

@@ -29,6 +29,8 @@ from textual.pilot import Pilot
from textual.reactive import var
from textual.renderables.gradient import LinearGradient
from textual.screen import ModalScreen, Screen
from textual.strip import Strip
from textual.widget import Widget
from textual.widgets import (
Button,
Collapsible,

View File

@@ -1,4 +1,5 @@
import pytest
from rich.console import Console
from rich.segment import Segment
from rich.style import Style
@@ -196,3 +197,9 @@ def test_text():
assert Strip([]).text == ""
assert Strip([Segment("foo")]).text == "foo"
assert Strip([Segment("foo"), Segment("bar")]).text == "foobar"
def test_render_with_missing_style() -> None:
"""Test that render with segments that omit a style still work."""
strip = Strip([Segment("Hello")])
assert strip.render(Console()) == "Hello"