Skip to content

Commit

Permalink
Updated Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
smithdc1 committed Jul 24, 2024
1 parent a4ffc57 commit 6dfce07
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 19 deletions.
29 changes: 29 additions & 0 deletions tests/results/test_tab_and_tab_holder.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<form method="post">
<ul class="nav nav-tabs tab-holder-class">
<li class="nav-item"><a class="nav-link active" href="#custom-name" data-bs-toggle="tab">One</a></li>
<li class="nav-item"><a class="nav-link" href="#two" data-bs-toggle="tab">Two</a></li>
</ul>
<div class="tab-content card-body">
<div id="custom-name" class="tab-pane first-tab-class active">
<div id="div_id_first_name" class="mb-3">
<label for="id_first_name" class="form-label requiredField">first name<span
class="asteriskField">*</span></label>
<input type="text" name="first_name" maxlength="5" class="textinput textInput inputtext form-control" required
id="id_first_name">
</div>
</div>
<div id="two" class="tab-pane">
<div id="div_id_password1" class="mb-3">
<label for="id_password1" class="form-label requiredField">password<span class="asteriskField">*</span></label>
<input type="password" name="password1" maxlength="30" class="passwordinput form-control" required
id="id_password1">
</div>
<div id="div_id_password2" class="mb-3">
<label for="id_password2" class="form-label requiredField">re-enter password<span
class="asteriskField">*</span></label>
<input type="password" name="password2" maxlength="30" class="passwordinput form-control" required
id="id_password2">
</div>
</div>
</div>
</form>
20 changes: 1 addition & 19 deletions tests/test_layout_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,25 +446,7 @@ def test_tab_and_tab_holder(self):
css_class="tab-holder-class",
)
)
html = render_crispy_form(test_form)

assert (
html.count(
'<ul class="nav nav-tabs tab-holder-class"> <li class="nav-item">'
'<a class="nav-link active" href="#custom-name" data-bs-toggle="tab">'
"One</a></li>"
)
== 1
)
assert html.count("tab-pane") == 2

assert html.count('class="tab-pane first-tab-class active"') == 1

assert html.count('<div id="custom-name"') == 1
assert html.count('<div id="two"') == 1
assert html.count('name="first_name"') == 1
assert html.count('name="password1"') == 1
assert html.count('name="password2"') == 1
assert parse_form(test_form) == parse_expected("test_tab_and_tab_holder.html")

def test_tab_helper_reuse(self):
# this is a proper form, according to the docs.
Expand Down

0 comments on commit 6dfce07

Please sign in to comment.