zotero-kb/tests/test_ui.py
2026-04-15 12:10:33 +08:00

36 lines
1.3 KiB
Python

from zotero_kb.api import create_app
from zotero_kb.config import AppConfig
def test_index_contains_import_modal_controls(tmp_path) -> None:
app = create_app(
AppConfig(
workspace_dir=tmp_path / "workspace",
zotero_data_dir=tmp_path / "zotero",
bridge_file=tmp_path / "bridge.json",
)
)
for route in app.routes:
if getattr(route, "path", None) == "/" and "GET" in getattr(route, "methods", set()):
html = route.endpoint()
break
else:
raise AssertionError("GET / route not found")
assert 'id="create-project-form"' in html
assert 'id="open-import-modal-button"' in html
assert 'id="import-modal"' in html
assert 'id="close-import-modal-button"' in html
assert 'id="modal-collection-tree"' in html
assert 'id="modal-collection-items"' in html
assert 'id="modal-selected-count"' in html
assert 'id="modal-select-descendants-button"' in html
assert 'id="modal-clear-selection-button"' in html
assert 'id="modal-import-selected-items-button"' in html
assert 'id="item-preview-popover"' in html
assert 'const ABSTRACT_PREVIEW_DELAY_MS = 3000;' in html
assert 'isImportModalOpen: false' in html
assert 'id="recommend-form"' in html
assert 'id="plan-form"' in html