diff --git a/tests/test_ui.py b/tests/test_ui.py new file mode 100644 index 0000000..c750cbb --- /dev/null +++ b/tests/test_ui.py @@ -0,0 +1,35 @@ +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