diff --git a/tests/test_theme_registry.py b/tests/test_theme_registry.py index 59ddff3..e05c486 100644 --- a/tests/test_theme_registry.py +++ b/tests/test_theme_registry.py @@ -204,10 +204,26 @@ def test_trade_pro_templates_have_no_bare_text_arrows(): for f in root.rglob('*.html'): t = f.read_text(encoding='utf-8') body = re.sub(r'\{#.*?#\}', '', t, flags=re.S) - if '→' in body or ('›' in body and 'chevron' not in body): + if any(ch in body for ch in '→←↗↘⌕▾'): offenders.append(str(f.relative_to(root))) + # › 豁免通道收紧为行级:同行的 chevron 语义才放行 + for line in body.splitlines(): + if '›' in line and 'chevron' not in line: + offenders.append(f'{f.relative_to(root)}:›') assert offenders == [] +def test_site_html_arrow_matches_macro_library(): + # 双源防护:site.html 的自包含 tp_arrow 必须与宏库 arrow-right 的 path 一致 + from pathlib import Path + import re + root = Path(__file__).resolve().parent.parent / 'themes' / 'trade-pro' + macro = (root / '_professional_components.html').read_text(encoding='utf-8') + site = (root / 'site.html').read_text(encoding='utf-8') + m = re.search(r"'arrow-right'\s*:\s*'([^']+)'", macro) + s = re.search(r"tp_arrow.*?d=\"([^\"]+)\"", site, flags=re.S) + assert m and s, 'icon path sources not found' + assert m.group(1) == s.group(1), 'site.html tp_arrow drifted from macro library arrow-right' + def test_theme_blocks_css_overrides_platform(tmp_path): from app import builder dist = tmp_path / 'assets'; dist.mkdir() diff --git a/themes/trade-pro/_professional_components.html b/themes/trade-pro/_professional_components.html index 1149ef4..202de68 100644 --- a/themes/trade-pro/_professional_components.html +++ b/themes/trade-pro/_professional_components.html @@ -39,5 +39,5 @@ {% macro grid(items,kind='product') %}
{{ page.summary }}
{% else %}Complete this page's content in the admin console.
{% endif %}{% endmacro %} diff --git a/themes/trade-pro/pro.html b/themes/trade-pro/pro.html index a8e6081..a9fad52 100644 --- a/themes/trade-pro/pro.html +++ b/themes/trade-pro/pro.html @@ -16,7 +16,7 @@ keeping all 7 default sections so only the labels change, never coverage. #} {% set tp_nav=[{'title':'Home','route':'/'},{'title':'Products','route':'/products/'},{'title':'Brands','route':'/brands/'},{'title':'News','route':'/news/'},{'title':'Cases','route':'/cases/'},{'title':'About','route':'/about/'},{'title':'Contact','route':'/contact/'}] if tp_needs_en_nav else nav %} {% if chrome_is_custom %}