mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
script type=module support, closes #1186
This commit is contained in:
parent
640ac7071b
commit
fa0c3777b8
6 changed files with 74 additions and 24 deletions
|
|
@ -118,16 +118,19 @@ def test_hook_extra_css_urls(app_client, path, expected_decoded_object):
|
|||
def test_hook_extra_js_urls(app_client):
|
||||
response = app_client.get("/")
|
||||
scripts = Soup(response.body, "html.parser").findAll("script")
|
||||
assert [
|
||||
s
|
||||
for s in scripts
|
||||
if s.attrs
|
||||
== {
|
||||
script_attrs = [s.attrs for s in scripts]
|
||||
for attrs in [
|
||||
{
|
||||
"integrity": "SRIHASH",
|
||||
"crossorigin": "anonymous",
|
||||
"src": "https://plugin-example.datasette.io/jquery.js",
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"src": "https://plugin-example.datasette.io/plugin.module.js",
|
||||
"type": "module",
|
||||
},
|
||||
]:
|
||||
assert any(s == attrs for s in script_attrs), "Expected: {}".format(attrs)
|
||||
|
||||
|
||||
def test_plugins_with_duplicate_js_urls(app_client):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue