"""7.66.0 — Escape du menu slash retire le « / » + bouton commenter à droite du bloc.""" from pathlib import Path ROOT = Path(__file__).resolve().parent.parent EDITOR_JS = (ROOT / "static" / "js" / "page_editor_scripts.js").read_text(encoding="utf-8") APP_CSS = (ROOT / "static" / "css" / "app.css").read_text(encoding="utf-8") def test_slash_escape_removes_the_slash(): # une seule implémentation, appelée par les deux chemins (focus dans le bloc # → onKd ; focus dans l'entrée du menu → listener document) assert "escClose(){" in EDITOR_JS assert EDITOR_JS.count("SM.escClose();") == 2 # ne retire que le « / » d'ouverture, remet le caret et sauvegarde assert "n.nodeValue=v.slice(0,at)+v.slice(at+1);" in EDITOR_JS assert "E.sync();E.dirty=true;E.autoSave();" in EDITOR_JS def test_comment_button_on_the_right_of_the_block(): # émis APRÈS le contenu du bloc → à droite dans le flex du wrapper i_tpl = EDITOR_JS.index("const cmtBtn=") i_content = EDITOR_JS.index('class="${cls}">${inner}', i_tpl) i_btn = EDITOR_JS.index("${cmtBtn}", i_tpl) assert i_content < i_btn # icône bulle de conversation +, ancre = commentaire du bloc assert 'onclick="E.commentBlock(${idx})"' in EDITOR_JS assert EDITOR_JS.count('' in EDITOR_JS # le + dans la bulle # l'ancien .block-actions mort (opacity:0 sans survol) a disparu de renderBlock assert "const actions=idx>=0?" not in EDITOR_JS def test_comment_button_style_and_visibility(): assert ".block-comment-btn {" in APP_CSS assert "right: -60px;" in APP_CSS # gouttière 64px, comme .block-actions assert ".block-wrapper:hover .block-comment-btn," in APP_CSS assert ".block-comment-btn:hover {" in APP_CSS # masqué partout où le handle l'est : mobile (2 breakpoints) + page verrouillée assert APP_CSS.count(".block-comment-btn { display: none; }") == 2 assert "body.page-locked .block-comment-btn," in APP_CSS