<?php

namespace Tests\Feature;

use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;

class AdminComponentsCssListCardTableShouldUseThemeTableTokensTest 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_components_css_list_card_table_should_use_theme_table_tokens(): void
    {
        $this->loginAsPlatformAdmin();

        $css = file_get_contents(public_path('css/admin-components.css'));
        $this->assertIsString($css);

        // 表头背景与 hover 背景必须走主题 token，便于统一风格与后续换肤。
        $this->assertStringContainsString('.list-card-table thead th{', $css);
        $this->assertStringContainsString('background:var(--adm-table-header-bg, #fafafa)', $css);

        $this->assertStringContainsString('.list-card-table tbody tr:hover td{', $css);
        $this->assertStringContainsString('background:var(--adm-table-row-hover-bg, rgba(22, 119, 255, .04))', $css);
    }
}
