Fixed bug with table title element, closes #1560

0.60.x
Simon Willison 2022-01-13 14:20:07 -08:00
rodzic 5698e2af01
commit 3658e57ac2
2 zmienionych plików z 20 dodań i 2 usunięć

Wyświetl plik

@ -1,7 +1,6 @@
{% extends "base.html" %}
{% block title %}{{ database }}: {{ table }}: {% if filtered_table_rows_count or filtered_table_rows_count == 0 %}{{ "{:,}".format(filtered_table_rows_count) }} row{% if filtered_table_rows_count == 1 %}{% else %}s{% endif %}{% endif %}
{% if human_description_en %}where {{ human_description_en }}{% endif %}{% endblock %}
{% block title %}{{ database }}: {{ table }}: {% if filtered_table_rows_count or filtered_table_rows_count == 0 %}{{ "{:,}".format(filtered_table_rows_count) }} row{% if filtered_table_rows_count == 1 %}{% else %}s{% endif %}{% endif %}{% if human_description_en %} {{ human_description_en }}{% endif %}{% endblock %}
{% block extra_head %}
{{ super() }}

Wyświetl plik

@ -1038,3 +1038,22 @@ def test_sort_rowid_with_next(app_client):
def assert_querystring_equal(expected, actual):
assert sorted(expected.split("&")) == sorted(actual.split("&"))
@pytest.mark.parametrize(
"path,expected",
(
(
"/fixtures/facetable",
"fixtures: facetable: 15 rows",
),
(
"/fixtures/facetable?on_earth__exact=1",
"fixtures: facetable: 14 rows where on_earth = 1",
),
),
)
def test_table_page_title(app_client, path, expected):
response = app_client.get(path)
title = Soup(response.text, "html.parser").find("title").text
assert title == expected