polish: icon sizing hardened for cross-browser (review I-1/M2/M3/M4)
- .sf-tp-icon CSS width/height (Safari doesn't support var() in SVG presentation attributes); --sm variant class replaces size= call sites - search icon centered via translateY, decoupled from input height - bare-arrow test: full charset (→←↗↘⌕▾) + line-level › whitelist - new test: site.html tp_arrow must stay in sync with macro library path Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user