diff --git a/tests/Feature/AdminCssShouldNotHardcodeNeutralRgbaValuesTest.php b/tests/Feature/AdminCssShouldNotHardcodeNeutralRgbaValuesTest.php new file mode 100644 index 0000000..d9999c5 --- /dev/null +++ b/tests/Feature/AdminCssShouldNotHardcodeNeutralRgbaValuesTest.php @@ -0,0 +1,40 @@ +seed(); + + $this->post('/admin/login', [ + 'email' => 'platform.admin@demo.local', + 'password' => 'Platform@123456', + ])->assertRedirect('/admin'); + } + + public function test_admin_css_should_not_hardcode_neutral_rgba_values(): void + { + $this->loginAsPlatformAdmin(); + + $components = file_get_contents(public_path('css/admin-components.css')); + $base = file_get_contents(public_path('css/admin-base.css')); + + $this->assertIsString($components); + $this->assertIsString($base); + + // 中性色(15,23,42)也应尽量通过 token/var() 管理,避免散落硬编码导致“质感”不可统一。 + // 说明:允许出现在 var() fallback 内(例如 var(--adm-shadow-popover, 0 12px 30px rgba(...)))。 + $this->assertStringNotContainsString('background:rgba(15, 23, 42', $components); + $this->assertStringNotContainsString('background:rgba(15, 23, 42', $base); + + $this->assertStringNotContainsString('box-shadow:0 12px 30px rgba(15, 23, 42', $components); + $this->assertStringNotContainsString('box-shadow:0 12px 30px rgba(15, 23, 42', $base); + } +}