Improves html consistency for goal page

This commit is contained in:
Mouse Reeve 2021-09-28 18:34:12 -07:00
parent 6dbd402345
commit 701bf4828b
2 changed files with 27 additions and 8 deletions

View file

@ -16,21 +16,21 @@
</div>
<div class="column">
<label class="label"><p class="mb-2">{% trans "Goal privacy:" %}</p>
{% include 'snippets/privacy_select.html' with no_label=True current=goal.privacy %}
</label>
<label class="label" for="privacy_{{ goal.id }}">{% trans "Goal privacy:" %}</label>
{% include 'snippets/privacy_select.html' with no_label=True current=goal.privacy uuid=goal.id %}
</div>
</div>
<label for="post_status" class="label">
<input type="checkbox" name="post-status" id="post_status" class="checkbox" checked>
{% trans "Post to feed" %}
</label>
<p>
<div class="field">
<button type="submit" class="button is-link">{% trans "Set goal" %}</button>
{% if goal %}
{% trans "Cancel" as button_text %}
{% include 'snippets/toggle/close_button.html' with text=button_text controls_text="show_edit_goal" %}
{% endif %}
</p>
</div>
</form>

View file

@ -1,12 +1,13 @@
""" test for app action functionality """
from unittest.mock import patch
from django.utils import timezone
from tidylib import tidy_document
from django.contrib.auth.models import AnonymousUser
from django.http import Http404
from django.template.response import TemplateResponse
from django.test import TestCase
from django.test.client import RequestFactory
from django.utils import timezone
from bookwyrm import models, views
@ -61,7 +62,16 @@ class GoalViews(TestCase):
request.user = self.local_user
result = view(request, self.local_user.localname, self.year)
result.render()
html = result.render()
_, errors = tidy_document(
html.content,
options={
"drop-empty-elements": False,
"warn-proprietary-attributes": False,
},
)
if errors:
raise Exception(errors)
self.assertIsInstance(result, TemplateResponse)
def test_goal_page_anonymous(self):
@ -92,7 +102,16 @@ class GoalViews(TestCase):
request.user = self.rat
result = view(request, self.local_user.localname, timezone.now().year)
result.render()
html = result.render()
_, errors = tidy_document(
html.content,
options={
"drop-empty-elements": False,
"warn-proprietary-attributes": False,
},
)
if errors:
raise Exception(errors)
self.assertIsInstance(result, TemplateResponse)
def test_goal_page_private(self):