|
40 | 40 | )
|
41 | 41 |
|
42 | 42 |
|
43 |
| - |
44 | 43 | class TestForm(forms.Form):
|
45 | 44 | """
|
46 | 45 | Form with a variety of widgets to test bootstrap3 rendering.
|
@@ -207,33 +206,40 @@ def test_bootstrap_javascript_tag(self):
|
207 | 206 | )
|
208 | 207 |
|
209 | 208 | def test_bootstrap_css_tag(self):
|
210 |
| - self.maxDiff = None |
211 |
| - res = render_template_with_form('{% bootstrap_css %}') |
212 |
| - self.assertEqual( |
213 |
| - res.strip(), |
214 |
| - '<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">' |
| 209 | + res = render_template_with_form('{% bootstrap_css %}').strip() |
| 210 | + self.assertIn( |
| 211 | + '<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">', |
| 212 | + res |
| 213 | + ) |
| 214 | + self.assertIn( |
| 215 | + '<link href="//example.com/theme.css" rel="stylesheet">', |
| 216 | + res |
215 | 217 | )
|
216 | 218 |
|
217 |
| - def test_settings_filter(self): |
218 |
| - res = render_template_with_form('{{ "required_css_class"|bootstrap_setting }}') |
219 |
| - self.assertEqual(res.strip(), 'bootstrap3-req') |
220 |
| - res = render_template_with_form('{% if "javascript_in_head"|bootstrap_setting %}head{% else %}body{% endif %}') |
221 |
| - self.assertEqual(res.strip(), 'head') |
222 | 219 |
|
223 |
| - def test_required_class(self): |
224 |
| - form = TestForm() |
225 |
| - res = render_template_with_form('{% bootstrap_form form %}', {'form': form}) |
226 |
| - self.assertIn('bootstrap3-req', res) |
| 220 | +def test_settings_filter(self): |
| 221 | + res = render_template_with_form('{{ "required_css_class"|bootstrap_setting }}') |
| 222 | + self.assertEqual(res.strip(), 'bootstrap3-req') |
| 223 | + res = render_template_with_form('{% if "javascript_in_head"|bootstrap_setting %}head{% else %}body{% endif %}') |
| 224 | + self.assertEqual(res.strip(), 'head') |
227 | 225 |
|
228 |
| - def test_error_class(self): |
229 |
| - form = TestForm({}) |
230 |
| - res = render_template_with_form('{% bootstrap_form form %}', {'form': form}) |
231 |
| - self.assertIn('bootstrap3-err', res) |
232 | 226 |
|
233 |
| - def test_bound_class(self): |
234 |
| - form = TestForm({'sender': 'sender'}) |
235 |
| - res = render_template_with_form('{% bootstrap_form form %}', {'form': form}) |
236 |
| - self.assertIn('bootstrap3-bound', res) |
| 227 | +def test_required_class(self): |
| 228 | + form = TestForm() |
| 229 | + res = render_template_with_form('{% bootstrap_form form %}', {'form': form}) |
| 230 | + self.assertIn('bootstrap3-req', res) |
| 231 | + |
| 232 | + |
| 233 | +def test_error_class(self): |
| 234 | + form = TestForm({}) |
| 235 | + res = render_template_with_form('{% bootstrap_form form %}', {'form': form}) |
| 236 | + self.assertIn('bootstrap3-err', res) |
| 237 | + |
| 238 | + |
| 239 | +def test_bound_class(self): |
| 240 | + form = TestForm({'sender': 'sender'}) |
| 241 | + res = render_template_with_form('{% bootstrap_form form %}', {'form': form}) |
| 242 | + self.assertIn('bootstrap3-bound', res) |
237 | 243 |
|
238 | 244 |
|
239 | 245 | class TemplateTest(TestCase):
|
|
0 commit comments