From 97e1160be51e4dfdf35e6ba9d93eff5a52bccbe3 Mon Sep 17 00:00:00 2001
From: Claude Paroz
Date: Fri, 22 May 2015 09:15:46 +0200
Subject: [PATCH] Refs #9230 -- Added complementary tests for widget iterations
---
tests/forms_tests/tests/test_forms.py | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py
index 056dbad296..690f205680 100644
--- a/tests/forms_tests/tests/test_forms.py
+++ b/tests/forms_tests/tests/test_forms.py
@@ -446,6 +446,13 @@ class FormsTestCase(SimpleTestCase):
""")
+ # Test iterating on individual radios in a template
+ t = Template('{% for radio in form.language %}
{{ radio }}
{% endfor %}')
+ self.assertHTMLEqual(t.render(Context({'form': f})), """
+""")
+
def test_form_with_iterable_boundfield(self):
class BeatleForm(Form):
name = ChoiceField(choices=[('john', 'John'), ('paul', 'Paul'), ('george', 'George'), ('ringo', 'Ringo')], widget=RadioSelect)
@@ -538,6 +545,12 @@ class FormsTestCase(SimpleTestCase):
""")
+ # Test iterating on individual checkboxes in a template
+ t = Template('{% for checkbox in form.composers %}
{{ checkbox }}
{% endfor %}')
+ self.assertHTMLEqual(t.render(Context({'form': f})), """
+""")
def test_checkbox_auto_id(self):
# Regarding auto_id, CheckboxSelectMultiple is a special case. Each checkbox