style(admin): scope row-warn styles for dashboard and keep platform orders guards
This commit is contained in:
@@ -32,9 +32,10 @@ class AdminComponentsCssGovernanceBlocksShouldUseThemeTokensTest extends TestCas
|
||||
$this->assertStringContainsString('background:var(--adm-error-bg', $css);
|
||||
|
||||
// 列表行内治理提示(row-warn)也必须用 token。
|
||||
$this->assertStringContainsString('.platform-orders-table .row-warn{', $css);
|
||||
// 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('.platform-orders-table .row-warn-prefix', $css);
|
||||
$this->assertStringContainsString('background:var(--adm-error-tint', $css);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -26,7 +26,8 @@ class AdminPlatformOrderIndexRowWarnPrefixStyleScopedTest extends TestCase
|
||||
$css = file_get_contents(public_path('css/admin-components.css'));
|
||||
$this->assertIsString($css);
|
||||
|
||||
$this->assertStringContainsString('.platform-orders-table .row-warn-prefix{', $css);
|
||||
// 允许同一套样式同时覆盖仪表盘最近订单(通过 [data-page="admin.dashboard"] 范围),但平台订单列表的 scope 仍必须存在。
|
||||
$this->assertStringContainsString('.platform-orders-table .row-warn-prefix', $css);
|
||||
|
||||
// 避免全局污染
|
||||
$this->assertStringNotContainsString("\n.row-warn-prefix{", $css);
|
||||
|
||||
@@ -27,7 +27,8 @@ class AdminPlatformOrderIndexRowWarnStyleScopedTest extends TestCase
|
||||
$css = file_get_contents(public_path('css/admin-components.css'));
|
||||
|
||||
$this->assertIsString($css);
|
||||
$this->assertStringContainsString('.platform-orders-table .row-warn{', $css);
|
||||
// 允许同一套样式同时覆盖仪表盘最近订单(通过 [data-page="admin.dashboard"] 范围),但平台订单列表的 scope 仍必须存在。
|
||||
$this->assertStringContainsString('.platform-orders-table .row-warn', $css);
|
||||
|
||||
// 仅避免“全局 .row-warn{...}”这种写法(会污染其它页面)。
|
||||
$this->assertStringNotContainsString("\n.row-warn{", $css);
|
||||
|
||||
Reference in New Issue
Block a user