chore(admin-ui): stop loading legacy admin.css and enforce new css stack

This commit is contained in:
萝卜
2026-03-16 00:55:33 +08:00
parent 4ba22a5695
commit d5b6058c4f
4 changed files with 63 additions and 2 deletions

View File

@@ -5,7 +5,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<title>总台管理登录 - SaaSShop</title> <title>总台管理登录 - SaaSShop</title>
<link rel="stylesheet" href="/css/admin-base.css"> <link rel="stylesheet" href="/css/admin-base.css">
<link rel="stylesheet" href="/css/admin.css"> <link rel="stylesheet" href="/css/admin-theme.css">
<link rel="stylesheet" href="/css/admin-base.css">
<link rel="stylesheet" href="/css/admin-components.css">
</head> </head>
<body class="login-page"> <body class="login-page">
<div class="card-login"> <div class="card-login">

View File

@@ -6,7 +6,6 @@
<title>@yield('title', 'SaaSShop 总台管理')</title> <title>@yield('title', 'SaaSShop 总台管理')</title>
<link rel="stylesheet" href="/css/admin-theme.css"> <link rel="stylesheet" href="/css/admin-theme.css">
<link rel="stylesheet" href="/css/admin-base.css"> <link rel="stylesheet" href="/css/admin-base.css">
<link rel="stylesheet" href="/css/admin.css">
<link rel="stylesheet" href="/css/admin-components.css"> <link rel="stylesheet" href="/css/admin-components.css">
</head> </head>
<body> <body>

View File

@@ -0,0 +1,37 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminLayoutShouldNotLoadLegacyAdminCssTest 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_layout_should_not_load_legacy_admin_css(): void
{
$this->loginAsPlatformAdmin();
$response = $this->get('/admin');
$response->assertOk();
// legacy admin.css 是旧的暗色风格压缩文件,会覆盖新的 token 化样式体系。
$response->assertDontSee('/css/admin.css', false);
// 新的样式体系必须加载。
$response->assertSee('/css/admin-theme.css', false);
$response->assertSee('/css/admin-base.css', false);
$response->assertSee('/css/admin-components.css', false);
}
}

View File

@@ -0,0 +1,23 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminLoginPageShouldLoadNewAdminCssStackTest extends TestCase
{
use RefreshDatabase;
public function test_admin_login_page_should_load_new_admin_css_stack(): void
{
$response = $this->get('/admin/login');
$response->assertOk();
// login 页面也要走 token 化样式栈,避免被 legacy admin.css 暗色风格污染。
$response->assertDontSee('/css/admin.css', false);
$response->assertSee('/css/admin-theme.css', false);
$response->assertSee('/css/admin-base.css', false);
$response->assertSee('/css/admin-components.css', false);
}
}