mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
long placeholder
This commit is contained in:
@@ -4626,3 +4626,27 @@ def test_header_format(snap_compare):
|
||||
yield Header()
|
||||
|
||||
assert snap_compare(HeaderApp())
|
||||
|
||||
|
||||
def test_long_textarea_placeholder(snap_compare) -> None:
|
||||
|
||||
TEXT = """I must not fear.
|
||||
Fear is the mind-killer.
|
||||
Fear is the little-death that brings total obliteration.
|
||||
I will face my fear.
|
||||
I will permit it to pass over me and through me.
|
||||
And when it has gone past, I will turn the inner eye to see its path.
|
||||
Where the fear has gone there will be nothing. Only I will remain."""
|
||||
|
||||
class PlaceholderApp(App):
|
||||
|
||||
CSS = """
|
||||
TextArea {
|
||||
width: 50%;
|
||||
}
|
||||
"""
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
yield TextArea(placeholder=TEXT)
|
||||
|
||||
assert snap_compare(PlaceholderApp())
|
||||
|
||||
@@ -349,3 +349,19 @@ def test_add_spans() -> None:
|
||||
Span(7, 9, style="blue"),
|
||||
]
|
||||
assert content.spans == expected
|
||||
|
||||
|
||||
def test_wrap() -> None:
|
||||
content = Content.from_markup("[green]Hello, [b]World, One two three[/b]")
|
||||
wrapped = content.wrap(6)
|
||||
print(wrapped)
|
||||
expected = [
|
||||
Content("Hello,", spans=[Span(0, 6, style="green")]),
|
||||
Content("World,", spans=[Span(0, 6, style="green"), Span(0, 6, style="b")]),
|
||||
Content("One", spans=[Span(0, 3, style="green"), Span(0, 3, style="b")]),
|
||||
Content("two", spans=[Span(0, 3, style="green"), Span(0, 3, style="b")]),
|
||||
Content("three", spans=[Span(0, 5, style="green"), Span(0, 5, style="b")]),
|
||||
]
|
||||
assert len(wrapped) == len(expected)
|
||||
for line1, line2 in zip(wrapped, expected):
|
||||
assert line1.is_same(line2)
|
||||
|
||||
Reference in New Issue
Block a user