<?php

namespace Tests\Feature;

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

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

        $res = $this->get('/admin/platform-orders');
        $res->assertOk();

        $html = (string) $res->getContent();
        $this->assertStringContainsString('data-role="po-tools-jump-export" aria-label="定位到导出工具组"', $html);
        $this->assertStringContainsString('data-role="po-tools-jump-batch-activate" aria-label="定位到批量同步订阅工具组"', $html);
        $this->assertStringContainsString('data-role="po-tools-jump-batch-bmpa" aria-label="定位到批量标记支付并生效工具组"', $html);
        $this->assertStringContainsString('data-role="po-tools-jump-batch-mark-activated" aria-label="定位到批量仅标记为已生效工具组"', $html);
        $this->assertStringContainsString('data-role="po-tools-jump-clear-sync-errors" aria-label="定位到清理同步失败标记工具组"', $html);
        $this->assertStringContainsString('data-role="po-tools-jump-clear-bmpa-errors" aria-label="定位到清理批量BMPA失败标记工具组"', $html);
    }
}
