chore(admin-ui): migrate product categories index to filters/list card and admin pagination

This commit is contained in:
萝卜
2026-03-16 03:37:14 +08:00
parent 1e64bbc6d3
commit 08c6912d14
2 changed files with 125 additions and 60 deletions

View File

@@ -0,0 +1,45 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminProductCategoriesIndexShouldUseFiltersAndListCardStructureTest 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_product_categories_index_should_use_filters_and_list_card_structure(): void
{
$this->loginAsPlatformAdmin();
$response = $this->get('/admin/product-categories');
$response->assertOk();
// 护栏:商品分类页应使用统一 Filters Card + List Card 结构,便于全站后台观感一致。
$response->assertSee('filters-card', false);
$response->assertSee('filters-summary', false);
$response->assertSee('filters-body', false);
$response->assertSee('filters-grid', false);
$response->assertSee('list-card', false);
$response->assertSee('list-card-header', false);
$response->assertSee('list-card-body', false);
$response->assertSee('list-card-table', false);
// 分页统一:此页数据量可能不足导致 hasPages=false因此用扫描型护栏断言。
$blade = file_get_contents(resource_path('views/admin/product_categories/index.blade.php'));
$this->assertIsString($blade);
$this->assertStringContainsString("links('pagination.admin')", $blade);
}
}