mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
This is still a work-in-progress, but this feels like a good point to commit for safe keeping. This is a non-working WIP.
23 lines
764 B
Python
23 lines
764 B
Python
from textual.widget import Widget
|
|
|
|
class Content(Widget):
|
|
pass
|
|
|
|
class Body(Widget):
|
|
pass
|
|
|
|
def test_find_dom_spot():
|
|
screen = Widget(name="Screen")
|
|
header = Widget(name="Header", id="header")
|
|
body = Body(id="body")
|
|
content = [ Content(id=f"item{n}") for n in range(1000)]
|
|
body._add_children(*content)
|
|
footer = Widget(name="Footer", id="footer")
|
|
screen._add_children(header, body, footer)
|
|
assert list(screen.children) == [header,body,footer]
|
|
assert screen._find_spot(None) == (screen,-1)
|
|
assert screen._find_spot(1) == (screen, 1)
|
|
assert screen._find_spot(body) == screen._find_spot(1)
|
|
assert screen._find_spot("Body") == screen._find_spot(body)
|
|
assert screen._find_spot("#body") == screen._find_spot(1)
|