Skip to content

Commit

Permalink
Merge branch 'main' into fmd-915-make-tables-scrollable
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchdawson1982 authored Oct 10, 2024
2 parents b02b96a + e4c94aa commit c5b8459
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ migrate:
setup_waffle_switches:
poetry run python manage.py waffle_switch search-sort-radio-buttons off --create
poetry run python manage.py waffle_switch display-result-tags off --create
poetry run python manage.py waffle_switch show_is_nullable_in_table_details_column off --create

# Run makemessages
messages:
Expand Down
9 changes: 7 additions & 2 deletions templates/details_table.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% extends "details_base.html" %}
{% load markdown %}
{% load i18n %}
{% load waffle_tags %}

{% block extra_details %}
<div class="govuk-grid-row">
Expand All @@ -13,7 +14,9 @@
<th scope="col" class="govuk-table__header">{% translate "Column name" %}</th>
<th scope="col" class="govuk-table__header">{% translate "Description" %}</th>
<th scope="col" class="govuk-table__header">{% translate "Type" %}</th>
<th scope="col" class="govuk-table__header">{% translate "Is Nullable" %}</th>
{% switch 'show_is_nullable_in_table_details_column' %}
<th scope="col" class="govuk-table__header">{% translate "Is Nullable" %}</th>
{% endswitch %}
</tr>
</thead>
<tbody class="govuk-table__body">
Expand All @@ -28,7 +31,9 @@
{% endif %}
</td>
<td class="govuk-table__cell">{{column.type|title}}</td>
<td class="govuk-table__cell">{{column.nullable|yesno:"Yes,No,"}}</td>
{% switch 'show_is_nullable_in_table_details_column' %}
<td class="govuk-table__cell">{{column.nullable|yesno:"Yes,No,"}}</td>
{% endswitch %}
</tr>
{% endfor %}
</tbody>
Expand Down
14 changes: 10 additions & 4 deletions tests/test_views.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import pytest
from django.urls import reverse
from waffle.testutils import override_switch


class TestHomePage:
Expand Down Expand Up @@ -41,10 +42,15 @@ def test_bad_form(self, client):


class TestTableView:
def test_table(self, client):
response = client.get(
reverse("home:details", kwargs={"urn": "fake", "result_type": "table"})
)
@pytest.mark.parametrize("switch_bool", [True, False])
@pytest.mark.django_db
def test_table(self, client, switch_bool):
with override_switch(
name="show_is_nullable_in_table_details_column", active=switch_bool
):
response = client.get(
reverse("home:details", kwargs={"urn": "fake", "result_type": "table"})
)
assert response.status_code == 200
assert response.headers["Cache-Control"] == "max-age=300, private"

Expand Down

0 comments on commit c5b8459

Please sign in to comment.