diff --git a/tests/regressiontests/forms/tests.py b/tests/regressiontests/forms/tests.py index 1fc6b3253f..16d71edd55 100644 --- a/tests/regressiontests/forms/tests.py +++ b/tests/regressiontests/forms/tests.py @@ -106,6 +106,46 @@ u'' +# MultipleHiddenInput Widget ################################################## + +>>> w = MultipleHiddenInput() +>>> w.render('email', []) +u'' +>>> w.render('email', None) +u'' +>>> w.render('email', ['test@example.com']) +u'' +>>> w.render('email', ['some "quoted" & ampersanded value']) +u'' +>>> w.render('email', ['test@example.com', 'foo@example.com']) +u'\n' +>>> w.render('email', ['test@example.com'], attrs={'class': 'fun'}) +u'' +>>> w.render('email', ['test@example.com', 'foo@example.com'], attrs={'class': 'fun'}) +u'\n' + +You can also pass 'attrs' to the constructor: +>>> w = MultipleHiddenInput(attrs={'class': 'fun'}) +>>> w.render('email', []) +u'' +>>> w.render('email', ['foo@example.com']) +u'' +>>> w.render('email', ['foo@example.com', 'test@example.com']) +u'\n' + +'attrs' passed to render() get precedence over those passed to the constructor: +>>> w = MultipleHiddenInput(attrs={'class': 'pretty'}) +>>> w.render('email', ['foo@example.com'], attrs={'class': 'special'}) +u'' + +>>> w.render('email', ['ŠĐĆŽćžšđ'], attrs={'class': 'fun'}) +u'' + +'attrs' passed to render() get precedence over those passed to the constructor: +>>> w = MultipleHiddenInput(attrs={'class': 'pretty'}) +>>> w.render('email', ['foo@example.com'], attrs={'class': 'special'}) +u'' + # FileInput Widget ############################################################ >>> w = FileInput()