mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-07-14 06:55:08 +02:00
Fix tests, cleanup
This commit is contained in:
parent
d9b4d58e55
commit
f53a4414ef
6 changed files with 74 additions and 102 deletions
|
@ -175,10 +175,7 @@ function checkToListThenInitWidget(toListId, attempts) {
|
|||
document.addEventListener('DOMContentLoaded', function() {
|
||||
// Select all table rows that have a data-contact-id attribute
|
||||
let contactRows = document.querySelectorAll("tr[data-contact-url]");
|
||||
console.log(`contact rows at this point: ${contactRows}`)
|
||||
console.log(`length of ont ${contactRows.length}`)
|
||||
if (!contactRows || contactRows.length == 0) {
|
||||
console.log("in if statement")
|
||||
contactRows = document.querySelectorAll(".other-contact-id")
|
||||
}
|
||||
|
||||
|
|
|
@ -354,6 +354,13 @@ details.dja-detail-table {
|
|||
color: var(--body-quiet-color);
|
||||
}
|
||||
|
||||
@media (max-width: 1024px){
|
||||
.dja-detail-contents {
|
||||
max-width: 400px !important;
|
||||
overflow-x: scroll !important;
|
||||
}
|
||||
}
|
||||
|
||||
tr {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
@ -371,34 +378,18 @@ details.dja-detail-table {
|
|||
|
||||
}
|
||||
|
||||
table.dja-user-detail-table {
|
||||
tr {
|
||||
background-color: var(--body-bg);
|
||||
ul {
|
||||
.padding-left-0__detail-list {
|
||||
padding-left: 0 !important;
|
||||
}
|
||||
|
||||
// Make the head of the user detail table "float"
|
||||
thead > tr > th {
|
||||
border-radius: 4px;
|
||||
border-top: none;
|
||||
border-bottom: none;
|
||||
.margin-left-0__detail-list {
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
|
||||
th, td {
|
||||
border: none
|
||||
.margin-top-neg-1__detail-list {
|
||||
margin-top: -8px !important;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ul.padding-left-0__detail-list {
|
||||
padding-left: 0 !important;
|
||||
}
|
||||
|
||||
ul.margin-left-0__detail-list {
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
|
||||
ul.margin-top-neg-1__detail-list {
|
||||
margin-top: -8px !important;
|
||||
}
|
||||
|
||||
.dja-detail-list {
|
||||
|
|
|
@ -6,17 +6,11 @@ It is not inherently customizable on its own, so we can modify this instead.
|
|||
https://github.com/django/django/blob/main/django/contrib/admin/templates/admin/includes/fieldset.html
|
||||
{% endcomment %}
|
||||
<fieldset class="module aligned {{ fieldset.classes }}">
|
||||
{# .gov override #}
|
||||
{% block fieldset_title %}
|
||||
{% if fieldset.name %}<h2>{{ fieldset.name }}</h2>{% endif %}
|
||||
{% endblock fieldset_title %}
|
||||
{% if fieldset.name %}<h2>{{ fieldset.name }}</h2>{% endif %}
|
||||
|
||||
{# .gov override #}
|
||||
{% block fieldset_description %}
|
||||
{% if fieldset.description %}
|
||||
<div class="description">{{ fieldset.description|safe }}</div>
|
||||
{% endif %}
|
||||
{% endblock fieldset_description %}
|
||||
{% if fieldset.description %}
|
||||
<div class="description">{{ fieldset.description|safe }}</div>
|
||||
{% endif %}
|
||||
|
||||
{% for line in fieldset %}
|
||||
<div class="form-row{% if line.fields|length == 1 and line.errors %} errors{% endif %}{% if not line.has_visible_field %} hidden{% endif %}{% for field in line %}{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% endfor %}">
|
||||
|
@ -46,11 +40,6 @@ https://github.com/django/django/blob/main/django/contrib/admin/templates/admin/
|
|||
{% endif %}
|
||||
</div>
|
||||
|
||||
{# .gov addition #}
|
||||
{% block before_help_text %}
|
||||
{# For templating purposes #}
|
||||
{% endblock before_help_text %}
|
||||
|
||||
{% if field.field.help_text %}
|
||||
{# .gov override #}
|
||||
{% block help_text %}
|
||||
|
|
|
@ -4,41 +4,36 @@
|
|||
<ul class="{% if no_title_top_padding %}margin-top-neg-1__detail-list{% endif %} padding-top-0 padding-left-0__detail-list margin-left-0__detail-list" {% if field_name %} id="id_detail_list__{{field_name}}" {% endif %}>
|
||||
{% if user.title or user.contact.title or user.email or user.contact.email or user.phone or user.contact.phone %}
|
||||
{# Title #}
|
||||
<li>
|
||||
{% if user.title or user.contact.title %}
|
||||
{% if user.contact.title %}
|
||||
{{ user.contact.title }}
|
||||
{% else %}
|
||||
{{ user.title }}
|
||||
{% endif %}
|
||||
{% if user.title or user.contact.title %}
|
||||
{% if user.contact.title %}
|
||||
<li>{{ user.contact.title }}</li>
|
||||
{% else %}
|
||||
None
|
||||
<li>{{ user.title }}</li>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% else %}
|
||||
<li>None</li>
|
||||
{% endif %}
|
||||
{# Email #}
|
||||
<li>
|
||||
{% if user.email or user.contact.email %}
|
||||
{% if user.contact.email %}
|
||||
{{ user.contact.email }}
|
||||
{% else %}
|
||||
{{ user.email }}
|
||||
{% endif %}
|
||||
{% if user.email or user.contact.email %}
|
||||
{% if user.contact.email %}
|
||||
<li>{{ user.contact.email }}</li>
|
||||
{% else %}
|
||||
None
|
||||
<li>{{ user.email }}</li>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% else %}
|
||||
<li>None</li>
|
||||
{% endif %}
|
||||
|
||||
{# Phone #}
|
||||
<li>
|
||||
{% if user.phone or user.contact.phone %}
|
||||
{% if user.contact.phone %}
|
||||
{{ user.contact.phone.as_national }}
|
||||
{% else %}
|
||||
{{ user.phone.as_national }}
|
||||
{% endif %}
|
||||
{% if user.phone or user.contact.phone %}
|
||||
{% if user.contact.phone %}</li>
|
||||
<li>{{ user.contact.phone }}</li>
|
||||
{% else %}
|
||||
None
|
||||
<li>{{ user.phone }}</li>
|
||||
{% endif %}
|
||||
</li>
|
||||
{% else %}
|
||||
<li>None</li>
|
||||
{% endif %}
|
||||
{% else %}
|
||||
<li>
|
||||
No additional contact information found.
|
||||
|
|
|
@ -22,10 +22,10 @@ This is using a custom implementation fieldset.html (see admin/fieldset.html)
|
|||
</dt>
|
||||
<dd>
|
||||
<address>
|
||||
{% if contact.get_formatted_name %}<a href="{% url 'admin:registrar_contact_change' contact.id %}">{{ contact.get_formatted_name }}</a><br />{% else %}None<br />{% endif %}
|
||||
{% if contact.title %}{{ contact.title }}<br />{% else %}None<br />{% endif %}
|
||||
{% if contact.email %}{{ contact.email }}<br />{% else %}None<br />{% endif %}
|
||||
{% if contact.phone %}{{ contact.phone.as_national }}{% else %}None{% endif %}
|
||||
{% if contact.get_formatted_name %}<a href="{% url 'admin:registrar_contact_change' contact.id %}">{{ contact.get_formatted_name }}</a><br />{% else %}None<br />{% endif %}
|
||||
{% if contact.title %}{{ contact.title }}<br />{% else %}None<br />{% endif %}
|
||||
{% if contact.email %}{{ contact.email }}<br />{% else %}None<br />{% endif %}
|
||||
{% if contact.phone %}{{ contact.phone }}{% else %}None{% endif %}
|
||||
</address>
|
||||
</dd>
|
||||
{% endfor %}
|
||||
|
|
|
@ -1307,9 +1307,9 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
# (Otherwise this test will fail if we change classes, etc)
|
||||
expected_creator_fields = [
|
||||
# Field, expected value
|
||||
("title", "Treat inspector</td>"),
|
||||
("email", "meoward.jones@igorville.gov</td>"),
|
||||
("phone", "(555) 123 12345</td>"),
|
||||
("title", "Treat inspector</li>"),
|
||||
("email", "meoward.jones@igorville.gov</li>"),
|
||||
("phone", "(555) 123 12345</li>"),
|
||||
]
|
||||
self.test_helper.assert_response_contains_distinct_values(response, expected_creator_fields)
|
||||
|
||||
|
@ -1319,9 +1319,9 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
# == Check for the submitter == #
|
||||
expected_submitter_fields = [
|
||||
# Field, expected value
|
||||
("title", "Admin Tester</td>"),
|
||||
("email", "mayor@igorville.gov</td>"),
|
||||
("phone", "(555) 555 5556</td>"),
|
||||
("title", "Admin Tester</li>"),
|
||||
("email", "mayor@igorville.gov</li>"),
|
||||
("phone", "(555) 555 5556</li>"),
|
||||
]
|
||||
self.test_helper.assert_response_contains_distinct_values(response, expected_submitter_fields)
|
||||
self.assertContains(response, "Testy2 Tester2")
|
||||
|
@ -1329,22 +1329,22 @@ class TestDomainRequestAdmin(MockEppLib):
|
|||
# == Check for the authorizing_official == #
|
||||
expected_ao_fields = [
|
||||
# Field, expected value
|
||||
("title", "Chief Tester</td>"),
|
||||
("email", "testy@town.com</td>"),
|
||||
("phone", "(555) 555 5555</td>"),
|
||||
("title", "Chief Tester</li>"),
|
||||
("email", "testy@town.com</li>"),
|
||||
("phone", "(555) 555 5555</li>"),
|
||||
]
|
||||
self.test_helper.assert_response_contains_distinct_values(response, expected_ao_fields)
|
||||
|
||||
# count=5 because the underlying domain has two users with this name.
|
||||
# The dropdown has 4 of these.
|
||||
self.assertContains(response, "Testy Tester", count=5)
|
||||
# count=3 because the underlying domain has two users with this name.
|
||||
# The dropdown has 2 of these.
|
||||
self.assertContains(response, "Testy Tester", count=3)
|
||||
|
||||
# == Test the other_employees field == #
|
||||
expected_other_employees_fields = [
|
||||
# Field, expected value
|
||||
("title", "Another Tester</td>"),
|
||||
("email", "testy2@town.com</td>"),
|
||||
("phone", "(555) 555 5557</td>"),
|
||||
("title", "Another Tester"),
|
||||
("email", "testy2@town.com"),
|
||||
("phone", "(555) 555 5557"),
|
||||
]
|
||||
self.test_helper.assert_response_contains_distinct_values(response, expected_other_employees_fields)
|
||||
|
||||
|
@ -2022,9 +2022,9 @@ class TestDomainInformationAdmin(TestCase):
|
|||
# (Otherwise this test will fail if we change classes, etc)
|
||||
expected_creator_fields = [
|
||||
# Field, expected value
|
||||
("title", "Treat inspector</td>"),
|
||||
("email", "meoward.jones@igorville.gov</td>"),
|
||||
("phone", "(555) 123 12345</td>"),
|
||||
("title", "Treat inspector</li>"),
|
||||
("email", "meoward.jones@igorville.gov</li>"),
|
||||
("phone", "(555) 123 12345</li>"),
|
||||
]
|
||||
self.test_helper.assert_response_contains_distinct_values(response, expected_creator_fields)
|
||||
|
||||
|
@ -2034,9 +2034,9 @@ class TestDomainInformationAdmin(TestCase):
|
|||
# == Check for the submitter == #
|
||||
expected_submitter_fields = [
|
||||
# Field, expected value
|
||||
("title", "Admin Tester</td>"),
|
||||
("email", "mayor@igorville.gov</td>"),
|
||||
("phone", "(555) 555 5556</td>"),
|
||||
("title", "Admin Tester</li>"),
|
||||
("email", "mayor@igorville.gov</li>"),
|
||||
("phone", "(555) 555 5556</li>"),
|
||||
]
|
||||
self.test_helper.assert_response_contains_distinct_values(response, expected_submitter_fields)
|
||||
self.assertContains(response, "Testy2 Tester2")
|
||||
|
@ -2044,22 +2044,22 @@ class TestDomainInformationAdmin(TestCase):
|
|||
# == Check for the authorizing_official == #
|
||||
expected_ao_fields = [
|
||||
# Field, expected value
|
||||
("title", "Chief Tester</td>"),
|
||||
("email", "testy@town.com</td>"),
|
||||
("phone", "(555) 555 5555</td>"),
|
||||
("title", "Chief Tester</li>"),
|
||||
("email", "testy@town.com</li>"),
|
||||
("phone", "(555) 555 5555</li>"),
|
||||
]
|
||||
self.test_helper.assert_response_contains_distinct_values(response, expected_ao_fields)
|
||||
|
||||
# count=5 because the underlying domain has two users with this name.
|
||||
# The dropdown has 4 of these.
|
||||
self.assertContains(response, "Testy Tester", count=5)
|
||||
# count=3 because the underlying domain has two users with this name.
|
||||
# The dropdown has 2 of these.
|
||||
self.assertContains(response, "Testy Tester", count=3)
|
||||
|
||||
# == Test the other_employees field == #
|
||||
expected_other_employees_fields = [
|
||||
# Field, expected value
|
||||
("title", "Another Tester</td>"),
|
||||
("email", "testy2@town.com</td>"),
|
||||
("phone", "(555) 555 5557</td>"),
|
||||
("title", "Another Tester"),
|
||||
("email", "testy2@town.com"),
|
||||
("phone", "(555) 555 5557"),
|
||||
]
|
||||
self.test_helper.assert_response_contains_distinct_values(response, expected_other_employees_fields)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue