mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
parent
4f02c8d4d7
commit
eb53837d2a
3 changed files with 5 additions and 11 deletions
|
|
@ -157,7 +157,7 @@
|
|||
<div class="facet-info facet-{{ database|to_css_class }}-{{ table|to_css_class }}-{{ facet_info.name|to_css_class }}" id="facet-{{ facet_info.name|to_css_class }}" data-column="{{ facet_info.name }}">
|
||||
<p class="facet-info-name">
|
||||
<strong>{{ facet_info.name }}{% if facet_info.type != "column" %} ({{ facet_info.type }}){% endif %}
|
||||
{% if show_facet_counts %} <span class="facet-info-total">{% if facet_info.truncated %}>{% endif %}{{ facet_info.results|length }}</span>{% endif %}
|
||||
<span class="facet-info-total">{% if facet_info.truncated %}>{% endif %}{{ facet_info.results|length }}</span>
|
||||
</strong>
|
||||
{% if facet_info.hideable %}
|
||||
<a href="{{ facet_info.toggle_url }}" class="cross">✖</a>
|
||||
|
|
|
|||
|
|
@ -937,7 +937,6 @@ class TableView(RowTableShared):
|
|||
key=lambda f: (len(f["results"]), f["name"]),
|
||||
reverse=True,
|
||||
),
|
||||
"show_facet_counts": special_args.get("_facet_size") == "max",
|
||||
"extra_wheres_for_ui": extra_wheres_for_ui,
|
||||
"form_hidden_args": form_hidden_args,
|
||||
"is_sortable": any(c["sortable"] for c in display_columns),
|
||||
|
|
|
|||
|
|
@ -1015,24 +1015,19 @@ def test_column_metadata(app_client):
|
|||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("use_facet_size_max", (True, False))
|
||||
def test_facet_total_shown_if_facet_max_size(use_facet_size_max):
|
||||
def test_facet_total():
|
||||
# https://github.com/simonw/datasette/issues/1423
|
||||
# https://github.com/simonw/datasette/issues/1556
|
||||
with make_app_client(settings={"max_returned_rows": 100}) as client:
|
||||
path = "/fixtures/sortable?_facet=content&_facet=pk1"
|
||||
if use_facet_size_max:
|
||||
path += "&_facet_size=max"
|
||||
response = client.get(path)
|
||||
assert response.status == 200
|
||||
fragments = (
|
||||
'<span class="facet-info-total">>100</span>',
|
||||
'<span class="facet-info-total">>30</span>',
|
||||
'<span class="facet-info-total">8</span>',
|
||||
)
|
||||
for fragment in fragments:
|
||||
if use_facet_size_max:
|
||||
assert fragment in response.text
|
||||
else:
|
||||
assert fragment not in response.text
|
||||
assert fragment in response.text
|
||||
|
||||
|
||||
def test_sort_rowid_with_next(app_client):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue