mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Faceting WIP, refs #495
This commit is contained in:
parent
912ce848b9
commit
17e65fc26b
2 changed files with 19 additions and 11 deletions
|
|
@ -385,12 +385,16 @@ def test_facet_display(app_client):
|
|||
] == actual
|
||||
|
||||
|
||||
def test_facets_persist_through_filter_form(app_client):
|
||||
response = app_client.get("/fixtures/facetable?_facet=planet_int&_facet=city_id")
|
||||
@pytest.mark.parametrize("path,expected_hiddens", [
|
||||
("/fixtures/facetable?_facet=planet_int&_facet=city_id", [("_facet", "city_id"), ("_facet", "planet_int")]),
|
||||
("/fixtures/roadside_attractions?_facet_m2m=attraction_characteristic", [("_facet", "city_id"), ("_facet", "planet_int")]),
|
||||
])
|
||||
def test_facets_persist_through_filter_form(app_client, path, expected_hiddens):
|
||||
response = app_client.get(path)
|
||||
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", "city_id"), ("_facet", "planet_int")] == [
|
||||
assert expected_hiddens == [
|
||||
(hidden["name"], hidden["value"]) for hidden in hiddens
|
||||
]
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue