mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
WIP: Starting work on adding before/after mount directions
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.
This commit is contained in:
22
tests/test_dom_spot.py
Normal file
22
tests/test_dom_spot.py
Normal file
@@ -0,0 +1,22 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user