From ab9eea518d223d98b581778f80beed0c235d14cb Mon Sep 17 00:00:00 2001 From: Christopher Lambacher Date: Fri, 14 Sep 2012 11:24:10 -0400 Subject: [PATCH] Fix options with value="" get selected Closes issue #3 --- formencode/htmlfill.py | 4 ++-- tests/test_htmlfill.py | 28 ++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/formencode/htmlfill.py b/formencode/htmlfill.py index b46c44ae..717e65a4 100644 --- a/formencode/htmlfill.py +++ b/formencode/htmlfill.py @@ -521,7 +521,7 @@ def handle_option(self, attrs): " + +""" + expected_html = """ + +""" + rendered_html = htmlfill.render(html, defaults={"select-1": ""}) + assert expected_html == rendered_html, rendered_html + +def test_select_empty_option_value_not_selected(): + html = """ + +""" + expected_html = """ + +""" + rendered_html = htmlfill.render(html, defaults={}) + assert expected_html == rendered_html, rendered_html + def test_script_quoting(): html = """