Files
cms-SiteForge/tests/test_editor_ux_v8211.py
T

24 lines
1.2 KiB
Python
Raw Normal View History

"""V8.21.1 editor integration wiring checks, side effect free."""
from pathlib import Path
ROOT=Path(__file__).resolve().parents[1]
def test_editor_scripts_and_tabs():
template=(ROOT/'app/templates/editor.html').read_text()
js=(ROOT/'app/static/editor.js').read_text()
for marker in ('/ui/editor-helpers.js','id="blockSearch"','id="tabStyle"','id="tabResponsive"','id="studioUndo"','id="studioRedo"','id="previewState"'):
assert marker in template
for marker in ('editorTools.filterBlocks','editorTools.reorder','editorTools.duplicate','shouldAcceptPreview','AbortController','savePromise','applyInspectorTab'):
assert marker in js
def test_studio_keeps_existing_publishing_contract():
js=(ROOT/'app/static/editor.js').read_text()
for marker in ('studio-draft/publish','studio-history','expected_revision','editor-preview','/api/sites/','buildSite()'):
assert marker in js
assert 'localStorage.setItem(' not in js
assert 'eval(' not in js
def test_editor_structure_no_anonymous_iframe_unsafe_permissions():
html=(ROOT/'app/templates/editor.html').read_text()
assert 'sandbox="allow-scripts"' in html
assert 'allow-same-origin' not in html
assert 'aria-label="当前页面区块"' in html