feat: theme-level blocks.css takes priority over platform asset

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-10-22 17:49:12 +08:00
parent 712ccac058
commit 960f7b1002
2 changed files with 19 additions and 1 deletions
+13
View File
@@ -91,3 +91,16 @@ def test_env_for_degraded_branch_not_cached_and_single_path(tmp_path, monkeypatc
assert 'industrial' not in theme_pro._ENVS
finally:
core.THEMES = core.discover_themes()
def test_theme_blocks_css_overrides_platform(tmp_path):
from app import builder
dist = tmp_path / 'assets'; dist.mkdir()
theme_dir = tmp_path / 'theme'; theme_dir.mkdir()
(theme_dir / 'blocks.css').write_text('/* theme version */', encoding='utf-8')
builder.copy_blocks_css(theme_dir, dist)
assert (dist / 'blocks.css').read_text(encoding='utf-8') == '/* theme version */'
# 无主题版时回落平台版
dist2 = tmp_path / 'assets2'; dist2.mkdir()
builder.copy_blocks_css(tmp_path / 'nonexistent', dist2)
assert (dist2 / 'blocks.css').is_file()
assert (dist2 / 'blocks.css').read_text(encoding='utf-8') != '/* theme version */'