refactor: compose export controller with explicit snapshots and task lifecycle

This commit is contained in:
2026-10-29 19:26:11 +08:00
parent f27482857a
commit a7a5e29cba
11 changed files with 527 additions and 365 deletions
+12
View File
@@ -156,6 +156,18 @@ def test_save_as_missing_image_keeps_original_context(editing, tmp_path):
assert original.read_text() == "# Original"
def test_export_snapshot_keeps_rendering_choices_after_ui_changes(editing, tmp_path):
window, editor, path = editing
window.theme = "dark"
snapshot = window._export_snapshot()
window.theme = "light"
editor.replace_source_undoable("changed later")
output = tmp_path / "snapshot.html"
window.exports._export_web_to_path(output, "html", snapshot)
html = output.read_text(encoding="utf-8")
assert 'data-theme="dark"' in html and "changed later" not in html
def test_save_as_copies_images_and_can_undo_rewritten_urls(editing, tmp_path):
window, editor, original = editing
source = store_image(original, b"image bytes")