chore(admin-ui): tokenise governance blocks and warn hints

This commit is contained in:
萝卜
2026-03-16 00:45:35 +08:00
parent aeee25e78c
commit f73f2dddac
3 changed files with 55 additions and 9 deletions

View File

@@ -0,0 +1,40 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminComponentsCssGovernanceBlocksShouldUseThemeTokensTest extends TestCase
{
use RefreshDatabase;
protected function loginAsPlatformAdmin(): void
{
$this->seed();
$this->post('/admin/login', [
'email' => 'platform.admin@demo.local',
'password' => 'Platform@123456',
])->assertRedirect('/admin');
}
public function test_admin_components_css_governance_blocks_should_use_theme_tokens(): void
{
$this->loginAsPlatformAdmin();
$css = file_get_contents(public_path('css/admin-components.css'));
$this->assertIsString($css);
// 治理提示块必须用主题 token避免硬编码色值导致整体风格难以统一。
$this->assertStringContainsString('.governance-block{', $css);
$this->assertStringContainsString('border:1px solid var(--adm-error-border-soft', $css);
$this->assertStringContainsString('background:var(--adm-error-bg', $css);
// 列表行内治理提示row-warn也必须用 token。
$this->assertStringContainsString('.platform-orders-table .row-warn{', $css);
$this->assertStringContainsString('border-left:3px solid var(--adm-error', $css);
$this->assertStringContainsString('.platform-orders-table .row-warn-prefix{', $css);
$this->assertStringContainsString('background:var(--adm-error-tint', $css);
}
}