style(admin): scope row-warn styles for dashboard and keep platform orders guards

This commit is contained in:
萝卜
2026-03-16 14:22:16 +08:00
parent 51172e2664
commit ce26dd0454
5 changed files with 36 additions and 8 deletions

View File

@@ -0,0 +1,21 @@
<?php
namespace Tests\Feature;
use Tests\TestCase;
class AdminDashboardRowWarnStyleShouldBeScopedTest extends TestCase
{
public function test_admin_dashboard_row_warn_style_should_be_scoped(): void
{
$css = (string) file_get_contents(public_path('css/admin-components.css'));
// 仪表盘最近订单也使用 row-warn/row-warn-prefix但必须“按页面范围”提供样式避免依赖平台订单列表页的 table scope。
$this->assertStringContainsString('[data-page="admin.dashboard"] .row-warn{', $css);
$this->assertStringContainsString('[data-page="admin.dashboard"] .row-warn-prefix{', $css);
// 保持治理:禁止出现全局 .row-warn{...} 或 .row-warn-prefix{...},避免污染其它页面。
$this->assertStringNotContainsString("\n.row-warn{", $css);
$this->assertStringNotContainsString("\n.row-warn-prefix{", $css);
}
}