mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-10-15 19:32:21 +02:00
refactor(notes): decompose Notes into feature-owned modules (#6713)
* refactor(notes): decompose Notes into feature-owned modules * fix(notes): avoid HTML interpolation in reminder picker * docs(notes): drop checkpoint archives, session logs and publication drafts The N0-N6 tarballs and raw pytest/node logs are not read by any script or test, and the logs carry absolute home-directory paths. Once squashed into dev they would stay in history for good. notes-pr.md and notes-issue.md were the drafts used to open #6712 and #6713, not documentation. notes-validation.md keeps the counts, the checkpoint hashes and implementation.sha256 as the record; local interpreter paths and the local Docker image name are replaced with portable placeholders. * fix(notes): keep the state store raw and stop masonry re-observing after close - state: writes built from views (filter, spread, splice) stored nested read-only views in the store, so structuredClone on a stored note threw DataCloneError. Store writes now unwrap nested views. - layout: a save that resolves after closePanel re-renders the leaving pane and re-created the masonry ResizeObserver that teardown had disposed. Skip creating it once Notes is closed. - index.js: drop 30 imported or declared names that were never used and group the imports at the top. Import order is unchanged. - Revert unrelated punctuation edits in .gitattributes and keep the header comment and docstring first in compare/vote.js and test_notes_dom_xss_helpers.py. Both fixes have a node test that fails on the previous head. * test(notes): make script rejection assertion case-insensitive Address CodeQL js/bad-tag-filter alert #1150 in test-only assertion and refresh Notes evidence manifest checksum. --------- Co-authored-by: Léo <leograndcontact@gmail.com>
This commit is contained in:
co-authored by
Léo
parent
9f8eae72fd
commit
f1a47f3812
@@ -8,32 +8,34 @@ reset is present in openPanel, beside the existing _editingId reset.
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
SRC = Path("static/js/notes.js").read_text(encoding="utf-8")
|
||||
from tests.helpers.notes_source import notes_source
|
||||
|
||||
SRC = notes_source("ui/panel", "ui/filters", "ui/cardRendering", "ui/cardInteractions", "ui/drawing", "infrastructure/storage", "application/state", "ui/toolbar")
|
||||
|
||||
|
||||
def _open_panel_body():
|
||||
start = SRC.index("export function openPanel()")
|
||||
rest = SRC[start + len("export function openPanel()"):]
|
||||
m = re.search(r"\n(?:export\s+)?(?:async\s+)?function ", rest)
|
||||
start = SRC.index("function openPanel()")
|
||||
rest = SRC[start + len("function openPanel()"):]
|
||||
m = re.search(r"\n\s*(?:export\s+)?(?:async\s+)?function ", rest)
|
||||
return rest[: m.start()] if m else rest
|
||||
|
||||
|
||||
def test_open_panel_resets_search_query():
|
||||
body = _open_panel_body()
|
||||
assert "_searchQuery = ''" in body, body[:400]
|
||||
assert "app.setSearchQuery('')" in body, body[:400]
|
||||
# reset must sit with the other open-time state resets, before render
|
||||
assert body.index("_searchQuery = ''") < body.index("_renderNotes") if "_renderNotes" in body else True
|
||||
assert body.index("app.setSearchQuery('')") < body.index("_renderNotes") if "_renderNotes" in body else True
|
||||
|
||||
|
||||
def test_module_still_declares_search_query():
|
||||
assert "let _searchQuery = ''" in SRC
|
||||
assert "searchQuery: ''" in SRC
|
||||
|
||||
|
||||
def test_notes_label_chips_can_be_collapsed_like_calendar_tags():
|
||||
assert "NOTES_LABELS_COLLAPSED_KEY = 'odysseus-notes-labels-collapsed'" in SRC
|
||||
assert "_labelsCollapsed = !_labelsCollapsed" in SRC
|
||||
assert "localStorage.setItem(NOTES_LABELS_COLLAPSED_KEY" in SRC
|
||||
assert "toggle.textContent = _labelsCollapsed ? '+ Tags' : '− Tags';" in SRC
|
||||
assert "app.setLabelsCollapsed(!state.labelsCollapsed)" in SRC
|
||||
assert "persistence.setItem(NOTES_LABELS_COLLAPSED_KEY" in SRC
|
||||
assert "toggle.textContent = state.labelsCollapsed ? '+ Tags' : '− Tags';" in SRC
|
||||
assert "bar.style.display = 'none';" in SRC
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user