<?php

namespace Tests\Feature;

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

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

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

        $this->assertStringContainsString('.table-wrap table.platform-orders-table{', $css);

        // 避免对所有 table-wrap 下的 table 生效（影响其它页面表格）
        $this->assertStringNotContainsString("\n.table-wrap table{", $css);
    }
}
