Show sort arrow on primary key by default

Closes #677. Refs #702.
This commit is contained in:
Simon Willison 2020-03-21 16:57:37 -07:00
commit 2c0e1e09bc
2 changed files with 27 additions and 5 deletions

View file

@ -462,7 +462,7 @@ def test_table_html_simple_primary_key(app_client):
table = Soup(response.body, "html.parser").find("table")
assert table["class"] == ["rows-and-columns"]
ths = table.findAll("th")
assert "id" == ths[0].find("a").string.strip()
assert "id\xa0" == ths[0].find("a").string.strip()
for expected_col, th in zip(("content",), ths[1:]):
a = th.find("a")
assert expected_col == a.string
@ -582,6 +582,15 @@ def test_table_html_no_primary_key(app_client):
]
def test_rowid_sortable_no_primary_key(app_client):
response = app_client.get("/fixtures/no_primary_key")
assert response.status == 200
table = Soup(response.body, "html.parser").find("table")
assert table["class"] == ["rows-and-columns"]
ths = table.findAll("th")
assert "rowid\xa0" == ths[1].find("a").string.strip()
def test_row_html_no_primary_key(app_client):
response = app_client.get("/fixtures/no_primary_key/1")
assert response.status == 200