Add HTML5 authoring diff preview
CI / python (push) Has been cancelled
CI / rust (push) Has been cancelled

This commit is contained in:
2026-05-16 23:24:42 +03:00
parent b7876db8ef
commit c14db34f14
3 changed files with 101 additions and 0 deletions
+26
View File
@@ -115,6 +115,8 @@ def test_html5_server_rendered_project_editor(tmp_path: Path):
assert "data-html5-authoring-preview" in editor.text
assert "data-html5-authoring-preview-form" in editor.text
assert f'hx-post="/html5/projects/{project_id}/authoring/completion-preview"' in editor.text
assert "data-html5-authoring-diff-form" in editor.text
assert f'hx-post="/html5/projects/{project_id}/authoring/semantic-diff-preview"' in editor.text
assert "data-html5-authoring-changes" in editor.text
assert f'hx-get="/html5/projects/{project_id}/authoring/changes"' in editor.text
assert 'hx-get="/html5/projects/' in editor.text
@@ -2296,6 +2298,30 @@ def test_authoring_context_and_completion_preview(tmp_path: Path):
assert "ADD" in html5_preview.text
assert "<html" not in html5_preview.text
html5_diff_preview = client.post(
f"/html5/projects/{project_id}/authoring/semantic-diff-preview",
data={
"routine_name": "Проведение",
"source_path": str(module),
"original_text": source_text,
"proposed_text": source_text.replace(
" Сумма = 0;",
" Сумма = 0;\n Если Отказ Тогда\n Возврат;\n КонецЕсли;",
),
"task_id": "task.authoring",
"session_id": "session.authoring",
"user_id": "dev.ivan",
},
)
assert html5_diff_preview.status_code == 200
assert "text/html" in html5_diff_preview.headers["content-type"]
assert "data-html5-authoring-diff-result" in html5_diff_preview.text
assert "Diff preview" in html5_diff_preview.text
assert "Если Отказ Тогда" in html5_diff_preview.text
assert "task-session" in html5_diff_preview.text
assert "BLOCKED" in html5_diff_preview.text
assert "<html" not in html5_diff_preview.text
diff_preview = client.post(
f"/projects/{project_id}/authoring/semantic-diff-preview",
json={