mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-05-14 16:47:02 +02:00
revise unit tests
This commit is contained in:
parent
d1e8c2c4e8
commit
8bb3497c48
3 changed files with 38 additions and 3 deletions
|
@ -422,6 +422,8 @@ address.dja-address-contact-list {
|
||||||
border: 1px solid var(--error-fg) !important;
|
border: 1px solid var(--error-fg) !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Let's define this block of code once and use it for analysts over a certain screen size,
|
||||||
|
// superusers over another screen size.
|
||||||
@mixin submit-row-wrapper--collapsed-one-line(){
|
@mixin submit-row-wrapper--collapsed-one-line(){
|
||||||
&.submit-row-wrapper--collapsed {
|
&.submit-row-wrapper--collapsed {
|
||||||
transform: translate3d(0, 42px, 0);
|
transform: translate3d(0, 42px, 0);
|
||||||
|
@ -475,6 +477,7 @@ address.dja-address-contact-list {
|
||||||
}
|
}
|
||||||
|
|
||||||
@media screen and (min-width:935px) {
|
@media screen and (min-width:935px) {
|
||||||
|
// Analyst only class
|
||||||
.submit-row-wrapper--analyst-view {
|
.submit-row-wrapper--analyst-view {
|
||||||
@include submit-row-wrapper--collapsed-one-line();
|
@include submit-row-wrapper--collapsed-one-line();
|
||||||
}
|
}
|
||||||
|
|
|
@ -104,6 +104,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{# submit-row-wrapper--analyst-view is a class that manages layout on certain screens for analysts only #}
|
||||||
<div class="submit-row-wrapper{% if not request.user|has_permission:'registrar.full_access_permission' %} submit-row-wrapper--analyst-view{% endif %}">
|
<div class="submit-row-wrapper{% if not request.user|has_permission:'registrar.full_access_permission' %} submit-row-wrapper--analyst-view{% endif %}">
|
||||||
|
|
||||||
<span class="submit-row-toggle padding-1 padding-right-2 visible-desktop">
|
<span class="submit-row-toggle padding-1 padding-right-2 visible-desktop">
|
||||||
|
|
|
@ -1213,9 +1213,11 @@ class TestDomainRequestAdmin(MockEppLib):
|
||||||
self.assertEqual(domain_request.requested_domain.name, domain_request.approved_domain.name)
|
self.assertEqual(domain_request.requested_domain.name, domain_request.approved_domain.name)
|
||||||
|
|
||||||
@less_console_noise_decorator
|
@less_console_noise_decorator
|
||||||
def test_sticky_submit_row_shows_requested_domain(self):
|
def test_sticky_submit_row(self):
|
||||||
"""Test that the change_form template contains a string indicative of the customization
|
"""Test that the change_form template contains strings indicative of the customization
|
||||||
of the sticky submit bar."""
|
of the sticky submit bar.
|
||||||
|
|
||||||
|
Also test that it does NOT contain a CSS class meant for analysts only when logged in as superuser."""
|
||||||
|
|
||||||
# make sure there is no user with this email
|
# make sure there is no user with this email
|
||||||
EMAIL = "mayor@igorville.gov"
|
EMAIL = "mayor@igorville.gov"
|
||||||
|
@ -1233,6 +1235,35 @@ class TestDomainRequestAdmin(MockEppLib):
|
||||||
expected_content = "<strong>Requested domain:</strong>"
|
expected_content = "<strong>Requested domain:</strong>"
|
||||||
expected_content2 = '<span class="scroll-indicator"></span>'
|
expected_content2 = '<span class="scroll-indicator"></span>'
|
||||||
expected_content3 = '<div class="submit-row-wrapper">'
|
expected_content3 = '<div class="submit-row-wrapper">'
|
||||||
|
not_expected_content = "submit-row-wrapper--analyst-view>"
|
||||||
|
self.assertContains(request, expected_content)
|
||||||
|
self.assertContains(request, expected_content2)
|
||||||
|
self.assertContains(request, expected_content3)
|
||||||
|
self.assertNotContains(request, not_expected_content)
|
||||||
|
|
||||||
|
@less_console_noise_decorator
|
||||||
|
def test_sticky_submit_row_has_extra_class_for_analysts(self):
|
||||||
|
"""Test that the change_form template contains strings indicative of the customization
|
||||||
|
of the sticky submit bar.
|
||||||
|
|
||||||
|
Also test that it DOES contain a CSS class meant for analysts only when logged in as analyst."""
|
||||||
|
|
||||||
|
# make sure there is no user with this email
|
||||||
|
EMAIL = "mayor@igorville.gov"
|
||||||
|
User.objects.filter(email=EMAIL).delete()
|
||||||
|
self.client.force_login(self.staffuser)
|
||||||
|
|
||||||
|
# Create a sample domain request
|
||||||
|
domain_request = completed_domain_request(status=DomainRequest.DomainRequestStatus.IN_REVIEW)
|
||||||
|
|
||||||
|
# Create a mock request
|
||||||
|
request = self.client.post("/admin/registrar/domainrequest/{}/change/".format(domain_request.pk))
|
||||||
|
|
||||||
|
# Since we're using client to mock the request, we can only test against
|
||||||
|
# non-interpolated values
|
||||||
|
expected_content = "<strong>Requested domain:</strong>"
|
||||||
|
expected_content2 = '<span class="scroll-indicator"></span>'
|
||||||
|
expected_content3 = '<div class="submit-row-wrapper submit-row-wrapper--analyst-view">'
|
||||||
self.assertContains(request, expected_content)
|
self.assertContains(request, expected_content)
|
||||||
self.assertContains(request, expected_content2)
|
self.assertContains(request, expected_content2)
|
||||||
self.assertContains(request, expected_content3)
|
self.assertContains(request, expected_content3)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue