From 4e061992a045ac1ec3473bb66e0c96c9053f1e2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Flisak?= Date: Fri, 26 Jan 2024 20:58:24 +0100 Subject: [PATCH] Add missing css_class to accordion template --- .../templates/bootstrap5/accordion.html | 2 +- tests/test_layout_objects.py | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/crispy_bootstrap5/templates/bootstrap5/accordion.html b/crispy_bootstrap5/templates/bootstrap5/accordion.html index 383ea2d..98e6618 100644 --- a/crispy_bootstrap5/templates/bootstrap5/accordion.html +++ b/crispy_bootstrap5/templates/bootstrap5/accordion.html @@ -1,3 +1,3 @@ -
+
{{ content|safe }}
diff --git a/tests/test_layout_objects.py b/tests/test_layout_objects.py index 72b3cd8..3a8fc35 100644 --- a/tests/test_layout_objects.py +++ b/tests/test_layout_objects.py @@ -274,6 +274,25 @@ def test_accordion_and_accordiongroup(self): ) assert parse_form(form) == parse_expected("accordion.html") + def test_accordion_css_class_is_applied_to_accordion(self): + classes = 'one two three' + test_form = SampleForm() + test_form.helper = FormHelper() + test_form.helper.form_tag = False + test_form.helper.layout = Layout( + Accordion( + AccordionGroup("one", "first_name"), + css_class=classes, + css_id='super-accordion' + ) + ) + html = render_crispy_form(test_form) + + assert ( + html.count('