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') %}
{% for item in items %}{{ card(item,kind,loop.index0) }}{% else %}
No published content in this section yet.
{% endfor %}
{% endmacro %} {% macro section_title(eyebrow,heading,href='') %}
{{ eyebrow }}

{{ heading }}

{% if href %}Browse all {{ icon('arrow-right') }}{% endif %}
{% endmacro %} {% macro filters() %}
{% endmacro %} -{% macro footer_links(nav) %}{% endmacro %} +{% macro footer_links(nav) %}{% endmacro %} {% macro body_copy(content,page) %}{% if content %}
{{ content }}
{% elif page.summary %}

{{ 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 %}
{{ chrome.header.announcement }}{{ site.tagline or site.name }}
{% else %}
GLOBAL SOURCING · QUALITY · DELIVERYINTERNATIONAL B2B SOLUTIONS
{% endif %} -
{% if chrome_is_custom %}{% if chrome.header.show_cta %}{{chrome.header.cta_text}} {{ icon('arrow-right') }}{% endif %}{% else %}Request a Quote {{ icon('arrow-right') }}{% endif %}
{% if categories %}{% endif %}
+
{% if chrome_is_custom %}{% if chrome.header.show_cta %}{{chrome.header.cta_text}} {{ icon('arrow-right') }}{% endif %}{% else %}Request a Quote {{ icon('arrow-right') }}{% endif %}
{% if categories %}{% endif %}
{% if not designer_replace %}{% include 'trade-pro/pages/' ~ kind ~ '.html' %}{% endif %} {% if has_custom and kind!='notfound' %}
{{custom_blocks}}
{% else %}
{% endif %} diff --git a/themes/trade-pro/theme.css b/themes/trade-pro/theme.css index d2631a4..2c99ac6 100644 --- a/themes/trade-pro/theme.css +++ b/themes/trade-pro/theme.css @@ -587,11 +587,20 @@ body.sf-theme-trade-pro { /* ── 图标(Task 9 SVG 宏库:内联线条图标的对齐与间距)── */ -/* 基线对齐:inline 上下文垂直居中,flex 上下文不被压缩换行 */ +/* 基线对齐:inline 上下文垂直居中,flex 上下文不被压缩换行。 + 尺寸在 CSS 层固定(Safari 等引擎不支持 width/height 属性中的 var(), + 属性值仅作无 CSS 场景的渐进增强;CSS 覆盖属性保证跨引擎一致) */ .sf-tp-icon { display: inline-block; vertical-align: middle; flex-shrink: 0; + width: var(--sf-tp-icon-size-md, 20px); + height: var(--sf-tp-icon-size-md, 20px); +} + +.sf-tp-icon--sm { + width: var(--sf-tp-icon-size-sm, 16px); + height: var(--sf-tp-icon-size-sm, 16px); } /* 按钮内紧跟文字的图标留出呼吸空间(flex gap 之外的显式间距, @@ -617,7 +626,8 @@ body.sf-theme-trade-pro { .sf-theme-trade-pro .pro-filter-search-box .sf-tp-icon { position: absolute; inset-inline-start: var(--sf-tp-space-3); - inset-block-end: var(--sf-tp-space-3); + inset-block-start: 50%; + transform: translateY(-50%); pointer-events: none; color: var(--sf-tp-color-text-muted); }