Files
saasshop/tests/Feature/AdminComponentsCssGovernanceBlocksShouldUseThemeTokensTest.php

42 lines
1.6 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?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。
// row-warn/row-warn-prefix 允许复用到仪表盘(按页面 scope但平台订单列表的 scope 仍必须存在。
$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);
}
}