Serve HTML5 styles as static asset
This commit is contained in:
@@ -34,6 +34,8 @@ def assert_html5_contract(text: str, *markers: str, full_page: bool = False) ->
|
||||
assert 'hx-trigger="every' not in text
|
||||
if full_page:
|
||||
assert "<!doctype html>" in text
|
||||
assert "<style>" not in text
|
||||
assert "/html5/assets/html5.css" in text
|
||||
assert "/html5/assets/htmx.min.js" in text
|
||||
assert "/html5/assets/htmx-ext-sse.js" in text
|
||||
else:
|
||||
@@ -150,14 +152,17 @@ def test_html5_server_rendered_project_editor(tmp_path: Path):
|
||||
assert 'hx-swap="outerHTML"' in editor.text
|
||||
assert "hx-ext=\"sse\"" in editor.text
|
||||
assert f"sse-connect=\"/html5/projects/{project_id}/events\"" in editor.text
|
||||
assert '/html5/assets/html5.css' in editor.text
|
||||
assert '/html5/assets/htmx.min.js' in editor.text
|
||||
assert '/html5/assets/htmx-ext-sse.js' in editor.text
|
||||
assert "unpkg.com" not in editor.text
|
||||
assert "client-js: htmx+sse only" in editor.text
|
||||
assert ".object-actions .button[data-html5-object-action-active" in editor.text
|
||||
assert ".inline-actions" in editor.text
|
||||
assert ".object-breadcrumb" in editor.text
|
||||
assert ".object-summary" in editor.text
|
||||
css = client.get("/html5/assets/html5.css")
|
||||
assert css.status_code == 200
|
||||
assert ".object-actions .button[data-html5-object-action-active" in css.text
|
||||
assert ".inline-actions" in css.text
|
||||
assert ".object-breadcrumb" in css.text
|
||||
assert ".object-summary" in css.text
|
||||
assert "Проверить" in editor.text
|
||||
assert "__next" not in editor.text
|
||||
|
||||
@@ -257,6 +262,10 @@ def test_html5_server_rendered_project_editor(tmp_path: Path):
|
||||
assert sse_asset.status_code == 200
|
||||
assert "javascript" in sse_asset.headers["content-type"]
|
||||
assert "sse" in sse_asset.text
|
||||
css_asset = client.get("/html5/assets/html5.css")
|
||||
assert css_asset.status_code == 200
|
||||
assert "text/css" in css_asset.headers["content-type"]
|
||||
assert ".workspace" in css_asset.text
|
||||
|
||||
|
||||
def test_html5_contracts_are_server_rendered_and_stable(tmp_path: Path):
|
||||
|
||||
Reference in New Issue
Block a user