Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
342 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
from django import forms | ||
|
||
from tests.base import BootstrapTestCase | ||
|
||
|
||
class CheckboxTestForm(forms.Form): | ||
test = forms.BooleanField() | ||
|
||
|
||
class InputTypeCheckboxTestCase(BootstrapTestCase): | ||
def test_input_type_checkbox(self): | ||
"""Test field with checkbox widget.""" | ||
self.assertHTMLEqual( | ||
self.render("{% bootstrap_field form.test %}", context={"form": CheckboxTestForm()}), | ||
( | ||
'<div class="django_bootstrap5-req mb-3">' | ||
'<div class="form-check">' | ||
'<input class="form-check-input" id="id_test" name="test" required type="checkbox">' | ||
'<label class="form-check-label" for="id_test">' | ||
"Test" | ||
"</label>" | ||
), | ||
) | ||
|
||
def test_input_type_checkbox_style_switch(self): | ||
"""Test field with checkbox widget, style switch.""" | ||
self.assertHTMLEqual( | ||
self.render( | ||
'{% bootstrap_field form.test checkbox_style="switch" %}', context={"form": CheckboxTestForm()} | ||
), | ||
( | ||
'<div class="django_bootstrap5-req mb-3">' | ||
'<div class="form-check form-switch">' | ||
'<input class="form-check-input" id="id_test" name="test" required type="checkbox">' | ||
'<label class="form-check-label" for="id_test">' | ||
"Test" | ||
"</label>" | ||
), | ||
) | ||
|
||
def test_bootstrap_field_checkbox_horizontal(self): | ||
"""Test field with checkbox widget, layout horizontal.""" | ||
self.assertHTMLEqual( | ||
self.render("{% bootstrap_field form.test layout='horizontal' %}", context={"form": CheckboxTestForm()}), | ||
( | ||
'<div class="django_bootstrap5-req mb-3 row">' | ||
'<div class="col-sm-10 offset-sm-2">' | ||
'<div class="form-check">' | ||
'<input class="form-check-input" id="id_test" name="test" required type="checkbox">' | ||
'<label class="form-check-label" for="id_test">' | ||
"Test" | ||
"</label>" | ||
"</div>" | ||
), | ||
) |
Oops, something went wrong.