Skip to content

Self-hosted AI workspace.

Python

Merge lab into test/document-module-set-helper

Alexandre Teixeira40dbe17a9547
diff --cc tests/test_document_edit_reference_js.py
index 9d255933c,65b607598..9ee7842ff
--- a/tests/test_document_edit_reference_js.py
+++ b/tests/test_document_edit_reference_js.py
@@@ -1,13 -1,13 +1,14 @@@
"""Regression guards for document-selection references in chat bubbles."""
from pathlib import Path
+ from tests.helpers.stylesheets import app_css
+from tests.helpers.document_source import document_source
ROOT = Path(__file__).resolve().parents[1]
RENDERER = (ROOT / "static/js/chatRenderer.js").read_text(encoding="utf-8")
-DOCUMENT = (ROOT / "static/js/document.js").read_text(encoding="utf-8")
+DOCUMENT = document_source()
- STYLE = (ROOT / "static/style.css").read_text(encoding="utf-8")
+ STYLE = app_css()
INDEX = (ROOT / "static/index.html").read_text(encoding="utf-8")
APP = (ROOT / "static/app.js").read_text(encoding="utf-8")
diff --cc tests/test_document_editor_scroll.py
index a205131dc,1023cab2f..a84876dd8
--- a/tests/test_document_editor_scroll.py
+++ b/tests/test_document_editor_scroll.py
@@@ -9,12 -9,12 +9,12 @@@ document.js is browser-coupled and not
"""
from pathlib import Path
+ from tests.helpers.stylesheets import app_css
-
+from tests.helpers.document_source import document_source
-
ROOT = Path(__file__).resolve().parents[1]
-DOC_JS = (ROOT / "static/js/document.js").read_text(encoding="utf-8")
+DOC_JS = document_source()
- STYLE_CSS = (ROOT / "static/style.css").read_text(encoding="utf-8")
+ STYLE_CSS = app_css()
def test_document_textarea_scrollbar_is_visible():
diff --cc tests/test_document_history_controls.py
index 5b4894e5c,ddffe6e69..709937586
--- a/tests/test_document_history_controls.py
+++ b/tests/test_document_history_controls.py
@@@ -3,7 -3,7 +3,8 @@@
import json
import subprocess
from pathlib import Path
+ from tests.helpers.stylesheets import stylesheet_link_tags
+from tests.helpers.document_source import document_source
ROOT = Path(__file__).resolve().parents[1]
diff --cc tests/test_document_outline.py
index 9cf365231,63f4ebc90..ae5859b20
--- a/tests/test_document_outline.py
+++ b/tests/test_document_outline.py
@@@ -3,12 -3,13 +3,13 @@@
import json
import subprocess
from pathlib import Path
+ from tests.helpers.stylesheets import app_css
+ from tests.helpers.stylesheets import stylesheet_link_tags
-
+from tests.helpers.document_source import document_source
-
ROOT = Path(__file__).resolve().parents[1]
-DOC_JS = (ROOT / "static/js/document.js").read_text(encoding="utf-8")
+DOC_JS = document_source()
- STYLE = (ROOT / "static/style.css").read_text(encoding="utf-8")
+ STYLE = app_css()
def _run_node(script: str):
diff --cc tests/test_document_preview_edit_button.py
index 2ceb077a2,ffe44f386..9eaa5708e
--- a/tests/test_document_preview_edit_button.py
+++ b/tests/test_document_preview_edit_button.py
@@@ -1,12 -1,12 +1,12 @@@
"""Regression guards for the Markdown preview hover-to-edit control."""
from pathlib import Path
+ from tests.helpers.stylesheets import app_css
-
+from tests.helpers.document_source import document_source
-
ROOT = Path(__file__).resolve().parents[1]
-DOC_JS = (ROOT / "static/js/document.js").read_text(encoding="utf-8")
+DOC_JS = document_source()
- STYLE_CSS = (ROOT / "static/style.css").read_text(encoding="utf-8")
+ STYLE_CSS = app_css()
def test_preview_installs_hover_edit_button():
diff --cc tests/test_document_rich_checklist_enter.py
index 7f886d21b,92154adb0..0e633e284
--- a/tests/test_document_rich_checklist_enter.py
+++ b/tests/test_document_rich_checklist_enter.py
@@@ -3,7 -3,7 +3,8 @@@
import json
import subprocess
from pathlib import Path
+ from tests.helpers.stylesheets import stylesheet_link_tags
+from tests.helpers.document_source import document_source
ROOT = Path(__file__).resolve().parents[1]
diff --cc tests/test_document_rich_color_reset_and_contrast.py
index 1b3971e42,7d13fc6c3..9a89e5764
--- a/tests/test_document_rich_color_reset_and_contrast.py
+++ b/tests/test_document_rich_color_reset_and_contrast.py
@@@ -3,12 -3,13 +3,13 @@@
import json
import subprocess
from pathlib import Path
+ from tests.helpers.stylesheets import app_css
+ from tests.helpers.stylesheets import stylesheet_link_tags
-
+from tests.helpers.document_source import document_source
-
ROOT = Path(__file__).resolve().parents[1]
-DOC_JS = (ROOT / "static/js/document.js").read_text(encoding="utf-8")
+DOC_JS = document_source()
- STYLE = (ROOT / "static/style.css").read_text(encoding="utf-8")
+ STYLE = app_css()
def test_color_controls_have_theme_reset_and_split_palettes():
diff --cc tests/test_document_rich_docx_export.py
index 0f9d634be,61cc71ad2..6635051e7
--- a/tests/test_document_rich_docx_export.py
+++ b/tests/test_document_rich_docx_export.py
@@@ -5,7 -5,7 +5,8 @@@ import subproces
import tempfile
import zipfile
from pathlib import Path
+ from tests.helpers.stylesheets import stylesheet_link_tags
+from tests.helpers.document_source import document_source
ROOT = Path(__file__).resolve().parents[1]
diff --cc tests/test_document_rich_find_boundaries.py
index f45176b67,ca2280455..dfc77ef20
--- a/tests/test_document_rich_find_boundaries.py
+++ b/tests/test_document_rich_find_boundaries.py
@@@ -3,7 -3,7 +3,8 @@@
import json
import subprocess
from pathlib import Path
+ from tests.helpers.stylesheets import stylesheet_link_tags
+from tests.helpers.document_source import document_source, function_body
ROOT = Path(__file__).resolve().parents[1]
diff --cc tests/test_document_rich_font_color_controls.py
index 9cd2df299,fa8691c2f..764e6152e
--- a/tests/test_document_rich_font_color_controls.py
+++ b/tests/test_document_rich_font_color_controls.py
@@@ -6,7 -6,7 +6,8 @@@ import subproces
from pathlib import Path
from tests.helpers.stylesheets import app_css
+ from tests.helpers.stylesheets import stylesheet_link_tags
+from tests.helpers.document_source import document_source, function_body
ROOT = Path(__file__).resolve().parents[1]
diff --cc tests/test_document_rich_heading_enter.py
index 2c1c03b78,9a876ca9d..0bd4fe317
--- a/tests/test_document_rich_heading_enter.py
+++ b/tests/test_document_rich_heading_enter.py
@@@ -3,7 -3,7 +3,8 @@@
import json
import subprocess
from pathlib import Path
+ from tests.helpers.stylesheets import stylesheet_link_tags
+from tests.helpers.document_source import document_source, function_body
ROOT = Path(__file__).resolve().parents[1]
diff --cc tests/test_document_rich_image_caption.py
index c09316d4c,b7e04101e..551b9da00
--- a/tests/test_document_rich_image_caption.py
+++ b/tests/test_document_rich_image_caption.py
@@@ -5,7 -5,7 +5,8 @@@ import subproces
from pathlib import Path
from tests.helpers.stylesheets import app_css
+ from tests.helpers.stylesheets import stylesheet_link_tags
+from tests.helpers.document_source import document_source, function_body
ROOT = Path(__file__).resolve().parents[1]
diff --cc tests/test_document_rich_input_rules.py
index aae84456e,cf714fe03..4d697e6c1
--- a/tests/test_document_rich_input_rules.py
+++ b/tests/test_document_rich_input_rules.py
@@@ -5,7 -5,7 +5,8 @@@ import subproces
from pathlib import Path
from tests.helpers.stylesheets import app_css
+ from tests.helpers.stylesheets import stylesheet_link_tags
+from tests.helpers.document_source import document_source
ROOT = Path(__file__).resolve().parents[1]
diff --cc tests/test_document_rich_selection_toolbar.py
index 93d861d6a,b13977268..76f15a4f3
--- a/tests/test_document_rich_selection_toolbar.py
+++ b/tests/test_document_rich_selection_toolbar.py
@@@ -3,12 -3,13 +3,13 @@@
import json
import subprocess
from pathlib import Path
+ from tests.helpers.stylesheets import app_css
+ from tests.helpers.stylesheets import stylesheet_link_tags
-
+from tests.helpers.document_source import document_source
-
ROOT = Path(__file__).resolve().parents[1]
-DOC_JS = (ROOT / "static/js/document.js").read_text(encoding="utf-8")
+DOC_JS = document_source()
- STYLE = (ROOT / "static/style.css").read_text(encoding="utf-8")
+ STYLE = app_css()
def test_selection_toolbar_uses_shared_formatting_path_and_preserves_range():
diff --cc tests/test_document_rich_slash_menu.py
index 0466721c0,1ade47972..d4e8bd09d
--- a/tests/test_document_rich_slash_menu.py
+++ b/tests/test_document_rich_slash_menu.py
@@@ -3,12 -3,13 +3,13 @@@
import json
import subprocess
from pathlib import Path
+ from tests.helpers.stylesheets import app_css
+ from tests.helpers.stylesheets import stylesheet_link_tags
-
+from tests.helpers.document_source import document_source
-
ROOT = Path(__file__).resolve().parents[1]
-DOC_JS = (ROOT / "static/js/document.js").read_text(encoding="utf-8")
+DOC_JS = document_source()
- STYLE = (ROOT / "static/style.css").read_text(encoding="utf-8")
+ STYLE = app_css()
def test_slash_menu_reuses_rich_text_actions_and_is_accessible():
diff --cc tests/test_document_rich_structure_tools.py
index e7d5090ef,049e7972b..1ff6f9a96
--- a/tests/test_document_rich_structure_tools.py
+++ b/tests/test_document_rich_structure_tools.py
@@@ -3,12 -3,13 +3,13 @@@
import json
import subprocess
from pathlib import Path
+ from tests.helpers.stylesheets import app_css
+ from tests.helpers.stylesheets import stylesheet_link_tags
-
+from tests.helpers.document_source import declaration, document_source, function_body
-
ROOT = Path(__file__).resolve().parents[1]
-DOC_JS = (ROOT / "static/js/document.js").read_text(encoding="utf-8")
+DOC_JS = document_source()
- STYLE = (ROOT / "static/style.css").read_text(encoding="utf-8")
+ STYLE = app_css()
def test_heading_levels_and_page_break_are_exposed_everywhere():
diff --cc tests/test_document_rich_table_cell_alignment.py
index 4f875b5c1,8f07d4231..ac2b850b2
--- a/tests/test_document_rich_table_cell_alignment.py
+++ b/tests/test_document_rich_table_cell_alignment.py
@@@ -3,7 -3,7 +3,8 @@@
import json
import subprocess
from pathlib import Path
+ from tests.helpers.stylesheets import stylesheet_link_tags
+from tests.helpers.document_source import document_source, function_body
ROOT = Path(__file__).resolve().parents[1]
diff --cc tests/test_document_rich_table_header_preservation.py
index 4d0a90384,f08825dd0..378d02828
--- a/tests/test_document_rich_table_header_preservation.py
+++ b/tests/test_document_rich_table_header_preservation.py
@@@ -3,7 -3,7 +3,8 @@@
import json
import subprocess
from pathlib import Path
+ from tests.helpers.stylesheets import stylesheet_link_tags
+from tests.helpers.document_source import document_source, function_body
ROOT = Path(__file__).resolve().parents[1]
diff --cc tests/test_document_rich_table_headers.py
index e5c8fed16,fb52d4630..5d0d67693
--- a/tests/test_document_rich_table_headers.py
+++ b/tests/test_document_rich_table_headers.py
@@@ -3,7 -3,7 +3,8 @@@
import json
import subprocess
from pathlib import Path
+ from tests.helpers.stylesheets import stylesheet_link_tags
+from tests.helpers.document_source import document_source, function_body
ROOT = Path(__file__).resolve().parents[1]
diff --cc tests/test_document_rich_table_merge_split.py
index abecf2b66,6aeb76897..9269c154e
--- a/tests/test_document_rich_table_merge_split.py
+++ b/tests/test_document_rich_table_merge_split.py
@@@ -3,7 -3,7 +3,8 @@@
import json
import subprocess
from pathlib import Path
+ from tests.helpers.stylesheets import stylesheet_link_tags
+from tests.helpers.document_source import document_source, function_body
ROOT = Path(__file__).resolve().parents[1]
diff --cc tests/test_document_rich_table_tab_history.py
index a9af656bb,ec7de0013..cbe116e0b
--- a/tests/test_document_rich_table_tab_history.py
+++ b/tests/test_document_rich_table_tab_history.py
@@@ -3,7 -3,7 +3,8 @@@
import json
import subprocess
from pathlib import Path
+ from tests.helpers.stylesheets import stylesheet_link_tags
+from tests.helpers.document_source import document_source, function_body
ROOT = Path(__file__).resolve().parents[1]
diff --cc tests/test_document_rich_toolbar_menus.py
index eafc997fb,6aa33b379..b6837d0c3
--- a/tests/test_document_rich_toolbar_menus.py
+++ b/tests/test_document_rich_toolbar_menus.py
@@@ -3,12 -3,13 +3,13 @@@
import json
import subprocess
from pathlib import Path
+ from tests.helpers.stylesheets import app_css
+ from tests.helpers.stylesheets import stylesheet_link_tags
-
+from tests.helpers.document_source import document_source
-
ROOT = Path(__file__).resolve().parents[1]
-DOC_JS = (ROOT / "static/js/document.js").read_text(encoding="utf-8")
+DOC_JS = document_source()
- STYLE = (ROOT / "static/style.css").read_text(encoding="utf-8")
+ STYLE = app_css()
def test_rich_toolbar_menus_expose_keyboard_and_context_state():
diff --cc tests/test_document_save_shortcut.py
index d03edaee1,c1265071e..acf833def
--- a/tests/test_document_save_shortcut.py
+++ b/tests/test_document_save_shortcut.py
@@@ -3,7 -3,7 +3,8 @@@
import json
import subprocess
from pathlib import Path
+ from tests.helpers.stylesheets import stylesheet_link_tags
+from tests.helpers.document_source import document_source
ROOT = Path(__file__).resolve().parents[1]
diff --cc tests/test_document_suggestion_highlight.py
index 653773f1d,f2272d66f..8fe6912ac
--- a/tests/test_document_suggestion_highlight.py
+++ b/tests/test_document_suggestion_highlight.py
@@@ -1,12 -1,12 +1,12 @@@
"""Regression guards for exact inline document-suggestion highlighting."""
from pathlib import Path
+ from tests.helpers.stylesheets import app_css
-
+from tests.helpers.document_source import document_source
-
ROOT = Path(__file__).resolve().parents[1]
-DOC_JS = (ROOT / "static/js/document.js").read_text(encoding="utf-8")
+DOC_JS = document_source()
- STYLE_CSS = (ROOT / "static/style.css").read_text(encoding="utf-8")
+ STYLE_CSS = app_css()
def test_suggestion_highlight_measures_exact_referenced_range():
diff --cc tests/test_document_toolbar_arrow_offset.py
index 6f95f8fb7,096586249..3df2232ea
--- a/tests/test_document_toolbar_arrow_offset.py
+++ b/tests/test_document_toolbar_arrow_offset.py
@@@ -1,13 -1,13 +1,14 @@@
from pathlib import Path
+ from tests.helpers.stylesheets import app_css
+from tests.helpers.document_source import document_source
ROOT = Path(__file__).resolve().parents[1]
def test_toolbar_arrows_have_real_flex_slots_outside_icon_scroller():
- script = (ROOT / "static/js/document.js").read_text()
+ script = document_source()
- styles = (ROOT / "static/style.css").read_text()
+ styles = app_css()
leading = script.index('class="md-toolbar-leading-controls"')
left_arrow = script.index('id="md-scroll-left"')
diff --cc tests/test_document_toolbar_order.py
index 683a29aa7,669422830..218067fbc
--- a/tests/test_document_toolbar_order.py
+++ b/tests/test_document_toolbar_order.py
@@@ -3,7 -3,7 +3,8 @@@
import json
import subprocess
from pathlib import Path
+ from tests.helpers.stylesheets import stylesheet_link_tags
+from tests.helpers.document_source import document_source
ROOT = Path(__file__).resolve().parents[1]
diff --cc tests/test_selection_overlay_clear_static.py
index 4dd8ece57,4761f4ff3..1e32c975c
--- a/tests/test_selection_overlay_clear_static.py
+++ b/tests/test_selection_overlay_clear_static.py
@@@ -1,13 -1,13 +1,14 @@@
from pathlib import Path
+ from tests.helpers.stylesheets import app_css
+from tests.helpers.document_source import document_source
ROOT = Path(__file__).resolve().parents[1]
def test_selection_overlays_have_individual_clear_controls():
- js = (ROOT / "static/js/document.js").read_text(encoding="utf-8")
+ js = document_source()
- css = (ROOT / "static/style.css").read_text(encoding="utf-8")
+ css = app_css()
assert "function clearSelectionAt(index)" in js
assert "className = 'doc-selection-overlay-clear'" in js