from cjm_fasthtml_keyboard_navigation.core.focus_zone import FocusZone
from cjm_fasthtml_keyboard_navigation.core.actions import KeyAction
from cjm_fasthtml_keyboard_navigation.core.manager import ZoneManager
# Build a test manager with two zones and some actions
z1 = FocusZone(id="seg")
z2 = FocusZone(id="align")
test_manager = ZoneManager(
zones=(z1, z2),
actions=(
KeyAction(key="Enter", js_callback="x", description="Enter split mode", hint_group="Editing"),
KeyAction(key="Escape", js_callback="x", description="Exit split mode", hint_group="Editing"),
KeyAction(key="Backspace", htmx_trigger="x", description="Merge with previous", hint_group="Editing"),
KeyAction(key="z", modifiers=frozenset({"ctrl"}), htmx_trigger="x", description="Undo", hint_group="Editing"),
KeyAction(key=" ", js_callback="x", description="Play audio", hint_group="Audio"),
),
prev_zone_key="ArrowLeft",
next_zone_key="ArrowRight",
)
body_html = to_xml(_render_modal_body(test_manager))
assert "Navigation" in body_html
assert "Navigate items" in body_html
assert "Switch panel" in body_html
assert "Editing" in body_html
assert "Enter split mode" in body_html
assert "Audio" in body_html
assert "Play audio" in body_html
print("Modal body tests passed")