Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
heso committed Jan 22, 2024
1 parent 1843a96 commit 03078fa
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/test_forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,30 @@ def test_checkbox(self):
self.assertIn("form-text", help_text["class"], "The help text should have the class 'form-text'.")
self.assertIn("text-muted", help_text["class"], "The help text should have the class 'text-muted'.")

def test_checkbox_multiple_select(self):
res = render_form_field("category2")
expected_html = (
'<div class="form-group bootstrap4-req">'
'<label>Category2</label>'
'<div class="checkbox" id="id_category2">'
'<div class="form-check">'
'<label class="form-check-label" for="id_category2_0">'
'<input class="form-check-input" id="id_category2_0" name="category2" title="Check as many as you like." type="checkbox" value="1">'
"Radio 1"
"</label>"
"</div>"
'<div class="form-check">'
'<label class="form-check-label" for="id_category2_1">'
'<input class="form-check-input" id="id_category2_1" name="category2" title="Check as many as you like." type="checkbox" value="2">'
"Radio 2"
"</label>"
"</div>"
"</div>"
'<small class="form-text text-muted">Check as many as you like.</small>'
"</div>"
)
self.assertHTMLEqual(res, expected_html)

def test_required_field(self):
required_css_class = "bootstrap4-req"
required_field = render_form_field("subject")
Expand Down

0 comments on commit 03078fa

Please sign in to comment.