feat: templates

This commit is contained in:
2026-04-01 07:50:43 +02:00
parent b40c6436cd
commit df11705875
10 changed files with 589 additions and 19 deletions

View File

@@ -168,6 +168,37 @@ def test_status():
assert "Server" in result.ascii
def test_table():
source = '''page "Demo" 50
table "Routes"
columns "Destination" 20 | "Hops" 6 | "Status" 10
row "relay-east" | "2" | "alive"
row "bridge-south" | "4" | "alive"
row "node-gamma" | "7" | "stale"'''
result = uframe.compile(source)
assert "" in result.ascii
assert "" in result.ascii # column separators at header line
assert "Destination" in result.ascii
assert "relay-east" in result.ascii
assert "bridge-south" in result.ascii
assert "stale" in result.ascii
# Should have proper structure
lines = result.ascii.split("\n")
assert len(lines) >= 6 # top border + header + sep + 3 rows + bottom border
def test_table_with_color():
source = '''page "Demo" 50
table "Peers"
columns "Name" 16 | "State" 12
row "east-relay" | "@color{0f0}{● alive}"
row "node-gamma" | "@color{f00}{○ stale}"'''
result = uframe.compile(source)
assert "" in result.ascii
assert "" in result.ascii
assert "`F0f0" in result.micron # green color tag
def test_full_dashboard():
"""Integration test: a realistic dashboard layout."""
source = '''page "Node Status" 60