From 235c641f5a2c53c471f81d6ddeb78af737f24242 Mon Sep 17 00:00:00 2001 From: Dmitriy Kosyrkov Date: Wed, 24 Jul 2024 11:06:30 +0300 Subject: [PATCH] Add missed css_class to TabHolder template (#183) * Add missed css_class to TabHolder template * Minor fix in test_tab_and_tab_holder test method * Updated CHANGELOG.md * Updated Tests --------- Co-authored-by: David Smith --- CHANGELOG.md | 2 +- .../templates/bootstrap5/layout/tab.html | 2 +- tests/results/test_tab_and_tab_holder.html | 29 +++++++++++++++++++ tests/test_layout_objects.py | 23 ++------------- 4 files changed, 34 insertions(+), 22 deletions(-) create mode 100644 tests/results/test_tab_and_tab_holder.html diff --git a/CHANGELOG.md b/CHANGELOG.md index 808d886..5fa3730 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ ## 2024.3 (TBC) * Added support for Django 5.1. -* Fixed `accordion.html` and `accordion-group.html` templates to render `css_class` attribute. +* Fixed `accordion.html`, `accordion-group.html` and `tab.html` templates to render `css_class` attribute. * Dropped support for django-crispy-forms 2.2 and earlier. ## 2024.2 (2024-02-24) diff --git a/crispy_bootstrap5/templates/bootstrap5/layout/tab.html b/crispy_bootstrap5/templates/bootstrap5/layout/tab.html index 69b9cfd..cb22353 100644 --- a/crispy_bootstrap5/templates/bootstrap5/layout/tab.html +++ b/crispy_bootstrap5/templates/bootstrap5/layout/tab.html @@ -1,4 +1,4 @@ - + {{ links|safe }}
diff --git a/tests/results/test_tab_and_tab_holder.html b/tests/results/test_tab_and_tab_holder.html new file mode 100644 index 0000000..6690444 --- /dev/null +++ b/tests/results/test_tab_and_tab_holder.html @@ -0,0 +1,29 @@ +
+ +
+
+
+ + +
+
+
+
+ + +
+
+ + +
+
+
+
\ No newline at end of file diff --git a/tests/test_layout_objects.py b/tests/test_layout_objects.py index f1da844..6f3cdbf 100644 --- a/tests/test_layout_objects.py +++ b/tests/test_layout_objects.py @@ -440,30 +440,13 @@ def test_tab_and_tab_holder(self): "one", "first_name", css_id="custom-name", - css_class="first-tab-class active", + css_class="first-tab-class", ), Tab("two", "password1", "password2"), + css_class="tab-holder-class", ) ) - html = render_crispy_form(test_form) - - assert ( - html.count( - '