From e63fa0ff832e4a6c18aa9f427b643b3445c5abb0 Mon Sep 17 00:00:00 2001 From: Chris Beaven Date: Sun, 18 Sep 2011 04:09:44 +0000 Subject: Fixes #8103 -- Select widget should only allow for one selected option git-svn-id: http://code.djangoproject.com/svn/django/trunk@16848 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- tests/regressiontests/forms/tests/widgets.py | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'tests/regressiontests/forms') diff --git a/tests/regressiontests/forms/tests/widgets.py b/tests/regressiontests/forms/tests/widgets.py index b4ceb2fcff..e6667f7629 100644 --- a/tests/regressiontests/forms/tests/widgets.py +++ b/tests/regressiontests/forms/tests/widgets.py @@ -12,7 +12,6 @@ from django.utils.translation import activate, deactivate from django.utils.unittest import TestCase - class FormsWidgetTestCase(TestCase): # Each Widget class corresponds to an HTML form widget. A Widget knows how to # render itself, given a field name and some data. Widgets don't perform @@ -255,6 +254,15 @@ class FormsWidgetTestCase(TestCase): +""") + + # Only one option can be selected, see #8103: + self.assertEqual(w.render('choices', '0', choices=(('0', '0'), ('1', '1'), ('2', '2'), ('3', '3'), ('0', 'extra'))), """""") # The value is compared to its str(): @@ -438,6 +446,15 @@ class FormsWidgetTestCase(TestCase): +""") + + # Multiple options (with the same value) can be selected, see #8103: + self.assertEqual(w.render('choices', ['0'], choices=(('0', '0'), ('1', '1'), ('2', '2'), ('3', '3'), ('0', 'extra'))), """""") # If multiple values are given, but some of them are not valid, the valid ones are selected: -- cgit v1.3