kopia lustrzana https://github.com/simonw/datasette
_facet selections persist through table form, refs #255
rodzic
514873c629
commit
f4943ca89b
|
@ -81,6 +81,9 @@
|
|||
</div>
|
||||
<label class="sort_by_desc"><input type="checkbox" name="_sort_by_desc"{% if sort_desc %} checked{% endif %}> descending</label>
|
||||
{% endif %}
|
||||
{% for facet in facet_results %}
|
||||
<input type="hidden" name="_facet" value="{{ facet }}">
|
||||
{% endfor %}
|
||||
<input type="submit" value="Apply">
|
||||
</div>
|
||||
</form>
|
||||
|
|
|
@ -201,6 +201,22 @@ def test_sort_links(app_client):
|
|||
] == attrs_and_link_attrs
|
||||
|
||||
|
||||
def test_facets_persist_through_filter_form(app_client):
|
||||
response = app_client.get(
|
||||
'/test_tables/facetable?_facet=planet_id&_facet=city',
|
||||
gather_request=False
|
||||
)
|
||||
assert response.status == 200
|
||||
inputs = Soup(response.body, 'html.parser').find('form').findAll('input')
|
||||
hiddens = [i for i in inputs if i['type'] == 'hidden']
|
||||
assert [
|
||||
('_facet', 'planet_id'),
|
||||
('_facet', 'city'),
|
||||
] == [
|
||||
(hidden['name'], hidden['value']) for hidden in hiddens
|
||||
]
|
||||
|
||||
|
||||
@pytest.mark.parametrize('path,expected_classes', [
|
||||
('/', ['index']),
|
||||
('/test_tables', ['db', 'db-test_tables']),
|
||||
|
|
Ładowanie…
Reference in New Issue