feat: dynamic mode
This commit is contained in:
@@ -199,6 +199,61 @@ def test_table_with_color():
|
||||
assert "`F0f0" in result.micron # green color tag
|
||||
|
||||
|
||||
def test_form_field():
|
||||
source = '''page "Demo" 50
|
||||
form "test"
|
||||
field "name" 20 "Enter name..."'''
|
||||
result = uframe.compile(source)
|
||||
assert "name:" in result.ascii
|
||||
assert "[" in result.ascii
|
||||
assert "]" in result.ascii
|
||||
# Micron should have form tag
|
||||
assert "`<" in result.micron or "<" in result.micron
|
||||
|
||||
|
||||
def test_form_radio():
|
||||
source = '''page "Demo" 50
|
||||
form "test"
|
||||
radio "mode" "Ping" | "Trace" | "Page"'''
|
||||
result = uframe.compile(source)
|
||||
assert "(•)" in result.ascii # first option selected
|
||||
assert "( )" in result.ascii # other options unselected
|
||||
assert "Ping" in result.ascii
|
||||
assert "Trace" in result.ascii
|
||||
|
||||
|
||||
def test_form_checkbox():
|
||||
source = '''page "Demo" 50
|
||||
form "test"
|
||||
checkbox "agree" "I agree to terms"'''
|
||||
result = uframe.compile(source)
|
||||
assert "[ ]" in result.ascii
|
||||
assert "I agree to terms" in result.ascii
|
||||
|
||||
|
||||
def test_form_button():
|
||||
source = '''page "Demo" 50
|
||||
form "test"
|
||||
button "Submit" "/page/submit.mu"'''
|
||||
result = uframe.compile(source)
|
||||
assert "Submit" in result.ascii
|
||||
assert "submit.mu" in result.micron
|
||||
|
||||
|
||||
def test_form_complete():
|
||||
source = '''page "Search" 50
|
||||
form "search"
|
||||
field "query" 24 "Search term..."
|
||||
radio "scope" "Local" | "Network"
|
||||
checkbox "cache" "Include cached"
|
||||
button "Go" "/page/search.mu"'''
|
||||
result = uframe.compile(source)
|
||||
assert "query:" in result.ascii
|
||||
assert "(•)" in result.ascii
|
||||
assert "[ ]" in result.ascii
|
||||
assert "Go" in result.ascii
|
||||
|
||||
|
||||
def test_full_dashboard():
|
||||
"""Integration test: a realistic dashboard layout."""
|
||||
source = '''page "Node Status" 60
|
||||
|
||||
Reference in New Issue
Block a user