fix(test): encoding utf-8 explicite pour read_text

Corrige les lectures de fichiers frontend qui echouent selon la locale par defaut.
This commit is contained in:
2026-08-25 09:13:06 -04:00
parent c6a1f8f54f
commit 077bfc0b6a
+47 -47
View File
@@ -24,7 +24,7 @@ class TestPaneManagerModuleStructure:
@pytest.fixture(autouse=True) @pytest.fixture(autouse=True)
def _load(self): def _load(self):
self.path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" self.path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
self.content = self.path.read_text() self.content = self.path.read_text(encoding="utf-8")
def test_file_exists(self): def test_file_exists(self):
assert self.path.exists() assert self.path.exists()
@@ -78,7 +78,7 @@ class TestPaneManagerDataFlow:
def test_tab_drag_payload_format(self): def test_tab_drag_payload_format(self):
"""dragstart sets correct JSON payload on text/plain.""" """dragstart sets correct JSON payload on text/plain."""
path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
# Must use JSON.stringify for paneId/tabId/index # Must use JSON.stringify for paneId/tabId/index
assert 'JSON.stringify' in content assert 'JSON.stringify' in content
assert 'paneId' in content assert 'paneId' in content
@@ -87,13 +87,13 @@ class TestPaneManagerDataFlow:
def test_tree_drag_format(self): def test_tree_drag_format(self):
"""Tree drags use 'tree:' prefix to distinguish from tab drags.""" """Tree drags use 'tree:' prefix to distinguish from tab drags."""
path = PROJECT_ROOT / "frontend" / "js" / "dragdrop.js" path = PROJECT_ROOT / "frontend" / "js" / "dragdrop.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "tree:" in content assert "tree:" in content
def test_singleton_dragstart_uses_json(self): def test_singleton_dragstart_uses_json(self):
"""Singleton TabManager dragstart uses JSON format, not plain index.""" """Singleton TabManager dragstart uses JSON format, not plain index."""
path = PROJECT_ROOT / "frontend" / "js" / "ui.js" path = PROJECT_ROOT / "frontend" / "js" / "ui.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
# Should have JSON.stringify in dragstart # Should have JSON.stringify in dragstart
dragstart_section = content.split('"dragstart"')[1].split('"dragend"')[0] \ dragstart_section = content.split('"dragstart"')[1].split('"dragend"')[0] \
if '"dragstart"' in content else "" if '"dragstart"' in content else ""
@@ -104,32 +104,32 @@ class TestPaneManagerDataFlow:
def test_singleton_drop_handles_json(self): def test_singleton_drop_handles_json(self):
"""Singleton TabManager drop handler parses JSON with fallback.""" """Singleton TabManager drop handler parses JSON with fallback."""
path = PROJECT_ROOT / "frontend" / "js" / "ui.js" path = PROJECT_ROOT / "frontend" / "js" / "ui.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert 'JSON.parse' in content assert 'JSON.parse' in content
def test_drop_handler_handles_tree_drags(self): def test_drop_handler_handles_tree_drags(self):
"""Container drop handler checks for 'tree:' prefix.""" """Container drop handler checks for 'tree:' prefix."""
path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "startsWith('tree:')" in content or '.startsWith("tree:")' in content assert "startsWith('tree:')" in content or '.startsWith("tree:")' in content
def test_drop_handler_handles_tab_drags(self): def test_drop_handler_handles_tab_drags(self):
"""Container drop handler handles tab JSON payloads.""" """Container drop handler handles tab JSON payloads."""
path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "'text/plain'" in content or '"text/plain"' in content assert "'text/plain'" in content or '"text/plain"' in content
def test_migration_logic_exists(self): def test_migration_logic_exists(self):
"""Tab migration singleton→PaneTabManager exists in _buildGrid.""" """Tab migration singleton→PaneTabManager exists in _buildGrid."""
path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "_singletonTabManager" in content assert "_singletonTabManager" in content
assert "_tabs" in content assert "_tabs" in content
def test_reverse_migration_exists(self): def test_reverse_migration_exists(self):
"""Tab migration PaneTabManager→singleton exists in _collapseToSingle.""" """Tab migration PaneTabManager→singleton exists in _collapseToSingle."""
path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
# _collapseToSingle should reference _singletonTabManager # _collapseToSingle should reference _singletonTabManager
collapse_section = content.split("_collapseToSingle()")[1].split(" },")[0] \ collapse_section = content.split("_collapseToSingle()")[1].split(" },")[0] \
if "_collapseToSingle()" in content else "" if "_collapseToSingle()" in content else ""
@@ -140,13 +140,13 @@ class TestPaneManagerDataFlow:
def test_localstorage_key(self): def test_localstorage_key(self):
"""Persistence uses 'obsigate-panes' key.""" """Persistence uses 'obsigate-panes' key."""
path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "obsigate-panes" in content assert "obsigate-panes" in content
def test_localstorage_payload_structure(self): def test_localstorage_payload_structure(self):
"""_persist saves layout, panes array with id/width/activeTab/tabs.""" """_persist saves layout, panes array with id/width/activeTab/tabs."""
path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "layout" in content assert "layout" in content
assert "panes" in content assert "panes" in content
assert "obsigate-panes" in content assert "obsigate-panes" in content
@@ -158,14 +158,14 @@ class TestPaneManagerDOMFlow:
def test_build_grid_creates_pane_containers(self): def test_build_grid_creates_pane_containers(self):
"""_buildGrid creates .pane-grid and .pane-container elements.""" """_buildGrid creates .pane-grid and .pane-container elements."""
path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "pane-grid" in content assert "pane-grid" in content
assert "pane-container" in content assert "pane-container" in content
def test_create_pane_suffixes_ids(self): def test_create_pane_suffixes_ids(self):
"""Pane IDs are suffixed: tab-bar-N, tab-list-N, content-area-N.""" """Pane IDs are suffixed: tab-bar-N, tab-list-N, content-area-N."""
path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "tab-bar-' +" in content or 'tab-bar-" +' in content or \ assert "tab-bar-' +" in content or 'tab-bar-" +' in content or \
"`tab-bar-" in content "`tab-bar-" in content
assert "content-area-' +" in content or 'content-area-" +' in content or \ assert "content-area-' +" in content or 'content-area-" +' in content or \
@@ -174,14 +174,14 @@ class TestPaneManagerDOMFlow:
def test_pane_zero_reuses_original_ids(self): def test_pane_zero_reuses_original_ids(self):
"""Pane 0 reuses #tab-bar and #content-area (no suffix).""" """Pane 0 reuses #tab-bar and #content-area (no suffix)."""
path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "id === 0" in content or "i === 0" in content assert "id === 0" in content or "i === 0" in content
def test_panes_remain_visible_when_inactive(self): def test_panes_remain_visible_when_inactive(self):
"""Split view keeps all panes visible — no display:none hiding. """Split view keeps all panes visible — no display:none hiding.
Lazy rendering optimization removed because it broke split visibility.""" Lazy rendering optimization removed because it broke split visibility."""
path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
active_section = content.split("setActivePane(paneId)")[1].split(" },")[0] \ active_section = content.split("setActivePane(paneId)")[1].split(" },")[0] \
if "setActivePane(paneId)" in content else "" if "setActivePane(paneId)" in content else ""
# setActivePane should NOT hide inactive panes (they must stay visible) # setActivePane should NOT hide inactive panes (they must stay visible)
@@ -192,7 +192,7 @@ class TestPaneManagerDOMFlow:
def test_collapse_restores_original_dom(self): def test_collapse_restores_original_dom(self):
"""_collapseToSingle restores #tab-bar and #content-area IDs.""" """_collapseToSingle restores #tab-bar and #content-area IDs."""
path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "_collapseToSingle" in content assert "_collapseToSingle" in content
# Should reference tab-bar and content-area restoration # Should reference tab-bar and content-area restoration
assert "tab-bar" in content assert "tab-bar" in content
@@ -201,14 +201,14 @@ class TestPaneManagerDOMFlow:
def test_empty_pane_closes_itself(self): def test_empty_pane_closes_itself(self):
"""When all tabs are closed in a non-last pane, the pane closes.""" """When all tabs are closed in a non-last pane, the pane closes."""
path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "closePane(this.paneId)" in content or \ assert "closePane(this.paneId)" in content or \
"closePane(" in content "closePane(" in content
def test_transfer_tab_empties_source(self): def test_transfer_tab_empties_source(self):
"""transferTabTo removes tab from source and adds to target.""" """transferTabTo removes tab from source and adds to target."""
path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
transfer_section = content.split("transferTabTo(")[1].split(" },")[0] \ transfer_section = content.split("transferTabTo(")[1].split(" },")[0] \
if "transferTabTo(" in content else "" if "transferTabTo(" in content else ""
assert "_tabs.splice" in content # removal assert "_tabs.splice" in content # removal
@@ -220,34 +220,34 @@ class TestPaneManagerKeyboardShortcuts:
def test_split_right_shortcut(self): def test_split_right_shortcut(self):
path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
# Ctrl+Alt+\ → splitRight # Ctrl+Alt+\ → splitRight
assert "splitRight()" in content assert "splitRight()" in content
def test_split_down_shortcut(self): def test_split_down_shortcut(self):
path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "splitDown()" in content assert "splitDown()" in content
def test_close_pane_shortcut(self): def test_close_pane_shortcut(self):
path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "closeActivePane()" in content assert "closeActivePane()" in content
def test_close_other_panes_shortcut(self): def test_close_other_panes_shortcut(self):
path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "closeOtherPanes()" in content assert "closeOtherPanes()" in content
def test_navigate_panes_shortcut(self): def test_navigate_panes_shortcut(self):
path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "ArrowRight" in content assert "ArrowRight" in content
assert "ArrowLeft" in content assert "ArrowLeft" in content
def test_all_shortcuts_have_prevent_default(self): def test_all_shortcuts_have_prevent_default(self):
path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
shortcut_section = content.split("// Keyboard shortcuts")[1].split("// Init")[0] \ shortcut_section = content.split("// Keyboard shortcuts")[1].split("// Init")[0] \
if "// Keyboard shortcuts" in content else "" if "// Keyboard shortcuts" in content else ""
prevent_count = shortcut_section.count("preventDefault()") prevent_count = shortcut_section.count("preventDefault()")
@@ -259,19 +259,19 @@ class TestPaneManagerContextMenu:
def test_menu_has_split_actions(self): def test_menu_has_split_actions(self):
path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "Diviser à droite" in content assert "Diviser à droite" in content
assert "Diviser en bas" in content assert "Diviser en bas" in content
assert "Fermer le panneau" in content assert "Fermer le panneau" in content
def test_menu_has_move_to_submenu(self): def test_menu_has_move_to_submenu(self):
path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "Déplacer vers" in content assert "Déplacer vers" in content
def test_menu_has_close_actions(self): def test_menu_has_close_actions(self):
path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "Fermer</span>" in content or "Fermer" in content assert "Fermer</span>" in content or "Fermer" in content
assert "Fermer les autres" in content assert "Fermer les autres" in content
assert "Fermer à droite" in content assert "Fermer à droite" in content
@@ -279,7 +279,7 @@ class TestPaneManagerContextMenu:
def test_ui_singleton_menu_has_split_actions(self): def test_ui_singleton_menu_has_split_actions(self):
path = PROJECT_ROOT / "frontend" / "js" / "ui.js" path = PROJECT_ROOT / "frontend" / "js" / "ui.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "Diviser à droite" in content assert "Diviser à droite" in content
assert "Diviser en bas" in content assert "Diviser en bas" in content
@@ -289,43 +289,43 @@ class TestPaneManagerCSS:
def test_pane_grid_css(self): def test_pane_grid_css(self):
path = PROJECT_ROOT / "frontend" / "style.css" path = PROJECT_ROOT / "frontend" / "style.css"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert ".pane-grid" in content assert ".pane-grid" in content
assert "display: grid" in content assert "display: grid" in content
def test_pane_container_css(self): def test_pane_container_css(self):
path = PROJECT_ROOT / "frontend" / "style.css" path = PROJECT_ROOT / "frontend" / "style.css"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert ".pane-container" in content assert ".pane-container" in content
assert "position: relative" in content # needed for drop indicators assert "position: relative" in content # needed for drop indicators
def test_resize_handle_css(self): def test_resize_handle_css(self):
path = PROJECT_ROOT / "frontend" / "style.css" path = PROJECT_ROOT / "frontend" / "style.css"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert ".pane-resize-handle" in content assert ".pane-resize-handle" in content
# Cursor (col-resize/row-resize) is set in JS, not CSS # Cursor (col-resize/row-resize) is set in JS, not CSS
js = (PROJECT_ROOT / "frontend" / "js" / "pane-manager.js").read_text() js = (PROJECT_ROOT / "frontend" / "js" / "pane-manager.js").read_text(encoding="utf-8")
assert "col-resize" in js or "row-resize" in js assert "col-resize" in js or "row-resize" in js
def test_drop_zone_indicator_css(self): def test_drop_zone_indicator_css(self):
path = PROJECT_ROOT / "frontend" / "style.css" path = PROJECT_ROOT / "frontend" / "style.css"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "pane-drop-zone-indicator" in content assert "pane-drop-zone-indicator" in content
def test_tab_split_buttons_css(self): def test_tab_split_buttons_css(self):
path = PROJECT_ROOT / "frontend" / "style.css" path = PROJECT_ROOT / "frontend" / "style.css"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert ".tab-split-buttons" in content assert ".tab-split-buttons" in content
assert ".tab-split-btn" in content assert ".tab-split-btn" in content
def test_drop_target_css(self): def test_drop_target_css(self):
path = PROJECT_ROOT / "frontend" / "style.css" path = PROJECT_ROOT / "frontend" / "style.css"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert ".tab-bar.drop-target" in content assert ".tab-bar.drop-target" in content
def test_responsive_css(self): def test_responsive_css(self):
path = PROJECT_ROOT / "frontend" / "style.css" path = PROJECT_ROOT / "frontend" / "style.css"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "@media (max-width: 768px)" in content assert "@media (max-width: 768px)" in content
# Should hide non-first panes on mobile # Should hide non-first panes on mobile
assert "not(:first-child)" in content assert "not(:first-child)" in content
@@ -336,28 +336,28 @@ class TestPaneManagerHTML:
def test_content_wrapper_exists(self): def test_content_wrapper_exists(self):
path = PROJECT_ROOT / "frontend" / "index.html" path = PROJECT_ROOT / "frontend" / "index.html"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert 'class="content-wrapper"' in content assert 'class="content-wrapper"' in content
def test_tab_bar_exists(self): def test_tab_bar_exists(self):
path = PROJECT_ROOT / "frontend" / "index.html" path = PROJECT_ROOT / "frontend" / "index.html"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert 'id="tab-bar"' in content assert 'id="tab-bar"' in content
assert 'id="tab-list"' in content assert 'id="tab-list"' in content
def test_content_area_exists(self): def test_content_area_exists(self):
path = PROJECT_ROOT / "frontend" / "index.html" path = PROJECT_ROOT / "frontend" / "index.html"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert 'id="content-area"' in content assert 'id="content-area"' in content
def test_es_modules_loaded(self): def test_es_modules_loaded(self):
path = PROJECT_ROOT / "frontend" / "index.html" path = PROJECT_ROOT / "frontend" / "index.html"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert 'type="module"' in content assert 'type="module"' in content
def test_pane_manager_imported_in_app(self): def test_pane_manager_imported_in_app(self):
path = PROJECT_ROOT / "frontend" / "js" / "app.js" path = PROJECT_ROOT / "frontend" / "js" / "app.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "pane-manager.js" in content or "PaneManager" in content assert "pane-manager.js" in content or "PaneManager" in content
@@ -366,7 +366,7 @@ class TestPaneManagerPalette:
def test_palette_has_split_commands(self): def test_palette_has_split_commands(self):
path = PROJECT_ROOT / "frontend" / "js" / "palette.js" path = PROJECT_ROOT / "frontend" / "js" / "palette.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "Diviser à droite" in content assert "Diviser à droite" in content
assert "Diviser en bas" in content assert "Diviser en bas" in content
assert "Fermer le panneau actif" in content assert "Fermer le panneau actif" in content
@@ -375,12 +375,12 @@ class TestPaneManagerPalette:
def test_palette_has_reset_command(self): def test_palette_has_reset_command(self):
path = PROJECT_ROOT / "frontend" / "js" / "palette.js" path = PROJECT_ROOT / "frontend" / "js" / "palette.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "Réinitialiser les panneaux" in content assert "Réinitialiser les panneaux" in content
def test_palette_category_panneaux(self): def test_palette_category_panneaux(self):
path = PROJECT_ROOT / "frontend" / "js" / "palette.js" path = PROJECT_ROOT / "frontend" / "js" / "palette.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "cat:'Panneaux'" in content or 'cat:"Panneaux"' in content assert "cat:'Panneaux'" in content or 'cat:"Panneaux"' in content
@@ -389,7 +389,7 @@ class TestEditorLock:
def test_editor_lock_check_exists(self): def test_editor_lock_check_exists(self):
path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
# The 'open' method should check other panes for same file # The 'open' method should check other panes for same file
open_section = content.split("async open(vault, path)")[1].split(" async")[0] \ open_section = content.split("async open(vault, path)")[1].split(" async")[0] \
if "async open(vault, path)" in content else content if "async open(vault, path)" in content else content
@@ -399,7 +399,7 @@ class TestEditorLock:
def test_editor_lock_focuses_existing(self): def test_editor_lock_focuses_existing(self):
path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js" path = PROJECT_ROOT / "frontend" / "js" / "pane-manager.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
assert "setActivePane" in content assert "setActivePane" in content
assert "focus" in content.lower() or "activate" in content.lower() assert "focus" in content.lower() or "activate" in content.lower()
@@ -488,7 +488,7 @@ class TestDashboardRegression:
def test_dashboard_uses_tabmanager_not_openfile(self, client): def test_dashboard_uses_tabmanager_not_openfile(self, client):
"""Dashboard must use TabManager.openPreview, not openFile directly.""" """Dashboard must use TabManager.openPreview, not openFile directly."""
path = PROJECT_ROOT / "frontend" / "js" / "dashboard.js" path = PROJECT_ROOT / "frontend" / "js" / "dashboard.js"
content = path.read_text() content = path.read_text(encoding="utf-8")
# openFile should NOT be called directly from dashboard click handlers # openFile should NOT be called directly from dashboard click handlers
card_click = content.split("card.addEventListener")[1].split("});")[0] \ card_click = content.split("card.addEventListener")[1].split("});")[0] \
if "card.addEventListener" in content else "" if "card.addEventListener" in content else ""