mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
render_cell(value) plugin hook
Still needs performance testing before I merge this into master
This commit is contained in:
parent
295d005ca4
commit
510e01f224
5 changed files with 111 additions and 7 deletions
|
|
@ -3,6 +3,7 @@ from .fixtures import ( # noqa
|
|||
app_client,
|
||||
)
|
||||
import pytest
|
||||
import urllib
|
||||
|
||||
|
||||
def test_plugins_dir_plugin(app_client):
|
||||
|
|
@ -67,3 +68,20 @@ def test_plugins_with_duplicate_js_urls(app_client):
|
|||
) < srcs.index(
|
||||
'https://example.com/plugin2.js'
|
||||
)
|
||||
|
||||
|
||||
def test_plugins_render_cell(app_client):
|
||||
sql = """
|
||||
select '{"href": "http://example.com/", "label":"Example"}'
|
||||
""".strip()
|
||||
path = "/fixtures?" + urllib.parse.urlencode({
|
||||
"sql": sql,
|
||||
})
|
||||
response = app_client.get(path)
|
||||
td = Soup(
|
||||
response.body, "html.parser"
|
||||
).find("table").find("tbody").find("td")
|
||||
a = td.find("a")
|
||||
assert a is not None, str(a)
|
||||
assert a.attrs["href"] == "http://example.com/"
|
||||
assert a.text == "Example"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue