Add server-rendered HTML5 shell with SSE
CI / python (push) Has been cancelled
CI / rust (push) Has been cancelled

This commit is contained in:
2026-05-16 21:10:39 +03:00
parent 523a756f5c
commit 567b517699
3 changed files with 335 additions and 1 deletions
+40
View File
@@ -82,6 +82,46 @@ def test_metadata_catalog_exposes_1c_tree_structure():
assert data_composition_schema["parent_groups"] == ["СКД"]
def test_html5_server_rendered_project_editor(tmp_path: Path):
client = TestClient(app)
project_id = f"html5-editor-{uuid4()}"
module = tmp_path / "demo_module.bsl"
module.write_text(
"Процедура Проверить()\n"
" Сообщить(\"HTML5\");\n"
"КонецПроцедуры\n",
encoding="utf-8",
)
indexed = client.post("/projects/index", json={"path": str(tmp_path), "project_id": project_id})
assert indexed.status_code == 200
index = client.get("/html5")
assert index.status_code == 200
assert "text/html" in index.headers["content-type"]
assert 'data-html5-page="projects"' in index.text
assert project_id in index.text
assert "__next" not in index.text
editor = client.get(f"/html5/projects/{project_id}/editor", params={"q": "Проверить"})
assert editor.status_code == 200
assert 'data-html5-page="editor"' in editor.text
assert "data-html5-editor" in editor.text
assert "data-html5-symbol-results" in editor.text
assert "hx-ext=\"sse\"" in editor.text
assert f"sse-connect=\"/html5/projects/{project_id}/events\"" in editor.text
assert "htmx.org" in editor.text
assert "htmx-ext-sse" in editor.text
assert "client-js: htmx+sse only" in editor.text
assert "Проверить" in editor.text
assert "__next" not in editor.text
with client.stream("GET", f"/html5/projects/{project_id}/events?once=1") as events:
first_chunk = next(events.iter_text())
assert "event: status" in first_chunk
assert "data:" in first_chunk
assert project_id in first_chunk
def test_project_setup_mock_import_indexes_project():
client = TestClient(app)
project_id = f"setup-import-{uuid4()}"