Skip to content

Commit

Permalink
Update BE tests
Browse files Browse the repository at this point in the history
  • Loading branch information
albinazs committed Sep 17, 2024
1 parent b651523 commit 4aad271
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 27 deletions.
28 changes: 14 additions & 14 deletions client/scss/components/_indicator.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
.indicator {
margin-inline-end: 0;
opacity: theme('opacity.70');

.icon {
padding: 2px;
vertical-align: middle; // reset vertical-align set by icon.initial
}

&--is-dimmed {
opacity: theme('opacity.50');
}
}

.privacy-indicator {
&.public {
.label-private {
Expand All @@ -11,17 +25,3 @@
}
}
}

.indicator {
margin-inline-end: 0;
opacity: theme('opacity.70');

.icon {
padding: 2px;
vertical-align: middle; // reset vertical-align set by icon.initial
}

&--is-inverse {
opacity: theme('opacity.50');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

{% if page.locked %}
<span
class="indicator locked-indicator {% if page.locked_by_id != request.user.pk %}indicator--is-inverse{% endif %}"
class="indicator {% if page.locked_by_id != request.user.pk %}indicator--is-dimmed{% endif %}"
title="{% if page.locked_by_id == request.user.pk %}{% trans 'This page is locked, by you, to further editing' %}{% else %}{% trans 'This page is locked to further editing' %}{% endif %}"
>
{% icon name="lock" classname="initial" %}
Expand Down
2 changes: 1 addition & 1 deletion wagtail/admin/tests/pages/test_explorer_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ def test_admin_home_page_changes_with_permissions(self):
response = self.client.get(reverse("wagtailadmin_home"))
self.assertEqual(response.status_code, 200)
# Bob should only see the welcome for example.com, not testserver
self.assertContains(response, "Welcome to the example.com Wagtail CMS")
self.assertContains(response, "example.com")
self.assertNotContains(response, "testserver")

def test_breadcrumb_with_no_user_permissions(self):
Expand Down
2 changes: 1 addition & 1 deletion wagtail/admin/tests/test_reports_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def test_simple(self):
self.assertActiveFilterNotRendered(soup)

# Locked by current user shown in indicator
self.assertContains(response, "locked-indicator indicator--is-inverse")
self.assertNotContains(response, "indicator--is-dimmed")
self.assertContains(
response, 'title="This page is locked, by you, to further editing"'
)
Expand Down
6 changes: 3 additions & 3 deletions wagtail/admin/tests/test_site_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,11 @@ def test_no_sites_summary_links_to_wagtail_root(self):
self.assertSummaryContainsLinkToPage(self.wagtail_root.pk)

def test_summary_includes_page_count_without_wagtail_root(self):
self.assertSummaryContains(f"<span>{Page.objects.count() - 1}</span> Pages")
self.assertSummaryContains(f"{Page.objects.count() - 1} Pages")

def test_summary_shows_zero_pages_if_none_exist_except_wagtail_root(self):
Page.objects.exclude(pk=self.wagtail_root.pk).delete()
self.assertSummaryContains("<span>0</span> Pages")
self.assertSummaryContains("0 Pages")

def test_user_with_no_page_permissions_is_not_shown_panel(self):
self.user.is_superuser = False
Expand All @@ -78,4 +78,4 @@ def test_user_with_limited_page_permissions_sees_proper_page_count(self):
self.user.is_superuser = False
self.user.save()
self.user.groups.add(self.test_page_group)
self.assertSummaryContains("<span>1</span> Page")
self.assertSummaryContains("1 Page")
2 changes: 1 addition & 1 deletion wagtail/admin/tests/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def setUp(self):
def test_simple(self):
response = self.client.get(reverse("wagtailadmin_home"))
self.assertEqual(response.status_code, 200)
self.assertContains(response, "Welcome to the Test Site Wagtail CMS")
self.assertContains(response, "Test Site")

def test_admin_menu(self):
response = self.client.get(reverse("wagtailadmin_home"))
Expand Down
6 changes: 3 additions & 3 deletions wagtail/documents/tests/test_site_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ def test_user_with_no_permissions_is_not_shown_panel(self):

def test_user_sees_proper_doc_count(self):
cases = (
(self.superuser, "<span>3</span> Documents"),
(self.report_adder, "<span>2</span> Documents"),
(self.report_chooser, "<span>2</span> Documents"),
(self.superuser, "3 Documents"),
(self.report_adder, "2 Documents"),
(self.report_chooser, "2 Documents"),
)
for user, content in cases:
with self.subTest(user=user):
Expand Down
6 changes: 3 additions & 3 deletions wagtail/images/tests/test_site_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ def test_user_with_no_permissions_is_not_shown_panel(self):

def test_user_sees_proper_image_count(self):
cases = (
(self.superuser, "<span>3</span> Images"),
(self.bird_adder, "<span>2</span> Images"),
(self.bird_chooser, "<span>2</span> Images"),
(self.superuser, "3 Images"),
(self.bird_adder, "2 Images"),
(self.bird_chooser, "2 Images"),
)
for user, content in cases:
with self.subTest(user=user):
Expand Down

0 comments on commit 4aad271

Please sign in to comment.