Files
odysseus/tests/test_document_preview_edit_button.py
T
Alexandre Teixeira 40dbe17a95 Merge lab into test/document-module-set-helper
Resolve the overlap with #19 by preserving the whole-cascade stylesheet
helpers alongside #31's document-source/module-set helpers.

Maintainer validation:
- document/module contract and composition guards: 15 passed
- all 54 touched Python test modules: 366 passed
- py_compile: clean
- git diff --check: clean
2026-09-30 22:56:56 +01:00

27 lines
1008 B
Python

"""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 = document_source()
STYLE_CSS = app_css()
def test_preview_installs_hover_edit_button():
assert "function _installMarkdownPreviewEditButton(preview)" in DOC_JS
assert "button.className = 'doc-preview-hover-edit';" in DOC_JS
assert "_installMarkdownPreviewEditButton(preview);" in DOC_JS
def test_preview_edit_button_enters_write_mode_and_focuses_editor():
assert "_setMarkdownPreviewActive(false, { remember: true });" in DOC_JS
assert "document.getElementById('doc-editor-textarea')?.focus()" in DOC_JS
def test_preview_edit_button_is_hover_revealed_and_sticky():
assert ".doc-md-preview:hover .doc-preview-hover-edit" in STYLE_CSS
assert "position: sticky;" in STYLE_CSS
assert "pointer-events: none;" in STYLE_CSS