I can bind checkbox

This commit is contained in:
2025-11-07 22:27:32 +01:00
parent e8ecf72205
commit 6a05a84f0c
5 changed files with 108 additions and 39 deletions

View File

@@ -44,7 +44,7 @@ def test_i_can_check_checkbox(test_client, rt):
html = '''<input type="checkbox" name="male" hx_post="/submit"/>'''
@rt('/submit')
def post(male: bool):
def post(male: bool=None):
return f"Checkbox received {male=}"
input_elt = TestableCheckbox(test_client, html)
@@ -53,7 +53,7 @@ def test_i_can_check_checkbox(test_client, rt):
assert test_client.get_content() == "Checkbox received male=True"
input_elt.uncheck()
assert test_client.get_content() == "Checkbox received male=False"
assert test_client.get_content() == "Checkbox received male=None"
input_elt.toggle()
assert test_client.get_content() == "Checkbox received male=True"