Files
saasshop/tests/Feature/AdminBaseCssInfoWarningShouldUseThemeWarningTokensTest.php

39 lines
1.3 KiB
PHP
Raw 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 AdminBaseCssInfoWarningShouldUseThemeWarningTokensTest 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_base_css_info_warning_should_use_theme_warning_tokens(): void
{
$this->loginAsPlatformAdmin();
$css = file_get_contents(public_path('css/admin-base.css'));
$this->assertIsString($css);
// info-warning 属于提示条,应引用 warning 主题令牌(颜色/背景/圆角统一)
$this->assertStringContainsString('.info-warning{', $css);
$this->assertStringContainsString('color:var(--adm-warning', $css);
$this->assertStringContainsString('background:var(--adm-warning-bg', $css);
$this->assertStringContainsString('border-radius:var(--adm-radius-sm', $css);
// 不应再硬编码旧的 border-color文字色在其它类中仍可能出现这里只约束 info-warning 组件本身)
$this->assertStringNotContainsString('border:1px solid #f59e0b', $css);
}
}