chore(admin-ui): migrate products list to list card and admin pagination

This commit is contained in:
萝卜
2026-03-16 03:42:43 +08:00
parent 08c6912d14
commit 053fc71dc8
2 changed files with 53 additions and 6 deletions

View File

@@ -0,0 +1,40 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminProductsIndexShouldUseListCardAndAdminPaginationTest 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_products_index_should_use_list_card_and_admin_pagination(): void
{
$this->loginAsPlatformAdmin();
$res = $this->get('/admin/products');
$res->assertOk();
// 护栏:商品列表区域应走统一 List Card 骨架。
$res->assertSee('list-card', false);
$res->assertSee('list-card-header', false);
$res->assertSee('list-card-body', false);
$res->assertSee('list-card-table', false);
// 分页统一:数据量可能不足导致 hasPages=false因此用扫描型护栏断言。
$blade = file_get_contents(resource_path('views/admin/products/index.blade.php'));
$this->assertIsString($blade);
$this->assertStringContainsString("links('pagination.admin')", $blade);
}
}