- nouveau bouton .block-insert-btn émis AVANT le handle (6 points) dans le wrapper de chaque bloc de premier niveau : clic → E.addAfter(idx) → addAt(idx+1) → bloc inséré sous le courant et focusé (mécanisme déjà en place, réutilisé tel quel) - position : left:-64px (gouttière .blocks-container = 64px), -56px dans le breakpoint où la gouttière passe à 32px ; apparaît au survol/focus comme le handle ; masqué avec lui sur écran étroit (2 breakpoints) - aria-label + title « Add block below » - tests : tests/test_v760_block_insert_btn.py (2 tests : ordre dans le wrapper, câblage E.addAfter, positions/masquages CSS) - livraison : VERSION + app/main = 7.60.0, OpenAPI 525 chemins, CHANGELOG
30 lines
1.5 KiB
Python
30 lines
1.5 KiB
Python
"""7.60.0 — bouton + à gauche du handle : ajoute un bloc sous le courant."""
|
|
|
|
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_button_rendered_left_of_the_handle():
|
|
# le + est émis AVANT le handle dans le wrapper du bloc
|
|
i_btn = EDITOR_JS.index("class=\"block-insert-btn\"")
|
|
i_handle = EDITOR_JS.index("<div class=\"block-handle\">", i_btn)
|
|
assert i_btn < i_handle
|
|
# clic → insertion sous le bloc courant (mécanisme déjà existant)
|
|
assert 'class="block-insert-btn" title="Add block below" aria-label="Add block below" onclick="E.addAfter(${idx})"' in EDITOR_JS
|
|
# réservé aux blocs de premier niveau (idx valide), comme .block-actions
|
|
assert "const insertBtn=idx>=0?" in EDITOR_JS
|
|
assert "addAfter(idx,type){return this.addAt(idx+1,type);}" in EDITOR_JS
|
|
|
|
|
|
def test_button_style_and_visibility():
|
|
assert ".block-insert-btn {" in APP_CSS
|
|
assert "left: -64px;" in APP_CSS # gouttière .blocks-container (64px)
|
|
assert ".block-wrapper:hover .block-insert-btn," in APP_CSS
|
|
assert ".block-insert-btn:hover {" in APP_CSS
|
|
# suit le handle quand la gouttière passe à 32px, masqué partout où il l'est
|
|
assert ".block-insert-btn { left: -56px; }" in APP_CSS
|
|
assert APP_CSS.count(".block-insert-btn { display: none; }") == 2
|