Commit eb3a977f authored by Roberto Rosario's avatar Roberto Rosario

Fix document preview rendering issue

Issue was introduced by the read only decimal field display addition.
Implement decimal field feature by explicit field rendering.
Closes GitLab issue #771.Thanks to Christoph Roeder (@brightdroid)
for the report and investigation.
Signed-off-by: Roberto Rosario's avatarRoberto Rosario <[email protected]>
parent 149140f2
Pipeline #115735106 skipped with stage
3.3.11 (2020-02-07)
===================
- Fix document preview rendering issue introduced by the read only
decimal field display addition. Closes GitLab issue #771.
Thanks to Christoph Roeder (@brightdroid) for the report and
investigation.
3.3.10 (2020-01-31)
===================
- Turn TarArchiveClassTestCase in to reusable archive test case class.
......
......@@ -104,18 +104,14 @@
{{ option }}
</div>
{% endfor %}
{% elif field|widget_type == 'datetimeinput' or field|widget_type == 'dateinput' %}
{% elif field|widget_type in 'datetimeinput,dateinput,numberinput' %}
{% if read_only %}
{{ field.value }}
{% else %}
{% render_field field class+="form-control" %}
{% endif %}
{% else %}
{% if read_only %}
{{ field.value }}
{% else %}
{% render_field field class+="form-control" %}
{% endif %}
{% render_field field class+="form-control" %}
{% endif %}
{% if field.help_text %}<p class="help-block">{{ field.help_text|safe }}</p>{% endif %}
</div>
......
......@@ -182,6 +182,13 @@ class DocumentViewTestMixin(object):
def _request_test_document_list_view(self):
return self.get(viewname='documents:document_list')
def _request_test_document_preview_view(self):
return self.get(
viewname='documents:document_preview', kwargs={
'pk': self.test_document.pk
}
)
def _request_test_document_type_edit_get_view(self):
return self.get(
viewname='documents:document_document_type_edit',
......
......@@ -24,11 +24,11 @@ from .mixins import DocumentViewTestMixin
class DocumentViewTestCase(
LayerTestMixin, DocumentViewTestMixin, GenericDocumentViewTestCase
):
def test_document_view_no_permissions(self):
def test_document_properties_view_no_permissions(self):
response = self._request_document_properties_view()
self.assertEqual(response.status_code, 404)
def test_document_view_with_permissions(self):
def test_document_properties_view_with_permissions(self):
self.grant_access(
obj=self.test_document, permission=permission_document_view
)
......@@ -456,3 +456,17 @@ class DocumentViewTestCase(
response = self._request_document_print_view()
self.assertEqual(response.status_code, 200)
def test_document_preview_view_no_permission(self):
response = self._request_test_document_preview_view()
self.assertEqual(response.status_code, 404)
def test_document_preview_view_with_access(self):
self.grant_access(
obj=self.test_document, permission=permission_document_view
)
response = self._request_test_document_preview_view()
self.assertContains(
response=response, text=self.test_document.label, status_code=200
)
from __future__ import unicode_literals
from ..permissions import permission_document_view
from ..widgets import DocumentPageThumbnailWidget
from .test_models import GenericDocumentTestCase
from .base import GenericDocumentTestCase, GenericDocumentViewTestCase
from .mixins import DocumentViewTestMixin
class DocumentPageWidgetTestCase(GenericDocumentTestCase):
......@@ -12,3 +14,17 @@ class DocumentPageWidgetTestCase(GenericDocumentTestCase):
result = document_thumbnail_widget.render(instance=self.test_document)
self.assertTrue(self.test_document.get_absolute_url() in result)
class DocumentPreviewWidgetViewTestCase(
DocumentViewTestMixin, GenericDocumentViewTestCase
):
def test_document_preview_page_carousel_widget_render(self):
self.grant_access(
obj=self.test_document, permission=permission_document_view
)
response = self._request_test_document_preview_view()
self.assertContains(
response=response, text='carousel-container', status_code=200
)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment